Skip to contentSkip to conversation

block: ublk: move ublk_chr_class destroying after devices are removed

PATCH Applied Ming Lei 3 participants 3 messages Jan 26, 2023

Subsystems (2)
lore
Share & tools
lore

Ming Lei

author
#0 lore raw

PATCH 1/1 block: ublk: move ublk_chr_class destroying after devices are removed

The 'ublk_chr_class' is needed when deleting ublk char devices in ublk_exit(), so move it after devices(idle) are removed.

Fixes the following warning reported by Harris, James R:

[  859.178950] sysfs group 'power' not found for kobject 'ublkc0'
[  859.178962] WARNING: CPU: 3 PID: 1109 at fs/sysfs/group.c:278 sysfs_remove_group+0x9c/0xb0
Fixes 71f28f3136af ("ublk_drv: add io_uring based userspace block driver")
---
 drivers/block/ublk_drv.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/block/ublk_drv.c +3 -4
index 9f32553cb938..a725a236a38f 100644
@@ -2238,13 +2238,12 @@ static void __exit ublk_exit(void)
 	struct ublk_device *ub;
 	int id;
 
-	class_destroy(ublk_chr_class);
-
-	misc_deregister(&ublk_misc);
-
 	idr_for_each_entry(&ublk_index_idr, ub, id)
 		ublk_remove(ub);
 
+	class_destroy(ublk_chr_class);
+	misc_deregister(&ublk_misc);
+
 	idr_destroy(&ublk_index_idr);
 	unregister_chrdev_region(ublk_chr_devt, UBLK_MINORS);
 }
Signature · 1 line
2.31.1
Tested-by on v1 1/1
#1 lore raw
Quoted 44 lines · Ming Lei

The 'ublk_chr_class' is needed when deleting ublk char devices in ublk_exit(), so move it after devices(idle) are removed.

Fixes the following warning reported by Harris, James R:

[  859.178950] sysfs group 'power' not found for kobject 'ublkc0'
[  859.178962] WARNING: CPU: 3 PID: 1109 at fs/sysfs/group.c:278 sysfs_remove_group+0x9c/0xb0
Fixes 71f28f3136af ("ublk_drv: add io_uring based userspace block driver")

---
drivers/block/ublk_drv.c | 7 +++----

1 file changed, 3 insertions(+), 4 deletions(-)
drivers/block/ublk_drv.c +3 -4
index 9f32553cb938..a725a236a38f 100644
@@ -2238,13 +2238,12 @@ static void __exit ublk_exit(void)
 	struct ublk_device *ub;
 	int id;
 
-	class_destroy(ublk_chr_class);
-
-	misc_deregister(&ublk_misc);
-
 	idr_for_each_entry(&ublk_index_idr, ub, id)
 		ublk_remove(ub);
 
+	class_destroy(ublk_chr_class);
+	misc_deregister(&ublk_misc);
+
 	idr_destroy(&ublk_index_idr);
 	unregister_chrdev_region(ublk_chr_devt, UBLK_MINORS);
 }
Signature · 1 line
2.31.1

This works for me. Thanks Ming!

maintainer Applied
#2 lore raw
In reply to Ming Lei
Quoted 9 lines · Ming Lei

The 'ublk_chr_class' is needed when deleting ublk char devices in ublk_exit(), so move it after devices(idle) are removed.

Fixes the following warning reported by Harris, James R:

[  859.178950] sysfs group 'power' not found for kobject 'ublkc0'
[  859.178962] WARNING: CPU: 3 PID: 1109 at fs/sysfs/group.c:278 sysfs_remove_group+0x9c/0xb0

[...]

Applied, thanks!

[1/1] block: ublk: move ublk_chr_class destroying after devices are removed

      commit: 8e4ff684762b6503db45e8906e258faee080c336

Best regards,

Signature · 1 line
Jens Axboe