mirror of
https://github.com/rd-stuffs/msm-4.14.git
synced 2025-02-20 11:45:48 +08:00
[GFS2] Allow journal recovery on read-only mount
This patch allows gfs2 to perform journal recovery even if it is mounted read-only. Strictly speaking, a read-only mount should not be writing to the filesystem, but we do this only to perform journal recovery. A read-only mount will fail if we don't recover the dirty journal. Also, when gfs2 is used as a root filesystem, it will be mounted read-only before being mounted read-write during the boot sequence. A failed read-only mount will panic the machine during bootup. Signed-off-by: Abhijith Das <adas@redhat.com> Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
This commit is contained in:
parent
1b8177ec1e
commit
7bc5c414fe
@ -504,13 +504,21 @@ int gfs2_recover_journal(struct gfs2_jdesc *jd)
|
|||||||
if (!test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags))
|
if (!test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags))
|
||||||
ro = 1;
|
ro = 1;
|
||||||
} else {
|
} else {
|
||||||
if (sdp->sd_vfs->s_flags & MS_RDONLY)
|
if (sdp->sd_vfs->s_flags & MS_RDONLY) {
|
||||||
ro = 1;
|
/* check if device itself is read-only */
|
||||||
|
ro = bdev_read_only(sdp->sd_vfs->s_bdev);
|
||||||
|
if (!ro) {
|
||||||
|
fs_info(sdp, "recovery required on "
|
||||||
|
"read-only filesystem.\n");
|
||||||
|
fs_info(sdp, "write access will be "
|
||||||
|
"enabled during recovery.\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ro) {
|
if (ro) {
|
||||||
fs_warn(sdp, "jid=%u: Can't replay: read-only FS\n",
|
fs_warn(sdp, "jid=%u: Can't replay: read-only block "
|
||||||
jd->jd_jid);
|
"device\n", jd->jd_jid);
|
||||||
error = -EROFS;
|
error = -EROFS;
|
||||||
goto fail_gunlock_tr;
|
goto fail_gunlock_tr;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user