Commit 085e423b authored by Andreas Gruenbacher's avatar Andreas Gruenbacher
Browse files

gfs2: Randomize GLF_VERIFY_DELETE work delay



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: default avatarAndreas Gruenbacher <agruenba@redhat.com>
parent f6ca45e3
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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);
}