]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
gfs2: Randomize GLF_VERIFY_DELETE work delay
authorAndreas Gruenbacher <agruenba@redhat.com>
Fri, 13 Sep 2024 21:07:31 +0000 (23:07 +0200)
committerAndreas Gruenbacher <agruenba@redhat.com>
Tue, 5 Nov 2024 11:39:29 +0000 (12:39 +0100)
Randomize the delay of GLF_VERIFY_DELETE work.  This avoids thundering
herd problems when multiple nodes schedule that kind of work in response
to an inode being unlinked remotely.

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
fs/gfs2/glock.c

index 5455f4dd14a31ab801477fb8aac11445791ebe95..46a6e97cd9301a605af77a0605d6c48f5d706a81 100644 (file)
@@ -36,6 +36,7 @@
 #include <linux/pid_namespace.h>
 #include <linux/fdtable.h>
 #include <linux/file.h>
+#include <linux/random.h>
 
 #include "gfs2.h"
 #include "incore.h"
@@ -1018,7 +1019,7 @@ bool gfs2_queue_verify_delete(struct gfs2_glock *gl, bool later)
 
        if (test_and_set_bit(GLF_VERIFY_DELETE, &gl->gl_flags))
                return false;
-       delay = later ? 5 * HZ : 0;
+       delay = later ? HZ + get_random_long() % (HZ * 9) : 0;
        return queue_delayed_work(sdp->sd_delete_wq, &gl->gl_delete, delay);
 }