Skip to content

Commit e27fb26

Browse files
z00467499gregkh
authored andcommitted
orangefs: Fix sysfs not cleanup when dev init failed
[ Upstream commit ea60a4a ] When the dev init failed, should cleanup the sysfs, otherwise, the module will never be loaded since can not create duplicate sysfs directory: sysfs: cannot create duplicate filename '/fs/orangefs' CPU: 1 PID: 6549 Comm: insmod Tainted: G W 6.0.0+ #44 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-1.fc33 04/01/2014 Call Trace: <TASK> dump_stack_lvl+0x34/0x44 sysfs_warn_dup.cold+0x17/0x24 sysfs_create_dir_ns+0x16d/0x180 kobject_add_internal+0x156/0x3a0 kobject_init_and_add+0xcf/0x120 orangefs_sysfs_init+0x7e/0x3a0 [orangefs] orangefs_init+0xfe/0x1000 [orangefs] do_one_initcall+0x87/0x2a0 do_init_module+0xdf/0x320 load_module+0x2f98/0x3330 __do_sys_finit_module+0x113/0x1b0 do_syscall_64+0x35/0x80 entry_SYSCALL_64_after_hwframe+0x46/0xb0 kobject_add_internal failed for orangefs with -EEXIST, don't try to register things with the same name in the same directory. Fixes: 2f83ace ("orangefs: put register_chrdev immediately before register_filesystem") Signed-off-by: Zhang Xiaoxu <[email protected]> Signed-off-by: Mike Marshall <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 3e9c395 commit e27fb26

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

fs/orangefs/orangefs-mod.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ static int __init orangefs_init(void)
141141
gossip_err("%s: could not initialize device subsystem %d!\n",
142142
__func__,
143143
ret);
144-
goto cleanup_device;
144+
goto cleanup_sysfs;
145145
}
146146

147147
ret = register_filesystem(&orangefs_fs_type);
@@ -152,11 +152,11 @@ static int __init orangefs_init(void)
152152
goto out;
153153
}
154154

155-
orangefs_sysfs_exit();
156-
157-
cleanup_device:
158155
orangefs_dev_cleanup();
159156

157+
cleanup_sysfs:
158+
orangefs_sysfs_exit();
159+
160160
sysfs_init_failed:
161161
orangefs_debugfs_cleanup();
162162

0 commit comments

Comments
 (0)