Re: [PATCH] block: fix deadlock between sd_remove & sd_release

From: Yu Kuai
Date: Thu Jul 18 2024 - 23:15:39 EST




在 2024/07/18 0:23, Bart Van Assche 写道:
On 7/17/24 3:15 AM, YangYang wrote:
These sysfs nodes are in different directories, the scsi node located
at /sys/bus/scsi/devices/0:0:0:0 and the gendisk node located at
/sys/block/sda. Would it be necessary to wait for the completion of
the scsi sysfs nodes' read/write operations before removing the
gendisk sysfs node?

No. sysfs_remove_files() waits for pending read and write operations to
complete.


So I check this and actually gendisk kobject is a child of scsi disk
kobject, not the other way. sda/device is just a symbol link.

sda/device -> ../../../14:2:0:0.

So, the sysfs api for gendisk itself doesn't issue IO, and as long as
related driver doesn't create new such api under gendisk, this won't
be a problem.

Thanks,
Kuai
Bart.

.