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) | |||
1441 | } | 1441 | } |
1442 | } | 1442 | } |
1443 | 1443 | ||
1444 | static void eh_lock_door_done(struct request *req, int uptodate) | ||
1445 | { | ||
1446 | __blk_put_request(req->q, req); | ||
1447 | } | ||
1448 | |||
1444 | /** | 1449 | /** |
1445 | * scsi_eh_lock_door - Prevent medium removal for the specified device | 1450 | * scsi_eh_lock_door - Prevent medium removal for the specified device |
1446 | * @sdev: SCSI device to prevent medium removal | 1451 | * @sdev: SCSI device to prevent medium removal |
@@ -1463,19 +1468,28 @@ int scsi_decide_disposition(struct scsi_cmnd *scmd) | |||
1463 | */ | 1468 | */ |
1464 | static void scsi_eh_lock_door(struct scsi_device *sdev) | 1469 | static void scsi_eh_lock_door(struct scsi_device *sdev) |
1465 | { | 1470 | { |
1466 | unsigned char cmnd[MAX_COMMAND_SIZE]; | 1471 | struct request *req; |
1467 | 1472 | ||
1468 | cmnd[0] = ALLOW_MEDIUM_REMOVAL; | 1473 | req = blk_get_request(sdev->request_queue, READ, GFP_KERNEL); |
1469 | cmnd[1] = 0; | 1474 | if (!req) |
1470 | cmnd[2] = 0; | 1475 | return; |
1471 | cmnd[3] = 0; | ||
1472 | cmnd[4] = SCSI_REMOVAL_PREVENT; | ||
1473 | cmnd[5] = 0; | ||
1474 | 1476 | ||
1475 | scsi_execute_async(sdev, cmnd, 6, DMA_NONE, NULL, 0, 0, 10 * HZ, | 1477 | req->cmd[0] = ALLOW_MEDIUM_REMOVAL; |
1476 | 5, NULL, NULL, GFP_KERNEL); | 1478 | req->cmd[1] = 0; |
1477 | } | 1479 | req->cmd[2] = 0; |
1480 | req->cmd[3] = 0; | ||
1481 | req->cmd[4] = SCSI_REMOVAL_PREVENT; | ||
1482 | req->cmd[5] = 0; | ||
1478 | 1483 | ||
1484 | req->cmd_len = COMMAND_SIZE(req->cmd[0]); | ||
1485 | |||
1486 | req->cmd_type = REQ_TYPE_BLOCK_PC; | ||
1487 | req->cmd_flags |= REQ_QUIET; | ||
1488 | req->timeout = 10 * HZ; | ||
1489 | req->retries = 5; | ||
1490 | |||
1491 | blk_execute_rq_nowait(req->q, NULL, req, 1, eh_lock_door_done); | ||
1492 | } | ||
1479 | 1493 | ||
1480 | /** | 1494 | /** |
1481 | * scsi_restart_operations - restart io operations to the specified host. | 1495 | * scsi_restart_operations - restart io operations to the specified host. |