]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
lib/file: Add a comment on why sleeps for file locks are randomized
authorOliver Kurth <okurth@vmware.com>
Fri, 15 Sep 2017 18:23:48 +0000 (11:23 -0700)
committerOliver Kurth <okurth@vmware.com>
Fri, 15 Sep 2017 18:23:48 +0000 (11:23 -0700)
The randomization prevents lock cadence issues (thundering herds).

open-vm-tools/lib/file/fileLockPrimitive.c

index f1a3b5212e007c0a1132729ddd8c1048036bb549..2a64cc5b18ab1eef7365e148e6007a4461212a5a 100644 (file)
@@ -148,6 +148,11 @@ FileLockSleeper(LockValues *myValues)  // IN/OUT:
       maxSleepTimeMsec = MIN(ageMsec / 10, 2000);
    }
 
+   /*
+    * Randomize the time slept. This will prevent any potential cadence issues
+    * (thundering herds).
+    */
+
    (void) FileSleeper(maxSleepTimeMsec / 10, maxSleepTimeMsec);
 
    return 0;