Re: Strange remount behaviour with ext3-2.4-0.9.4

From: Andrew Morton (
Date: Fri Jul 27 2001 - 05:24:14 EST

Sean Hunter wrote:
> Following the announcement on lkml, I have started using ext3 on one of my
> servers. Since the server in question is a farily security-sensitive box, my
> /usr partition is mounted read only except when I remount rw to install
> packages.
> I converted this partition to run ext3 with the mount options
> "nodev,ro,data=writeback,defaults" figuring that when I need to install new
> packages etc, that I could just mount rw as before and that metadata-only
> journalling would be ok for this partition as it really sees very little write
> activity.
> When I try to remount it r/w I get a log message saying:
> Jul 27 09:54:29 henry kernel: EXT3-fs: cannot change data mode on remount
> ...even if I give the full mount option list with the remount instruction.

hmm.. The mount option handling there is a bit bogus.

What we *should* do on remount is check that the requested
journalling mode is equal to the current mode. ext3 won't
allow you to change the journalling mode on-the-fly.

So... you will have to omit the `data=xxx' portion of the
mount options when remounting. It's being invisibly added
by /bin/mount.

/bin/mount tries to be smart. If, for example you have

        /dev/hdf12 /mnt/hdf12 ext3 noauto,ro,data=writeback 1

in /etc/fstab and then type

        mount /dev/hdf12 -o remount,rw

then /bin/mount runs off and looks up the fstab entry and
inserts the mount options. However if you instead type

        mount /dev/hdf12 /mnt/hdf12 -o remount,rw (1)

then /bin/mount does *not* look up the fstab entry, and
the remount succeeds.

ho-hum. For the while you'll have to fiddle with the mount
usage to get things working right. Equation (1) above will
work fine. Or apply the appended patch.

> I can, however, remount it as ext2 read-write, but when I try to remount as
> ext3 (even read only) I get the same problem.

You can't switch between ext2 and ext3 with a remount - unmount
is needed.

> Wierdly, "mount" lists it as being still an ext3 partition even though it has
> been remounted as ext2. I can't umount /usr because kjournald is currently
> listed as using the partition.

That sounds very weird. Could you please describe the steps
you took to create this state?

Sometimes /etc/mtab gets out of sync - especially for the
root fs. It's more reliable to look in /proc/mounts

Here's the fix for the data= handling on remount:

Index: fs/ext3/super.c
RCS file: /cvsroot/gkernel/ext3/fs/ext3/super.c,v
retrieving revision 1.31
diff -u -r1.31 super.c
--- fs/ext3/super.c 2001/07/19 14:43:08 1.31
+++ fs/ext3/super.c 2001/07/27 10:14:48
@@ -513,12 +513,6 @@
                         if (want_value(value, "data"))
                                 return 0;
- if (is_remount) {
- printk ("EXT3-fs: cannot change data mode "
- "on remount\n");
- return 0;
- }
                         if (!strcmp (value, "journal"))
                                 data_opt = EXT3_MOUNT_JOURNAL_DATA;
                         else if (!strcmp (value, "ordered"))
@@ -529,9 +523,18 @@
                                 printk ("EXT3-fs: Invalid data option: %s\n",
                                 return 0;
+ }
+ if (is_remount) {
+ if ((*mount_options & EXT3_MOUNT_DATA_FLAGS) !=
+ data_opt) {
+ printk("EXT3-fs: cannot change data "
+ "mode on remount\n");
+ return 0;
+ }
+ } else {
+ *mount_options &= ~EXT3_MOUNT_DATA_FLAGS;
+ *mount_options |= data_opt;
- *mount_options &= ~EXT3_MOUNT_DATA_FLAGS;
- *mount_options |= data_opt;
                 } else {
                         printk ("EXT3-fs: Unrecognized mount option %s\n",
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

This archive was generated by hypermail 2b29 : Tue Jul 31 2001 - 21:00:31 EST