]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
gfs2: Report when glocks cannot be freed for a long time
authorAndreas Gruenbacher <agruenba@redhat.com>
Tue, 9 Apr 2024 07:24:27 +0000 (09:24 +0200)
committerAndreas Gruenbacher <agruenba@redhat.com>
Wed, 29 May 2024 13:34:55 +0000 (15:34 +0200)
When glocks cannot be freed for a long time, avoid the "task blocked for
more than N seconds" messages and report how many glocks are still
outstanding, instead.

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

index 2d4e927c4d2f35ed18f1cb175d420d0ebeddc750..b819f8b8d98b3ae48c8e61dc90b2d2dc8bbb7743 100644 (file)
@@ -2248,13 +2248,25 @@ void gfs2_gl_dq_holders(struct gfs2_sbd *sdp)
 
 void gfs2_gl_hash_clear(struct gfs2_sbd *sdp)
 {
+       unsigned long start = jiffies;
+       bool timed_out = false;
+
        set_bit(SDF_SKIP_DLM_UNLOCK, &sdp->sd_flags);
        flush_workqueue(glock_workqueue);
        glock_hash_walk(clear_glock, sdp);
        flush_workqueue(glock_workqueue);
-       wait_event_timeout(sdp->sd_kill_wait,
-                          atomic_read(&sdp->sd_glock_disposal) == 0,
-                          HZ * 600);
+       while (!timed_out) {
+               wait_event_timeout(sdp->sd_kill_wait,
+                                  !atomic_read(&sdp->sd_glock_disposal),
+                                  HZ * 60);
+               if (!atomic_read(&sdp->sd_glock_disposal))
+                       break;
+               timed_out = time_after(jiffies, start + (HZ * 600));
+               fs_warn(sdp, "%u glocks left after %u seconds%s\n",
+                       atomic_read(&sdp->sd_glock_disposal),
+                       jiffies_to_msecs(jiffies - start) / 1000,
+                       timed_out ? ":" : "; still waiting");
+       }
        gfs2_lm_unmount(sdp);
        gfs2_free_dead_glocks(sdp);
        glock_hash_walk(dump_glock_func, sdp);