Skip to content

Commit f05b86d

Browse files
committed
gfs2: Prepare to withdraw as soon as an IO error occurs in log write
Before this patch, function gfs2_end_log_write would detect any IO errors writing to the journal and put out an appropriate message, but it never set a withdrawing condition. Eventually, the log daemon would see the error and determine it was time to withdraw, but in the meantime, other processes could continue running as if nothing bad ever happened. The biggest consequence is that __gfs2_glock_put would BUG() when it saw that there were still unwritten items. This patch sets the WITHDRAWING status as soon as an IO error is detected, and that way, the BUG will be avoided so the file system can be properly withdrawn and unmounted. Signed-off-by: Bob Peterson <[email protected]> Reviewed-by: Andreas Gruenbacher <[email protected]>
1 parent 5e4c763 commit f05b86d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

fs/gfs2/lops.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,9 @@ static void gfs2_end_log_write(struct bio *bio)
206206
if (!cmpxchg(&sdp->sd_log_error, 0, (int)bio->bi_status))
207207
fs_err(sdp, "Error %d writing to journal, jid=%u\n",
208208
bio->bi_status, sdp->sd_jdesc->jd_jid);
209+
gfs2_withdraw_delayed(sdp);
210+
/* prevent more writes to the journal */
211+
clear_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags);
209212
wake_up(&sdp->sd_logd_waitq);
210213
}
211214

0 commit comments

Comments
 (0)