From: Abhijith Das <adas@redhat.com> Date: Thu, 24 Jan 2008 14:35:57 -0600 Subject: [GFS2] install to root volume should work Message-id: 4798F6AD.1040105@redhat.com O-Subject: [RHEL5.2 PATCH][GFS2] bz 220052 - GFS2: Install to gfs2 root volume should work. Bugzilla: 220052 When gfs2 is used as a root filesystem, recovery of a dirty journal wouldn't happen and the boot process would fail. This is due to the fact that the init program first mounts gfs2 read-only during the boot sequence and gfs2 doesn't do journal recovery when mounted read-only. This patch allows gfs2 to perform journal recovery when it is mounted read-only. This patch affects only standalone (lock_nolock) gfs2 filesystems for now. Signed-off-by: Abhijith Das <adas@redhat.com> Acked-by: Steven Whitehouse <swhiteho@redhat.com> diff --git a/fs/gfs2/recovery.c b/fs/gfs2/recovery.c index beb6c7a..bd587d8 100644 --- a/fs/gfs2/recovery.c +++ b/fs/gfs2/recovery.c @@ -504,8 +504,20 @@ int gfs2_recover_journal(struct gfs2_jdesc *jd) if (!test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags)) ro = 1; } else { - if (sdp->sd_vfs->s_flags & MS_RDONLY) - ro = 1; + if (bdev_read_only(sdp->sd_vfs->s_bdev)) { + fs_warn(sdp, "jid=%u: Can't replay: read-only " + " block device\n", jd->jd_jid); + error = -EROFS; + goto fail_gunlock_tr; + } + if ((ro = sdp->sd_vfs->s_flags & MS_RDONLY) && + strncmp(sdp->sd_proto_name, "lock_nolock", 11) == 0) { + fs_info(sdp, "recovery required on read-only " + "filesystem.\n"); + fs_info(sdp, "write access will be enabled " + "during recovery.\n"); + ro = 0; + } } if (ro) {