linux-2.6.0-test9: slave_destroy called too early
Hi,
in linux-2.6.0-test9 there seems to be a bug in scsi_remove_device: each time I try to remove a scsi disk the sd driver fails to synchronize the SCSI cache. Reason for this is that the slave_destroy function of the LLD gets called before sd_shutdown of the sd driver gets called.
I would suggest the patch below. Please apply or let me know that this is the wrong thing to do.
Thanks,
Heiko
diff -urN linux-2.6.0-test9/drivers/scsi/scsi_sysfs.c linux-2.6.0-test9-sd/drivers/scsi/scsi_sysfs.c
drivers/scsi/scsi_sysfs.c +1 -1
@@ -410,9 +410,9 @@if (class) {down_write (&class->subsys.rwsem);set_bit (SDEV_DEL , &sdev->sdev_state); +device_del (&sdev->sdev_gendev);if (sdev->host->hostt->slave_destroy) sdev->host->hostt->slave_destroy (sdev); -device_del (&sdev->sdev_gendev);up_write (&class->subsys.rwsem); }
Quoted 9 lines · Heiko Carstens [[email protected]] wrote:
Hi,
in linux-2.6.0-test9 there seems to be a bug in
scsi_remove_device: each time I try to remove a scsi disk the sd driver fails to synchronize the SCSI cache. Reason for this is that theslave_destroyfunction of the LLD gets called beforesd_shutdownof the sd driver gets called.
I would suggest the patch below. Please apply or let me know that this is the wrong thing to do.
The patch I previously posted would give the same effect. You can find it in the archives.
http://marc.theaimsgroup.com/?l=linux-scsi&m=106810957502435&w=2
I will repost the patch with a update based on the feedback I received on the previous thread (inline the scsi_free_sdev function). This updated patch will look very similiar to the sequence you have in your patch.
-andmike
--
Michael Anderson
[email protected]