[PATCH] ext4: Register ext[23] support only after successful ext4 registration

From: Marc Aurèle La France
Date: Wed Aug 10 2022 - 16:23:11 EST


Register ext4 as a "replacement" for ext2 and ext3 only after ext4 itself has
been successfully registered. As a side effect, this allows
unregister_as_ext[23]() to be inlined.

This change is not eligible for stable@.

Please Reply-To-All.

Thanks and have a great day.

Marc.

Signed-off-by: Marc Aurèle La France <tsi@xxxxxxxxxx>

diff -aNpRruz -X /etc/diff.excludes linux-5.17.1/fs/ext4/super.c devel-5.17.1/fs/ext4/super.c
--- linux-5.17.1/fs/ext4/super.c 2022-03-28 02:03:22.000000000 -0600
+++ devel-5.17.1/fs/ext4/super.c 2022-03-28 07:14:10.799008309 -0600
@@ -7123,16 +7123,14 @@ static int __init ext4_init_fs(void)
if (err)
goto out05;

- register_as_ext3();
- register_as_ext2();
err = register_filesystem(&ext4_fs_type);
if (err)
goto out;

+ register_as_ext3();
+ register_as_ext2();
return 0;
out:
- unregister_as_ext2();
- unregister_as_ext3();
ext4_fc_destroy_dentry_cache();
out05:
destroy_inodecache();