diff options
author | Tejun Heo <htejun@gmail.com> | 2006-08-08 01:08:59 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2006-08-09 01:16:27 -0400 |
commit | 22aac0896b1b0b8cabaf00714c55dd12f25d5738 (patch) | |
tree | fbae079c8ca9b22103a1e11439ae8b738d756c72 /drivers | |
parent | 85455dd34219376dcc7dce94bea67058f0b7d731 (diff) |
[PATCH] libata: clear sdev->locked on door lock failure
SCSI EH locks door if sdev->locked is set. Sometimes door lock
command fails continuously (e.g. when medium is not present) and as
libata uses EH to acquire sense data, this easily creates a loop where
a failed lock door invokes EH and EH issues lock door on completion.
This patch clears sdev->locked on door lock failure to break this
loop. This problem has been spotted and diagnosed by Unicorn Chang
<uchang@tw.ibm.com>.
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/scsi/libata-scsi.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/scsi/libata-scsi.c b/drivers/scsi/libata-scsi.c index 7ced41ecde86..e92c31d698ff 100644 --- a/drivers/scsi/libata-scsi.c +++ b/drivers/scsi/libata-scsi.c | |||
@@ -2353,6 +2353,19 @@ static void atapi_qc_complete(struct ata_queued_cmd *qc) | |||
2353 | ata_gen_ata_desc_sense(qc); | 2353 | ata_gen_ata_desc_sense(qc); |
2354 | } | 2354 | } |
2355 | 2355 | ||
2356 | /* SCSI EH automatically locks door if sdev->locked is | ||
2357 | * set. Sometimes door lock request continues to | ||
2358 | * fail, for example, when no media is present. This | ||
2359 | * creates a loop - SCSI EH issues door lock which | ||
2360 | * fails and gets invoked again to acquire sense data | ||
2361 | * for the failed command. | ||
2362 | * | ||
2363 | * If door lock fails, always clear sdev->locked to | ||
2364 | * avoid this infinite loop. | ||
2365 | */ | ||
2366 | if (qc->cdb[0] == ALLOW_MEDIUM_REMOVAL) | ||
2367 | qc->dev->sdev->locked = 0; | ||
2368 | |||
2356 | qc->scsicmd->result = SAM_STAT_CHECK_CONDITION; | 2369 | qc->scsicmd->result = SAM_STAT_CHECK_CONDITION; |
2357 | qc->scsidone(cmd); | 2370 | qc->scsidone(cmd); |
2358 | ata_qc_free(qc); | 2371 | ata_qc_free(qc); |