From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bob Peterson Date: Mon, 9 Dec 2019 09:36:52 -0600 Subject: [Cluster-devel] [GFS2 v8 PATCH 14/22] gfs2: Prepare to withdraw as soon as an IO error occurs in log write In-Reply-To: <20191209153700.700208-1-rpeterso@redhat.com> References: <20191209153700.700208-1-rpeterso@redhat.com> Message-ID: <20191209153700.700208-15-rpeterso@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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 --- fs/gfs2/lops.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/gfs2/lops.c b/fs/gfs2/lops.c index 2d59c2c4fa67..2f4c478e7bb7 100644 --- a/fs/gfs2/lops.c +++ b/fs/gfs2/lops.c @@ -206,6 +206,9 @@ static void gfs2_end_log_write(struct bio *bio) if (!cmpxchg(&sdp->sd_log_error, 0, (int)bio->bi_status)) fs_err(sdp, "Error %d writing to journal, jid=%u\n", bio->bi_status, sdp->sd_jdesc->jd_jid); + set_bit(SDF_WITHDRAWING, &sdp->sd_flags); + /* prevent more writes to the journal */ + clear_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags); wake_up(&sdp->sd_logd_waitq); } -- 2.23.0