Implement scsi_resurrect_device()
PATCH 9/11 Implement scsi_resurrect_device()
This patch implements a function scsi_resurrect_device() which elevates a sdev from state SDEV_CANCEL back into SDEV_RUNNING.
So during a scan any sdev in SDEV_DEL is put into SDEV_CANCEL and then scsi_resurrect_device() is called. This will put the device into SDEV_RUNNING and the scan can proceed.
To allow this the state machine has to be expanded, as no transistion out of SDEV_CANCEL into SDEV_RUNNING and from SDEV_DEL into SDEV_CANCEL are now perfectly possible.
Signed-off-by Hannes Reinecke <[email protected]>
--- drivers/scsi/scsi.c | 3 ++ drivers/scsi/scsi_lib.c | 2 + drivers/scsi/scsi_scan.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+), 0 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
@@ -1954,6 +1954,7 @@ scsi_device_set_state(struct scsi_devicecase SDEV_OFFLINE :case SDEV_QUIESCE :case SDEV_BLOCK : +case SDEV_CANCEL :break ;default : goto illegal;
@@ -1999,6 +2000,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 +53 -0
71 lines not on this page · raw message
Signature · 1 line
1.4.3.4