Skip to content

Commit b66f723

Browse files
author
Andreas Gruenbacher
committed
gfs2: Improve gfs2_make_fs_rw error handling
In gfs2_make_fs_rw(), make sure to call gfs2_consist() to report an inconsistency and mark the filesystem as withdrawn when gfs2_find_jhead() fails. At the end of gfs2_make_fs_rw(), when we discover that the filesystem has been withdrawn, make sure we report an error. This also replaces the gfs2_withdrawn() check after gfs2_find_jhead(). Reported-by: Tetsuo Handa <[email protected]> Cc: [email protected] Signed-off-by: Andreas Gruenbacher <[email protected]>
1 parent 445cb12 commit b66f723

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

fs/gfs2/super.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,10 @@ int gfs2_make_fs_rw(struct gfs2_sbd *sdp)
138138
return -EIO;
139139

140140
error = gfs2_find_jhead(sdp->sd_jdesc, &head, false);
141-
if (error || gfs2_withdrawn(sdp))
141+
if (error) {
142+
gfs2_consist(sdp);
142143
return error;
144+
}
143145

144146
if (!(head.lh_flags & GFS2_LOG_HEAD_UNMOUNT)) {
145147
gfs2_consist(sdp);
@@ -151,7 +153,9 @@ int gfs2_make_fs_rw(struct gfs2_sbd *sdp)
151153
gfs2_log_pointers_init(sdp, head.lh_blkno);
152154

153155
error = gfs2_quota_init(sdp);
154-
if (!error && !gfs2_withdrawn(sdp))
156+
if (!error && gfs2_withdrawn(sdp))
157+
error = -EIO;
158+
if (!error)
155159
set_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags);
156160
return error;
157161
}

0 commit comments

Comments
 (0)