Re: [Cbe-oss-dev] [regression/bisected] corrupt CD data after media change and delay

James Bottomley
2008-06-09T15:05:20Z

On Mon, 2008-06-09 at 15:54 +0200, Geert Uytterhoeven wrote:
> I managed to reproduce it on my laptop (Core 2 Duo, SATA DVD-RAM, running
> Ubuntu 8.04 for amd64), by booting Debian's 2.6.25 kernel into recovery mode.
> So the problem is not PS3-specific.
>
> Worse, I never got an updated /sys/block/sr0/size for the second CD, not even
> when mounting it ASAP (which is ca. 15-20 seconds after inserting it). It
> always stayed at the value for the first CD.
>
> Note that Debian's tar is `smart' and optimizes `tar cf /dev/null' by never
> reading the input files, so you have to e.g. pipe the resulting archive to
> `cat > /dev/null' or so.

Well, we have the taxonomy. It's something to do with the media change
trigger. Could you try getting the output of this patch and correlate
the prints with your success and failure cases?

Thanks,

James

---

diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
index 7ee86d4..2b58772 100644
--- a/drivers/scsi/sr.c
+++ b/drivers/scsi/sr.c
@@ -212,6 +212,8 @@ static int sr_media_change(struct cdrom_device_info *cdi, int slot)
if (retval || (scsi_sense_valid(sshdr) &&
/* 0x3a is medium not present */
sshdr->asc == 0x3a)) {
+ printk("+10+ the result = 0x%x, skip size update ", retval);
+ scsi_show_sense_hdr(&sshdr);
/* Media not present or unable to test, unit probably not
* ready. This usually means there is no disc in the drive.
* Mark as changed, and we will figure it out later once
@@ -232,7 +234,7 @@ static int sr_media_change(struct cdrom_device_info *cdi, int slot)
sr_cd_check(cdi);
get_sectorsize(cd);
}
-
+ printk("+11+ Return forcing update is %d\n", retval);
out:
/* Notify userspace, that media has changed. */
if (retval != cd->previous_state)