]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
gfs2: Don't sleep during glock hash walk
authorAndreas Gruenbacher <agruenba@redhat.com>
Wed, 10 Jun 2020 16:31:56 +0000 (18:31 +0200)
committerAndreas Gruenbacher <agruenba@redhat.com>
Tue, 30 Jun 2020 11:04:45 +0000 (13:04 +0200)
In flush_delete_work, instead of flushing each individual pending
delayed work item, cancel and re-queue them for immediate execution.
The waiting isn't needed here because we're already waiting for all
queued work items to complete in gfs2_flush_delete_work.  This makes the
code more efficient, but more importantly, it avoids sleeping during a
rhashtable walk, inside rcu_read_lock().

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

index 2299dcc417eae983d9c681553623182759ce11ac..8545024a1401f74bfe70e1e97154a29682331715 100644 (file)
@@ -1899,7 +1899,10 @@ bool gfs2_delete_work_queued(const struct gfs2_glock *gl)
 
 static void flush_delete_work(struct gfs2_glock *gl)
 {
-       flush_delayed_work(&gl->gl_delete);
+       if (cancel_delayed_work(&gl->gl_delete)) {
+               queue_delayed_work(gfs2_delete_workqueue,
+                                  &gl->gl_delete, 0);
+       }
        gfs2_glock_queue_work(gl, 0);
 }