Skip to contentSkip to conversation

- Allow journal recovery on read-only mount

PATCH In review Abhijith Das 2 participants 4 messages Jan 18, 2008 – Jan 21, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 - 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.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: journal-recovery-on-RO-mount.patch
Type: text/x-patch
Size: 889 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/cluster-devel/attachments/20080118/87848243/attachment.bin>

#1 lore raw

PATCH 1/1 - Allow journal recovery on read-only mount

I'm NACKing this on Dave's suggestion that we restrict this behavior to standalone gfs2 filesystems (lock_nolock). I'm working on a patch for that and will post it soon.

--Abhi

Quoted 46 lines · Abhijith Das

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.

------------------------------------------------------------------------

fs/gfs2/recovery.c +12 -4
index 27c994f..b249e29 100644
@@ -504,13 +504,21 @@ int gfs2_recover_journal(struct gfs2_jde
 			if (!test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags))
 				ro = 1;
 		} else {
-			if (sdp->sd_vfs->s_flags & MS_RDONLY)
-				ro = 1;
+			if (sdp->sd_vfs->s_flags & MS_RDONLY) {
+				/* 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) {
-			fs_warn(sdp, "jid=%u: Can't replay: read-only FS\n",
-				jd->jd_jid);
+			fs_warn(sdp, "jid=%u: Can't replay: read-only block "
+				"device\n", jd->jd_jid);
 			error = -EROFS;
 			goto fail_gunlock_tr;
 		}
#2 lore raw

PATCH 1/1 - Allow journal recovery on read-only mount

Hi,

Quoted 6 lines · Abhijith Das

I'm NACKing this on Dave's suggestion that we restrict this behavior to standalone gfs2 filesystems (lock_nolock). I'm working on a patch for that and will post it soon.

--Abhi

Why? I don't see the need for such a restriction. The original patch looks ok to me,

Steve.

Quoted 49 lines
Quoted 46 lines · Abhijith Das

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.

------------------------------------------------------------------------

fs/gfs2/recovery.c +12 -4
index 27c994f..b249e29 100644
@@ -504,13 +504,21 @@ int gfs2_recover_journal(struct gfs2_jde
 			if (!test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags))
 				ro = 1;
 		} else {
-			if (sdp->sd_vfs->s_flags & MS_RDONLY)
-				ro = 1;
+			if (sdp->sd_vfs->s_flags & MS_RDONLY) {
+				/* 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) {
-			fs_warn(sdp, "jid=%u: Can't replay: read-only FS\n",
-				jd->jd_jid);
+			fs_warn(sdp, "jid=%u: Can't replay: read-only block "
+				"device\n", jd->jd_jid);
 			error = -EROFS;
 			goto fail_gunlock_tr;
 		}
#3 lore raw
In reply to Abhijith Das

Hi,

Quoted 10 lines · Abhijith Das

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.

I've applied this one since I want to get all the patches ready for posting prior to the forthcoming merge window. If we need to alter it, then we can do that later,

Steve.