Re: 2.9test9-mm1 and DAO ATAPI cd-burning corrupt

From: Daniel Pittman
Date: Tue Nov 11 2003 - 19:06:40 EST


On Tue, 11 Nov 2003, Linus Torvalds wrote:
> On Tue, 11 Nov 2003, Pascal Schmidt wrote:
>>
>> dd behaves strangly on the MO drive. I've tried with 2.6.0-test9 and
>> the patch appended to the end of this mail.
>>
>> # dd if=testfile of=/dev/hde bs=4096 count=1
>> dd: writing `/dev/hde': no space left on device
>> 1+0 records in
>> 0+0 records out
>>
>> # dd if=/dev/hde of=mofile bs=4096 count=1
>> 0+0 records in
>> 0+0 records out
>>
>> Mounting the disc read-only works, however, and I can read all the
>> data on it without problems.
>
> Ok, that's just strange. You can't even _read_ from the raw device,
> but the mount works ok?
>
> And you got no IO errors anywhere? I don't see why the write would
> fail silently.
>
> I wonder whether the disk capacity is set to zero. See
> drivers/ide/ide-cd.c, and in particular the
>
> /* Now try to get the total cdrom capacity. */
> stat = cdrom_get_last_written(cdi, (long *) &toc->capacity);
> if (stat || !toc->capacity)
> stat = cdrom_read_capacity(drive, &toc->capacity,
> sense);
> if (stat)
> toc->capacity = 0x1fffff;
>
> and see what that says.. I really think you should start sprinkling
> printk's around the thing to determine what goes on..

The '|| !toc->capacity' part of that code exists because I have a DVD
drive that got zero capacity from the cdrom_get_last_written call.

The symptoms were exactly the same as above - I could mount and use the
thing correctly, but the raw device was not readable at all.

Maybe cdrom_read_capacity can also return zero for some broken
situations?

Daniel

--
The youth gets together his materials to build a bridge to the moon, or,
perchance, a palace or temple on the earth, and, at length, the middle-aged
man concludes to build a woodshed with them.
-- Henry David Thoreau
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/