Patch "zonefs: Fix race between modprobe and mount" has been added to the 6.0-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    zonefs: Fix race between modprobe and mount

to the 6.0-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     zonefs-fix-race-between-modprobe-and-mount.patch
and it can be found in the queue-6.0 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit db3322723a7af513bbf8c73d9476e48dac0034fe
Author: Zhang Xiaoxu <zhangxiaoxu5@xxxxxxxxxx>
Date:   Sun Nov 20 18:57:59 2022 +0800

    zonefs: Fix race between modprobe and mount
    
    [ Upstream commit 4e45886956a20942800259f326a04417292ae314 ]
    
    There is a race between modprobe and mount as below:
    
     modprobe zonefs                | mount -t zonefs
    --------------------------------|-------------------------
     zonefs_init                    |
      register_filesystem       [1] |
                                    | zonefs_fill_super    [2]
      zonefs_sysfs_init         [3] |
    
    1. register zonefs suceess, then
    2. user can mount the zonefs
    3. if sysfs initialize failed, the module initialize failed.
    
    Then the mount process maybe some error happened since the module
    initialize failed.
    
    Let's register zonefs after all dependency resource ready. And
    reorder the dependency resource release in module exit.
    
    Fixes: 9277a6d4fbd4 ("zonefs: Export open zone resource information through sysfs")
    Signed-off-by: Zhang Xiaoxu <zhangxiaoxu5@xxxxxxxxxx>
    Reviewed-by: Johannes Thumshirn <johannes.thumshirn@xxxxxxx>
    Reviewed-by: Chaitanya Kulkarni <kch@xxxxxxxxxx>
    Signed-off-by: Damien Le Moal <damien.lemoal@xxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/zonefs/super.c b/fs/zonefs/super.c
index 860f0b1032c6..625749fbedf4 100644
--- a/fs/zonefs/super.c
+++ b/fs/zonefs/super.c
@@ -1905,18 +1905,18 @@ static int __init zonefs_init(void)
 	if (ret)
 		return ret;
 
-	ret = register_filesystem(&zonefs_type);
+	ret = zonefs_sysfs_init();
 	if (ret)
 		goto destroy_inodecache;
 
-	ret = zonefs_sysfs_init();
+	ret = register_filesystem(&zonefs_type);
 	if (ret)
-		goto unregister_fs;
+		goto sysfs_exit;
 
 	return 0;
 
-unregister_fs:
-	unregister_filesystem(&zonefs_type);
+sysfs_exit:
+	zonefs_sysfs_exit();
 destroy_inodecache:
 	zonefs_destroy_inodecache();
 
@@ -1925,9 +1925,9 @@ static int __init zonefs_init(void)
 
 static void __exit zonefs_exit(void)
 {
+	unregister_filesystem(&zonefs_type);
 	zonefs_sysfs_exit();
 	zonefs_destroy_inodecache();
-	unregister_filesystem(&zonefs_type);
 }
 
 MODULE_AUTHOR("Damien Le Moal");



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux