diff options
| author | Zheng Qixing <[email protected]> | 2025-08-08 05:36:09 +0000 |
|---|---|---|
| committer | Jens Axboe <[email protected]> | 2025-08-11 14:00:49 +0000 |
| commit | 343dc5423bfe876c12bb80c56f5e44286e442a07 (patch) | |
| tree | c0df0dc60837b4fd041c70b6a6d955df76dc7bcd /scripts/git-resolve.sh | |
| parent | blk-cgroup: remove redundant __GFP_NOWARN (diff) | |
| download | kernel-343dc5423bfe876c12bb80c56f5e44286e442a07.tar.gz kernel-343dc5423bfe876c12bb80c56f5e44286e442a07.zip | |
block: fix kobject double initialization in add_disk
Device-mapper can call add_disk() multiple times for the same gendisk
due to its two-phase creation process (dm create + dm load). This leads
to kobject double initialization errors when the underlying iSCSI devices
become temporarily unavailable and then reappear.
However, if the first add_disk() call fails and is retried, the queue_kobj
gets initialized twice, causing:
kobject: kobject (ffff88810c27bb90): tried to init an initialized object,
something is seriously wrong.
Call Trace:
<TASK>
dump_stack_lvl+0x5b/0x80
kobject_init.cold+0x43/0x51
blk_register_queue+0x46/0x280
add_disk_fwnode+0xb5/0x280
dm_setup_md_queue+0x194/0x1c0
table_load+0x297/0x2d0
ctl_ioctl+0x2a2/0x480
dm_ctl_ioctl+0xe/0x20
__x64_sys_ioctl+0xc7/0x110
do_syscall_64+0x72/0x390
entry_SYSCALL_64_after_hwframe+0x76/0x7e
Fix this by separating kobject initialization from sysfs registration:
- Initialize queue_kobj early during gendisk allocation
- add_disk() only adds the already-initialized kobject to sysfs
- del_gendisk() removes from sysfs but doesn't destroy the kobject
- Final cleanup happens when the disk is released
Fixes: 2bd85221a625 ("block: untangle request_queue refcounting from sysfs")
Reported-by: Li Lingfeng <[email protected]>
Closes: https://lore.kernel.org/all/[email protected]/
Signed-off-by: Zheng Qixing <[email protected]>
Reviewed-by: Ming Lei <[email protected]>
Reviewed-by: Yu Kuai <[email protected]>
Reviewed-by: Nilay Shroff <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jens Axboe <[email protected]>
Diffstat (limited to 'scripts/git-resolve.sh')
0 files changed, 0 insertions, 0 deletions
