On 1/9/24 13:45, Kevin Locke wrote:
On Tue, 2024-01-09 at 13:39 -0800, Bart Van Assche wrote:
(cd /sys/class/scsi_host && grep -aH . */state)
(cd /sys/class/scsi_device && grep -aH . */device/{device_{blocked,busy},state})
Sure thing. Running the above commands produced the following output:
host0/state:running
host1/state:running
host2/state:running
host3/state:running
host4/state:running
host5/state:running
0:0:0:0/device/device_blocked:0
0:0:0:0/device/device_busy:1
0:0:0:0/device/state:running
So the SCSI host state (host1) is fine but the information about the SCSI
devices associated with host1 is missing, most likely because sysfs
information of SCSI devices is removed before a SYNCHRONIZE CACHE command
is submitted. The device_del(dev) call in __scsi_remove_device() happens
after scsi_device_set_state(sdev, SDEV_CANCEL) so the SCSI device should
be in the SDEV_CANCEL state. scsi_device_state_check() should translate
SDEV_CANCEL into BLK_STS_OFFLINE.
There are several tests in the blktests suite that trigger SCSI device
deletion, e.g. block/001. All blktests tests pass on my test setup.
Additionally, I haven't seen any blktests failure reports recently that
are related to device deletion. If I try to delete an ATA device in a VM,
that works fine (kernel v6.7):
# dmesg -c >/dev/null
# echo 1 > /sys/class/scsi_device/3:0:0:0/device/delete
# dmesg -c
[ 215.533228] sd 3:0:0:0: [sdb] Synchronizing SCSI cache
[ 215.543932] ata3.00: Entering standby power mode
Running rescan-scsi-bus.sh -a brings this device back.
I'm not sure what I'm missing but I think that it's something ATA-specific.
Since I'm not an ATA expert, I hope that an ATA expert can help. There are
at least two ATA experts on the Cc-list of this email.
Thanks,
Bart.