diff options
author | James Bottomley <James.Bottomley@HansenPartnership.com> | 2008-06-10 11:20:53 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2008-06-10 11:31:23 -0400 |
commit | d1daeabf0da5bfa1943272ce508e2ba785730bf0 (patch) | |
tree | a013f2e673fc8631e86f2f9be433032359412433 /drivers/scsi/sr.c | |
parent | 5e70b7f3c24468bb1635b295945edb48ecd9656a (diff) |
[SCSI] sr: fix corrupt CD data after media change and delay
Reported-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
If you delay 30s or more before mounting a CD after inserting it then
the kernel has the wrong value for the CD size.
http://marc.info/?t=121276133000001
The problem is in sr_test_unit_ready(): the function eats unit
attentions without adjusting the sdev->changed status. This means
that when the CD signals changed media via unit attention, we can
ignore it. Fix by making sr_test_unit_ready() adjust the changed
status.
Tested-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Cc: Stable Tree <stable@kernel.org>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/sr.c')
-rw-r--r-- | drivers/scsi/sr.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c index 7ee86d4a761..c82df8bd4d8 100644 --- a/drivers/scsi/sr.c +++ b/drivers/scsi/sr.c | |||
@@ -178,6 +178,9 @@ int sr_test_unit_ready(struct scsi_device *sdev, struct scsi_sense_hdr *sshdr) | |||
178 | the_result = scsi_execute_req(sdev, cmd, DMA_NONE, NULL, | 178 | the_result = scsi_execute_req(sdev, cmd, DMA_NONE, NULL, |
179 | 0, sshdr, SR_TIMEOUT, | 179 | 0, sshdr, SR_TIMEOUT, |
180 | retries--); | 180 | retries--); |
181 | if (scsi_sense_valid(sshdr) && | ||
182 | sshdr->sense_key == UNIT_ATTENTION) | ||
183 | sdev->changed = 1; | ||
181 | 184 | ||
182 | } while (retries > 0 && | 185 | } while (retries > 0 && |
183 | (!scsi_status_is_good(the_result) || | 186 | (!scsi_status_is_good(the_result) || |