Patchwork ext4: register ext2 and ext3 alias after ext4

login
register
mail settings
Submitter Milton Miller
Date April 14, 2011, 3:41 p.m.
Message ID <ext4-masq@mdm.bga.com>
Download mbox | patch
Permalink /patch/91251/
State Superseded
Headers show

Comments

Milton Miller - April 14, 2011, 3:41 p.m.
The intent of CONFIG_EXT4_USE_FOR_EXT23 is to provide an alias so
that the ext4 module is sufficient even if user space calls out ext2.
However, it currently registers the alias names before registering ext4.
This means they show up first in /proc/filesystems and ext3 and ext4
formatted file systems show up in the mount list as ext4.

Register the filesystem aliases after ext4 so they show as ext4 until the
filesystems is filtered.  This will avoid users or tools configuring a
kernel with just ext2 and wondering why there system broke.  Also register
in the same order as listed in fs/Makefile.

Signed-off-by: Milton Miller <miltonm@bga.com>
---

Untested but simple code movement.  Mark will you please test?

Is it safe to initialize ext4_li_info and ext4_li_mtx after we register
the filesystem?  What keeps the init after the first call to mount
a filesystem?

I checked unregister_filesystem and it is safe when the file system
type is and is not registered.

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Mark Lord - April 15, 2011, 1:07 a.m.
On 11-04-14 11:41 AM, Milton Miller wrote:
> The intent of CONFIG_EXT4_USE_FOR_EXT23 is to provide an alias so
> that the ext4 module is sufficient even if user space calls out ext2.
> However, it currently registers the alias names before registering ext4.
> This means they show up first in /proc/filesystems and ext3 and ext4
> formatted file systems show up in the mount list as ext4.

Shouldn't that say:

  This means they show up first in /proc/filesystems, causing ext3 and
  ext4 formatted file systems to show up in the mount list as ext2.

Thanks.  Other than that, it all looks good here with ext2 and ext4
file systems.  I didn't try an ext3 filesystem, but with it being between
the other two, I expect it to also be fine.

> Register the filesystem aliases after ext4 so they show as ext4 until the
> filesystems is filtered.  This will avoid users or tools configuring a
> kernel with just ext2 and wondering why there system broke.  Also register
> in the same order as listed in fs/Makefile.
> 
> Signed-off-by: Milton Miller <miltonm@bga.com>
> ---
> 
> Untested but simple code movement.  Mark will you please test?
> 
> Is it safe to initialize ext4_li_info and ext4_li_mtx after we register
> the filesystem?  What keeps the init after the first call to mount
> a filesystem?
> 
> I checked unregister_filesystem and it is safe when the file system
> type is and is not registered.
> 
> Index: work.git/fs/ext4/super.c
> ===================================================================
> --- work.git.orig/fs/ext4/super.c	2011-04-14 09:26:43.250066794 -0500
> +++ work.git/fs/ext4/super.c	2011-04-14 09:29:53.220061521 -0500
> @@ -4898,11 +4898,11 @@ static int __init ext4_init_fs(void)
>  	err = init_inodecache();
>  	if (err)
>  		goto out1;
> -	register_as_ext2();
> -	register_as_ext3();
>  	err = register_filesystem(&ext4_fs_type);
>  	if (err)
>  		goto out;
> +	register_as_ext3();
> +	register_as_ext2();
>  
>  	ext4_li_info = NULL;
>  	mutex_init(&ext4_li_mtx);
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

Index: work.git/fs/ext4/super.c
===================================================================
--- work.git.orig/fs/ext4/super.c	2011-04-14 09:26:43.250066794 -0500
+++ work.git/fs/ext4/super.c	2011-04-14 09:29:53.220061521 -0500
@@ -4898,11 +4898,11 @@  static int __init ext4_init_fs(void)
 	err = init_inodecache();
 	if (err)
 		goto out1;
-	register_as_ext2();
-	register_as_ext3();
 	err = register_filesystem(&ext4_fs_type);
 	if (err)
 		goto out;
+	register_as_ext3();
+	register_as_ext2();
 
 	ext4_li_info = NULL;
 	mutex_init(&ext4_li_mtx);