Skip to contentSkip to conversation

gfs2: Warn when log is stuck

PATCH New Andreas Gruenbacher 1 participant 1 message Jan 29, 2018 GFS2 file system

lore
Share & tools
lore

Andreas Gruenbacher

author maintainer
#0 lore raw

PATCH 1/1 gfs2: Warn when log is stuck

Warn when a log space reservation is stuck for more than 60 seconds.

---
 fs/gfs2/log.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)
fs/gfs2/log.c +13 -4
index cf6b46247df4..3e3bc63f5377 100644
@@ -354,15 +354,24 @@ int gfs2_log_reserve(struct gfs2_sbd *sdp, unsigned int blks)
 retry:
 	free_blocks = atomic_read(&sdp->sd_log_blks_free);
 	if (unlikely(free_blocks <= wanted)) {
-		do {
+		for(;;) {
 			prepare_to_wait_exclusive(&sdp->sd_log_waitq, &wait,
 					TASK_UNINTERRUPTIBLE);
 			wake_up(&sdp->sd_logd_waitq);
 			did_wait = 1;
-			if (atomic_read(&sdp->sd_log_blks_free) <= wanted)
-				io_schedule();
 			free_blocks = atomic_read(&sdp->sd_log_blks_free);
-		} while(free_blocks <= wanted);
+			if (free_blocks > wanted)
+				break;
+			io_schedule_timeout(60 * HZ);
+			free_blocks = atomic_read(&sdp->sd_log_blks_free);
+			if (free_blocks > wanted)
+				break;
+			fs_warn(sdp, "Could not reserve %u log blocks for more "
+				     "than 60 seconds, only %u out of %u "
+				     "blocks available\n",
+				wanted, free_blocks - 1,
+				sdp->sd_jdesc->jd_blocks);
+		}
 		finish_wait(&sdp->sd_log_waitq, &wait);
 	}
 	atomic_inc(&sdp->sd_reserving_log);
Signature · 1 line
2.14.3