afs: Throttle byte-range locks warnings per-file
authorAndrew Deason <adeason@sinenomine.net>
Fri, 31 Jan 2014 22:46:12 +0000 (16:46 -0600)
committerD Brashear <shadow@your-file-system.com>
Thu, 6 Feb 2014 04:04:52 +0000 (20:04 -0800)
Currently, the warning messages about byte-range locks are throttled
only according to what the last PID of the locking process was. So, if
that same process performs a bunch of byte-range locks a bunch of
times, we log this warning message at most once every 2 minutes.

However, if we have even just one other process also performing
byte-range locks, the throttling can become pretty useless as
lastWarnPid ping-pongs back and forth between the two different PIDs.
This can happen if multiple unrelated byte-range-lock-using pieces of
software just happen to be running on the same machine, or if a piece
of software uses byte-range locks after forking into separate
processes.

To avoid flooding the log in situations like this, keep track of the
last warn time in the relevant vcache, so we don't get frequent
warnings for byte-range lock requests on the same file.

Change-Id: I446cf6a438a75aa741c5543b93f74f4184ee6508
Reviewed-on: http://gerrit.openafs.org/10796
Reviewed-by: D Brashear <shadow@your-file-system.com>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

src/afs/VNOPS/afs_vnop_flock.c
src/afs/afs.h

index fed0bcc..f11c60c 100644 (file)
@@ -525,6 +525,9 @@ DoLockWarning(struct vcache *avc, afs_ucred_t * acred)
     if ((now < lastWarnTime + 120) && (lastWarnPid == pid)) {
        return;
     }
+    if (now < avc->lastBRLWarnTime + 120) {
+       return;
+    }
 
     procname = afs_osi_Alloc(256);
 
@@ -535,7 +538,7 @@ DoLockWarning(struct vcache *avc, afs_ucred_t * acred)
     osi_procname(procname, 256);
     procname[255] = '\0';
 
-    lastWarnTime = now;
+    lastWarnTime = avc->lastBRLWarnTime = now;
     lastWarnPid = pid;
 
 #ifdef AFS_LINUX26_ENV
index 3d7e461..fd1c54d 100644 (file)
@@ -949,6 +949,7 @@ struct vcache {
 #if !defined(UKERNEL)
     void *vpacRock;            /* used to read or write in visible partitions */
 #endif
+    afs_uint32 lastBRLWarnTime; /* last time we warned about byte-range locks */
 };
 
 #define        DONT_CHECK_MODE_BITS    0