Skip to content

Commit 0a828c3

Browse files
andypriceAndreas Gruenbacher
authored andcommitted
gfs2: Fix usage of bio->bi_status in gfs2_end_log_write
bio->bi_status is an index into the blk_errors array, not an errno. Its __bitwise tag is cast away here, resulting in a sparse warning: fs/gfs2/lops.c:207:22: warning: cast from restricted blk_status_t We could either add __force to the cast and continue logging bi_status in the error message, or we could look up the errno in the array and log that. As sdp->sd_log_error is used as an errno in all other cases, look up the errno here for consistency. Signed-off-by: Andrew Price <[email protected]> Signed-off-by: Andreas Gruenbacher <[email protected]>
1 parent 2c63986 commit 0a828c3

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

fs/gfs2/lops.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,9 +204,11 @@ static void gfs2_end_log_write(struct bio *bio)
204204
struct bvec_iter_all iter_all;
205205

206206
if (bio->bi_status) {
207-
if (!cmpxchg(&sdp->sd_log_error, 0, (int)bio->bi_status))
207+
int err = blk_status_to_errno(bio->bi_status);
208+
209+
if (!cmpxchg(&sdp->sd_log_error, 0, err))
208210
fs_err(sdp, "Error %d writing to journal, jid=%u\n",
209-
bio->bi_status, sdp->sd_jdesc->jd_jid);
211+
err, sdp->sd_jdesc->jd_jid);
210212
gfs2_withdraw_delayed(sdp);
211213
/* prevent more writes to the journal */
212214
clear_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags);

0 commit comments

Comments
 (0)