diff options
Diffstat (limited to 'drivers/scsi/scsi_error.c')
-rw-r--r-- | drivers/scsi/scsi_error.c | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index ad6a1370761e..0c2c73be1974 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c @@ -1441,6 +1441,11 @@ int scsi_decide_disposition(struct scsi_cmnd *scmd) } } +static void eh_lock_door_done(struct request *req, int uptodate) +{ + __blk_put_request(req->q, req); +} + /** * scsi_eh_lock_door - Prevent medium removal for the specified device * @sdev: SCSI device to prevent medium removal @@ -1463,19 +1468,28 @@ int scsi_decide_disposition(struct scsi_cmnd *scmd) */ static void scsi_eh_lock_door(struct scsi_device *sdev) { - unsigned char cmnd[MAX_COMMAND_SIZE]; + struct request *req; - cmnd[0] = ALLOW_MEDIUM_REMOVAL; - cmnd[1] = 0; - cmnd[2] = 0; - cmnd[3] = 0; - cmnd[4] = SCSI_REMOVAL_PREVENT; - cmnd[5] = 0; + req = blk_get_request(sdev->request_queue, READ, GFP_KERNEL); + if (!req) + return; - scsi_execute_async(sdev, cmnd, 6, DMA_NONE, NULL, 0, 0, 10 * HZ, - 5, NULL, NULL, GFP_KERNEL); -} + req->cmd[0] = ALLOW_MEDIUM_REMOVAL; + req->cmd[1] = 0; + req->cmd[2] = 0; + req->cmd[3] = 0; + req->cmd[4] = SCSI_REMOVAL_PREVENT; + req->cmd[5] = 0; + req->cmd_len = COMMAND_SIZE(req->cmd[0]); + + req->cmd_type = REQ_TYPE_BLOCK_PC; + req->cmd_flags |= REQ_QUIET; + req->timeout = 10 * HZ; + req->retries = 5; + + blk_execute_rq_nowait(req->q, NULL, req, 1, eh_lock_door_done); +} /** * scsi_restart_operations - restart io operations to the specified host. |