aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_lib.c
diff options
context:
space:
mode:
authorMike Christie <michaelc@cs.wisc.edu>2012-05-18 00:56:56 -0400
committerJames Bottomley <JBottomley@Parallels.com>2012-07-20 03:58:21 -0400
commit1b8d26206134458044b0689f48194af00c96d406 (patch)
tree767d6fa1ed7cb5385daecac13b4fbf2fdc8267c0 /drivers/scsi/scsi_lib.c
parent87098bdd100497ceac0797c6b2f4c51eea1f1e42 (diff)
[SCSI] add new SDEV_TRANSPORT_OFFLINE state
This patch adds a new state SDEV_TRANSPORT_OFFLINE. It will be used by transport classes to offline devices for cases like when the fast_io_fail/recovery_tmo fires. In those cases we want all IO to fail, and we have not yet escalated to dev_loss_tmo behavior where we are removing the devices. Currently to handle this state, transport classes are setting the scsi_device's state to running, setting their internal session/port structs state to something that indicates failed, and then failing IO from some transport check in the queuecommand. The reason for the new value is so that users can distinguish between a device failure that is a result of a transport problem vs the wide range of errors that devices get offlined for when a scsi command times out and we offline the devices there. It also fixes the confusion as to why the transport class is failing IO, but has set the device state from blocked to running. Signed-off-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/scsi_lib.c')
-rw-r--r--drivers/scsi/scsi_lib.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 6dfb9785d345..340c569d4535 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1173,6 +1173,7 @@ int scsi_prep_state_check(struct scsi_device *sdev, struct request *req)
1173 if (unlikely(sdev->sdev_state != SDEV_RUNNING)) { 1173 if (unlikely(sdev->sdev_state != SDEV_RUNNING)) {
1174 switch (sdev->sdev_state) { 1174 switch (sdev->sdev_state) {
1175 case SDEV_OFFLINE: 1175 case SDEV_OFFLINE:
1176 case SDEV_TRANSPORT_OFFLINE:
1176 /* 1177 /*
1177 * If the device is offline we refuse to process any 1178 * If the device is offline we refuse to process any
1178 * commands. The device must be brought online 1179 * commands. The device must be brought online
@@ -2081,6 +2082,7 @@ scsi_device_set_state(struct scsi_device *sdev, enum scsi_device_state state)
2081 switch (oldstate) { 2082 switch (oldstate) {
2082 case SDEV_CREATED: 2083 case SDEV_CREATED:
2083 case SDEV_OFFLINE: 2084 case SDEV_OFFLINE:
2085 case SDEV_TRANSPORT_OFFLINE:
2084 case SDEV_QUIESCE: 2086 case SDEV_QUIESCE:
2085 case SDEV_BLOCK: 2087 case SDEV_BLOCK:
2086 break; 2088 break;
@@ -2093,6 +2095,7 @@ scsi_device_set_state(struct scsi_device *sdev, enum scsi_device_state state)
2093 switch (oldstate) { 2095 switch (oldstate) {
2094 case SDEV_RUNNING: 2096 case SDEV_RUNNING:
2095 case SDEV_OFFLINE: 2097 case SDEV_OFFLINE:
2098 case SDEV_TRANSPORT_OFFLINE:
2096 break; 2099 break;
2097 default: 2100 default:
2098 goto illegal; 2101 goto illegal;
@@ -2100,6 +2103,7 @@ scsi_device_set_state(struct scsi_device *sdev, enum scsi_device_state state)
2100 break; 2103 break;
2101 2104
2102 case SDEV_OFFLINE: 2105 case SDEV_OFFLINE:
2106 case SDEV_TRANSPORT_OFFLINE:
2103 switch (oldstate) { 2107 switch (oldstate) {
2104 case SDEV_CREATED: 2108 case SDEV_CREATED:
2105 case SDEV_RUNNING: 2109 case SDEV_RUNNING:
@@ -2136,6 +2140,7 @@ scsi_device_set_state(struct scsi_device *sdev, enum scsi_device_state state)
2136 case SDEV_RUNNING: 2140 case SDEV_RUNNING:
2137 case SDEV_QUIESCE: 2141 case SDEV_QUIESCE:
2138 case SDEV_OFFLINE: 2142 case SDEV_OFFLINE:
2143 case SDEV_TRANSPORT_OFFLINE:
2139 case SDEV_BLOCK: 2144 case SDEV_BLOCK:
2140 break; 2145 break;
2141 default: 2146 default:
@@ -2148,6 +2153,7 @@ scsi_device_set_state(struct scsi_device *sdev, enum scsi_device_state state)
2148 case SDEV_CREATED: 2153 case SDEV_CREATED:
2149 case SDEV_RUNNING: 2154 case SDEV_RUNNING:
2150 case SDEV_OFFLINE: 2155 case SDEV_OFFLINE:
2156 case SDEV_TRANSPORT_OFFLINE:
2151 case SDEV_CANCEL: 2157 case SDEV_CANCEL:
2152 break; 2158 break;
2153 default: 2159 default: