Implement scsi_resurrect_device()
PATCH 8/9 Implement scsi_resurrect_device()
This is the main part. This patch implements a function scsi_resurrect_device() which puts a sdev in state SDEV_CANCEL back into SDEV_RUNNING.
So during scan any device in state SDEV_DEL (ie waiting to be deleted) will be put back into SDEV_RUNNING and normal scanning can continue on these devices. Of course there is a high likelyhood that the device will drop back into SDEV_DEL afterwards, but it is perfectly useable during the scan operation.
For this to work I actually had to modify the allowed state transitions, as it's now perfectly possible to move back from SDEV_DEL into SDEV_CANCEL.
Signed-off-by Hannes Reinecke <[email protected]>
--- drivers/scsi/scsi.c | 3 ++ drivers/scsi/scsi_lib.c | 2 + drivers/scsi/scsi_scan.c | 52 +++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 56 insertions(+), 1 deletions(-)
drivers/scsi/scsi.c +3 -0
@@ -950,6 +950,9 @@ struct scsi_device *scsi_device_lookup_bspin_lock_irqsave (shost->host_lock, flags); sdev =__scsi_device_lookup_by_target (starget, lun); +/* This triggers a resurrection of the sdev */ +if (sdev && sdev->sdev_state ==SDEV_DEL ) +scsi_device_set_state (sdev,SDEV_CANCEL );if (sdev &&scsi_device_get (sdev)) sdev =NULL ;spin_unlock_irqrestore (shost->host_lock, flags);
drivers/scsi/scsi_lib.c +2 -0
@@ -1945,6 +1945,7 @@ scsi_device_set_state(struct scsi_devicecase SDEV_OFFLINE :case SDEV_QUIESCE :case SDEV_BLOCK : +case SDEV_CANCEL :break ;default : goto illegal;
@@ -1990,6 +1991,7 @@ scsi_device_set_state(struct scsi_devicecase SDEV_QUIESCE :case SDEV_OFFLINE :case SDEV_BLOCK : +case SDEV_DEL :break ;default : goto illegal;
drivers/scsi/scsi_scan.c +51 -1
76 lines not on this page · raw message
Signature · 1 line
1.4.3.4