From: Andrew Deason Date: Fri, 31 Jan 2014 22:46:12 +0000 (-0600) Subject: afs: Throttle byte-range locks warnings per-file X-Git-Tag: upstream/1.6.8^2~25 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=4750f4ce272f944cc8d02e4fedf6e78ea153d7f9;p=packages%2Fo%2Fopenafs.git afs: Throttle byte-range locks warnings per-file 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. Reviewed-on: http://gerrit.openafs.org/10796 Reviewed-by: D Brashear Tested-by: BuildBot (cherry picked from commit 9f90b12e14e5511cb1c11cbc4d85cfa291be861f) Change-Id: Ia5426e97fa431e6b9eeb1c82e03c74c959249e9a Reviewed-on: http://gerrit.openafs.org/10839 Tested-by: BuildBot Reviewed-by: Andrew Deason Reviewed-by: D Brashear Reviewed-by: Stephan Wiesand --- diff --git a/src/afs/VNOPS/afs_vnop_flock.c b/src/afs/VNOPS/afs_vnop_flock.c index 4d03dc1de..e330a0d6b 100644 --- a/src/afs/VNOPS/afs_vnop_flock.c +++ b/src/afs/VNOPS/afs_vnop_flock.c @@ -535,6 +535,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); @@ -545,7 +548,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 diff --git a/src/afs/afs.h b/src/afs/afs.h index e77d16aa8..88d5f7763 100644 --- a/src/afs/afs.h +++ b/src/afs/afs.h @@ -895,6 +895,7 @@ struct vcache { #ifdef AFS_SUN5_ENV struct afs_q multiPage; /* list of multiPage_range structs */ #endif + afs_uint32 lastBRLWarnTime; /* last time we warned about byte-range locks */ }; #define DONT_CHECK_MODE_BITS 0