diff options
author | Alan D. Brunelle <Alan.Brunelle@hp.com> | 2008-12-09 09:52:15 -0500 |
---|---|---|
committer | Jens Axboe <jens.axboe@oracle.com> | 2008-12-12 10:04:26 -0500 |
commit | febd7a5c131433ea128b54dd5712e260c79eb3ab (patch) | |
tree | 546e8450e05fdc1bc478a3d312d23f1518ce3b21 /drivers | |
parent | 6c34bc2976b30dc8b56392c020e25bae1f363cab (diff) |
Commands needing to be retried require a complete re-initialization.
The test-unit-ready portion of this patch was causing boots to fail on
my test machine (as in http://lkml.org/lkml/2008/12/5/161). With this
patch in place, the system is booting reliably.
Mike Anderson found the same problem in the hp_hw_start_stop code,
and I applied the same solution in cdrom_read_cdda_bpc.
Signed-off-by: Alan D. Brunelle <alan.brunelle@hp.com>
Cc: Mike Anderson <andmike@linux.vnet.ibm.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/cdrom/cdrom.c | 16 | ||||
-rw-r--r-- | drivers/scsi/device_handler/scsi_dh_hp_sw.c | 12 |
2 files changed, 18 insertions, 10 deletions
diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c index d16b02423d61..7d2e91cccb13 100644 --- a/drivers/cdrom/cdrom.c +++ b/drivers/cdrom/cdrom.c | |||
@@ -2081,10 +2081,6 @@ static int cdrom_read_cdda_bpc(struct cdrom_device_info *cdi, __u8 __user *ubuf, | |||
2081 | if (!q) | 2081 | if (!q) |
2082 | return -ENXIO; | 2082 | return -ENXIO; |
2083 | 2083 | ||
2084 | rq = blk_get_request(q, READ, GFP_KERNEL); | ||
2085 | if (!rq) | ||
2086 | return -ENOMEM; | ||
2087 | |||
2088 | cdi->last_sense = 0; | 2084 | cdi->last_sense = 0; |
2089 | 2085 | ||
2090 | while (nframes) { | 2086 | while (nframes) { |
@@ -2096,9 +2092,17 @@ static int cdrom_read_cdda_bpc(struct cdrom_device_info *cdi, __u8 __user *ubuf, | |||
2096 | 2092 | ||
2097 | len = nr * CD_FRAMESIZE_RAW; | 2093 | len = nr * CD_FRAMESIZE_RAW; |
2098 | 2094 | ||
2095 | rq = blk_get_request(q, READ, GFP_KERNEL); | ||
2096 | if (!rq) { | ||
2097 | ret = -ENOMEM; | ||
2098 | break; | ||
2099 | } | ||
2100 | |||
2099 | ret = blk_rq_map_user(q, rq, NULL, ubuf, len, GFP_KERNEL); | 2101 | ret = blk_rq_map_user(q, rq, NULL, ubuf, len, GFP_KERNEL); |
2100 | if (ret) | 2102 | if (ret) { |
2103 | blk_put_request(rq); | ||
2101 | break; | 2104 | break; |
2105 | } | ||
2102 | 2106 | ||
2103 | rq->cmd[0] = GPCMD_READ_CD; | 2107 | rq->cmd[0] = GPCMD_READ_CD; |
2104 | rq->cmd[1] = 1 << 2; | 2108 | rq->cmd[1] = 1 << 2; |
@@ -2124,6 +2128,7 @@ static int cdrom_read_cdda_bpc(struct cdrom_device_info *cdi, __u8 __user *ubuf, | |||
2124 | 2128 | ||
2125 | if (blk_rq_unmap_user(bio)) | 2129 | if (blk_rq_unmap_user(bio)) |
2126 | ret = -EFAULT; | 2130 | ret = -EFAULT; |
2131 | blk_put_request(rq); | ||
2127 | 2132 | ||
2128 | if (ret) | 2133 | if (ret) |
2129 | break; | 2134 | break; |
@@ -2133,7 +2138,6 @@ static int cdrom_read_cdda_bpc(struct cdrom_device_info *cdi, __u8 __user *ubuf, | |||
2133 | ubuf += len; | 2138 | ubuf += len; |
2134 | } | 2139 | } |
2135 | 2140 | ||
2136 | blk_put_request(rq); | ||
2137 | return ret; | 2141 | return ret; |
2138 | } | 2142 | } |
2139 | 2143 | ||
diff --git a/drivers/scsi/device_handler/scsi_dh_hp_sw.c b/drivers/scsi/device_handler/scsi_dh_hp_sw.c index 9aec4ca64e56..f7da7530875e 100644 --- a/drivers/scsi/device_handler/scsi_dh_hp_sw.c +++ b/drivers/scsi/device_handler/scsi_dh_hp_sw.c | |||
@@ -107,6 +107,7 @@ static int hp_sw_tur(struct scsi_device *sdev, struct hp_sw_dh_data *h) | |||
107 | struct request *req; | 107 | struct request *req; |
108 | int ret; | 108 | int ret; |
109 | 109 | ||
110 | retry: | ||
110 | req = blk_get_request(sdev->request_queue, WRITE, GFP_NOIO); | 111 | req = blk_get_request(sdev->request_queue, WRITE, GFP_NOIO); |
111 | if (!req) | 112 | if (!req) |
112 | return SCSI_DH_RES_TEMP_UNAVAIL; | 113 | return SCSI_DH_RES_TEMP_UNAVAIL; |
@@ -121,7 +122,6 @@ static int hp_sw_tur(struct scsi_device *sdev, struct hp_sw_dh_data *h) | |||
121 | memset(req->sense, 0, SCSI_SENSE_BUFFERSIZE); | 122 | memset(req->sense, 0, SCSI_SENSE_BUFFERSIZE); |
122 | req->sense_len = 0; | 123 | req->sense_len = 0; |
123 | 124 | ||
124 | retry: | ||
125 | ret = blk_execute_rq(req->q, NULL, req, 1); | 125 | ret = blk_execute_rq(req->q, NULL, req, 1); |
126 | if (ret == -EIO) { | 126 | if (ret == -EIO) { |
127 | if (req->sense_len > 0) { | 127 | if (req->sense_len > 0) { |
@@ -136,8 +136,10 @@ retry: | |||
136 | h->path_state = HP_SW_PATH_ACTIVE; | 136 | h->path_state = HP_SW_PATH_ACTIVE; |
137 | ret = SCSI_DH_OK; | 137 | ret = SCSI_DH_OK; |
138 | } | 138 | } |
139 | if (ret == SCSI_DH_IMM_RETRY) | 139 | if (ret == SCSI_DH_IMM_RETRY) { |
140 | blk_put_request(req); | ||
140 | goto retry; | 141 | goto retry; |
142 | } | ||
141 | if (ret == SCSI_DH_DEV_OFFLINED) { | 143 | if (ret == SCSI_DH_DEV_OFFLINED) { |
142 | h->path_state = HP_SW_PATH_PASSIVE; | 144 | h->path_state = HP_SW_PATH_PASSIVE; |
143 | ret = SCSI_DH_OK; | 145 | ret = SCSI_DH_OK; |
@@ -200,6 +202,7 @@ static int hp_sw_start_stop(struct scsi_device *sdev, struct hp_sw_dh_data *h) | |||
200 | struct request *req; | 202 | struct request *req; |
201 | int ret, retry; | 203 | int ret, retry; |
202 | 204 | ||
205 | retry: | ||
203 | req = blk_get_request(sdev->request_queue, WRITE, GFP_NOIO); | 206 | req = blk_get_request(sdev->request_queue, WRITE, GFP_NOIO); |
204 | if (!req) | 207 | if (!req) |
205 | return SCSI_DH_RES_TEMP_UNAVAIL; | 208 | return SCSI_DH_RES_TEMP_UNAVAIL; |
@@ -216,7 +219,6 @@ static int hp_sw_start_stop(struct scsi_device *sdev, struct hp_sw_dh_data *h) | |||
216 | req->sense_len = 0; | 219 | req->sense_len = 0; |
217 | retry = h->retries; | 220 | retry = h->retries; |
218 | 221 | ||
219 | retry: | ||
220 | ret = blk_execute_rq(req->q, NULL, req, 1); | 222 | ret = blk_execute_rq(req->q, NULL, req, 1); |
221 | if (ret == -EIO) { | 223 | if (ret == -EIO) { |
222 | if (req->sense_len > 0) { | 224 | if (req->sense_len > 0) { |
@@ -231,8 +233,10 @@ retry: | |||
231 | ret = SCSI_DH_OK; | 233 | ret = SCSI_DH_OK; |
232 | 234 | ||
233 | if (ret == SCSI_DH_RETRY) { | 235 | if (ret == SCSI_DH_RETRY) { |
234 | if (--retry) | 236 | if (--retry) { |
237 | blk_put_request(req); | ||
235 | goto retry; | 238 | goto retry; |
239 | } | ||
236 | ret = SCSI_DH_IO; | 240 | ret = SCSI_DH_IO; |
237 | } | 241 | } |
238 | 242 | ||