Skip to content

Commit 51568ac

Browse files
author
Andreas Gruenbacher
committed
gfs2: Report when glocks cannot be freed for a long time
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 <[email protected]>
1 parent 8f6b8f1 commit 51568ac

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

fs/gfs2/glock.c

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2248,13 +2248,25 @@ void gfs2_gl_dq_holders(struct gfs2_sbd *sdp)
22482248

22492249
void gfs2_gl_hash_clear(struct gfs2_sbd *sdp)
22502250
{
2251+
unsigned long start = jiffies;
2252+
bool timed_out = false;
2253+
22512254
set_bit(SDF_SKIP_DLM_UNLOCK, &sdp->sd_flags);
22522255
flush_workqueue(glock_workqueue);
22532256
glock_hash_walk(clear_glock, sdp);
22542257
flush_workqueue(glock_workqueue);
2255-
wait_event_timeout(sdp->sd_kill_wait,
2256-
atomic_read(&sdp->sd_glock_disposal) == 0,
2257-
HZ * 600);
2258+
while (!timed_out) {
2259+
wait_event_timeout(sdp->sd_kill_wait,
2260+
!atomic_read(&sdp->sd_glock_disposal),
2261+
HZ * 60);
2262+
if (!atomic_read(&sdp->sd_glock_disposal))
2263+
break;
2264+
timed_out = time_after(jiffies, start + (HZ * 600));
2265+
fs_warn(sdp, "%u glocks left after %u seconds%s\n",
2266+
atomic_read(&sdp->sd_glock_disposal),
2267+
jiffies_to_msecs(jiffies - start) / 1000,
2268+
timed_out ? ":" : "; still waiting");
2269+
}
22582270
gfs2_lm_unmount(sdp);
22592271
gfs2_free_dead_glocks(sdp);
22602272
glock_hash_walk(dump_glock_func, sdp);

0 commit comments

Comments
 (0)