2009-02-28 14:24:26

by Theodore Ts'o

[permalink] [raw]
Subject: [PATCH] Reorder ext4 and ext2 so that ext2 root filesystems are mounted using ext2

In fs/Makefile, ext3 was placed before ext2 so that a root filesystem
that possessed a journal, it would be mounted as ext3 instead of ext2.
This was necessary because a cleanly unmounted ext3 filesystem was
fully backwards compatible with ext2, and could be mounted by ext2 ---
but it was desirable that it be mounted with ext3 so that the
journaling would be enabled.

The ext4 filesystem supports new incompatible features, so there is no
danger of an ext4 filesystem being mistaken for an ext2 filesystem.
However, ordering didn't matter until ext4 gained the ability to mount
filesystems without a journal. Now that this is the case, given that
ext4 is before ext2, it means that root filesystems that were only
using the plain-jane ext2 format are getting mounted using the ext4
filesystem driver, which is a change in behavior which could be
surprising to users

It's doubtful that there are that many ext2-only root filesystem users
that would also have ext4 compiled into the kernel, but to adhere to
the principle of least surprise, the correct ordering in fs/Makefile
is ext3, followed by ext2, and finally ext4.

Signed-off-by: "Theodore Ts'o" <[email protected]>
---
fs/Makefile | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/Makefile b/fs/Makefile
index 38bc735..21c2f50 100644
--- a/fs/Makefile
+++ b/fs/Makefile
@@ -69,10 +69,12 @@ obj-$(CONFIG_DLM) += dlm/
# Do not add any filesystems before this line
obj-$(CONFIG_REISERFS_FS) += reiserfs/
obj-$(CONFIG_EXT3_FS) += ext3/ # Before ext2 so root fs can be ext3
-obj-$(CONFIG_EXT4_FS) += ext4/ # Before ext2 so root fs can be ext4
+obj-$(CONFIG_EXT2_FS) += ext2/
+# We place ext4 after ext2 so plain ext2 root fs's are mounted using ext4
+# unless explicitly requested by rootfstype
+obj-$(CONFIG_EXT4_FS) += ext4/
obj-$(CONFIG_JBD) += jbd/
obj-$(CONFIG_JBD2) += jbd2/
-obj-$(CONFIG_EXT2_FS) += ext2/
obj-$(CONFIG_CRAMFS) += cramfs/
obj-$(CONFIG_SQUASHFS) += squashfs/
obj-y += ramfs/
--
1.5.6.3



2009-02-28 14:39:43

by David Fries

[permalink] [raw]
Subject: Re: [PATCH] Reorder ext4 and ext2 so that ext2 root filesystems are mounted using ext2

On Sat, Feb 28, 2009 at 09:24:20AM -0500, Theodore Ts'o wrote:
> It's doubtful that there are that many ext2-only root filesystem users
> that would also have ext4 compiled into the kernel, but to adhere to
> the principle of least surprise, the correct ordering in fs/Makefile
> is ext3, followed by ext2, and finally ext4.
>
> Signed-off-by: "Theodore Ts'o" <[email protected]>
> -obj-$(CONFIG_EXT4_FS) += ext4/ # Before ext2 so root fs can be ext4
> +obj-$(CONFIG_EXT2_FS) += ext2/
> +# We place ext4 after ext2 so plain ext2 root fs's are mounted using ext4
> +# unless explicitly requested by rootfstype
> +obj-$(CONFIG_EXT4_FS) += ext4/

Try
> +# We place ext4 after ext2 so plain ext2 root fs's aren't mounted using ext4
> +# unless explicitly requested by rootfstype

--
David Fries <[email protected]>
http://fries.net/~david/ (PGP encryption key available)

2009-02-28 14:52:04

by Theodore Ts'o

[permalink] [raw]
Subject: Re: [PATCH] Reorder ext4 and ext2 so that ext2 root filesystems are mounted using ext2

On Sat, Feb 28, 2009 at 08:39:43AM -0600, David Fries wrote:
>
> Try
> > +# We place ext4 after ext2 so plain ext2 root fs's aren't mounted using ext4
> > +# unless explicitly requested by rootfstype
>

Oops, nice catch! I changed it to be:

# We place ext4 after ext2 so plain ext2 root fs's are mounted using ext2
# unless explicitly requested by rootfstype

Thanks,

- Ted

2009-02-28 15:40:40

by Eric Sandeen

[permalink] [raw]
Subject: Re: [PATCH] Reorder ext4 and ext2 so that ext2 root filesystems are mounted using ext2

Theodore Ts'o wrote:
> In fs/Makefile, ext3 was placed before ext2 so that a root filesystem
> that possessed a journal, it would be mounted as ext3 instead of ext2.
> This was necessary because a cleanly unmounted ext3 filesystem was
> fully backwards compatible with ext2, and could be mounted by ext2 ---
> but it was desirable that it be mounted with ext3 so that the
> journaling would be enabled.
>
> The ext4 filesystem supports new incompatible features, so there is no
> danger of an ext4 filesystem being mistaken for an ext2 filesystem.
> However, ordering didn't matter until ext4 gained the ability to mount
> filesystems without a journal. Now that this is the case, given that
> ext4 is before ext2, it means that root filesystems that were only
> using the plain-jane ext2 format are getting mounted using the ext4
> filesystem driver, which is a change in behavior which could be
> surprising to users
>
> It's doubtful that there are that many ext2-only root filesystem users
> that would also have ext4 compiled into the kernel, but to adhere to
> the principle of least surprise, the correct ordering in fs/Makefile
> is ext3, followed by ext2, and finally ext4.
>
> Signed-off-by: "Theodore Ts'o" <[email protected]>
> ---
> fs/Makefile | 6 ++++--
> 1 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/fs/Makefile b/fs/Makefile
> index 38bc735..21c2f50 100644
> --- a/fs/Makefile
> +++ b/fs/Makefile
> @@ -69,10 +69,12 @@ obj-$(CONFIG_DLM) += dlm/
> # Do not add any filesystems before this line
> obj-$(CONFIG_REISERFS_FS) += reiserfs/
> obj-$(CONFIG_EXT3_FS) += ext3/ # Before ext2 so root fs can be ext3
> -obj-$(CONFIG_EXT4_FS) += ext4/ # Before ext2 so root fs can be ext4
> +obj-$(CONFIG_EXT2_FS) += ext2/
> +# We place ext4 after ext2 so plain ext2 root fs's are mounted using ext4
> +# unless explicitly requested by rootfstype

Shouldn't that be "aren't mounted using ext4..." ?

-Eric

> +obj-$(CONFIG_EXT4_FS) += ext4/
> obj-$(CONFIG_JBD) += jbd/
> obj-$(CONFIG_JBD2) += jbd2/
> -obj-$(CONFIG_EXT2_FS) += ext2/
> obj-$(CONFIG_CRAMFS) += cramfs/
> obj-$(CONFIG_SQUASHFS) += squashfs/
> obj-y += ramfs/