open write failure not predicted by blockdev getro
Subsystems (2)
Quoted 1 line
Subject: Re: [PATCH] fix cdrom mt rainier probe
Does the reverse inconsistency also interest you?
By inserting a read-only DVD disc into a USB drive, I get to see the paradoxical contradiction:
$ uname -msr Linux 2.6.8-rc1 i686 $ $ sudo blockdev --getro /dev/scd0 0 $ sudo dd of=/dev/scd0 bs=64K count=1 if=/dev/zero dd: opening `/dev/scd0': Read-only file system $
I trust you'll tell me if I can help further.
Pat LaVarre
Quoted 16 lines · Pat LaVarre
Quoted 1 line
Subject: Re: [PATCH] fix cdrom mt rainier probe
Does the reverse inconsistency also interest you?
By inserting a read-only DVD disc into a USB drive, I get to see the paradoxical contradiction:
$ uname -msr Linux 2.6.8-rc1 i686 $ $ sudo blockdev --getro /dev/scd0 0 $ sudo dd of=/dev/scd0 bs=64K count=1 if=/dev/zero dd: opening `/dev/scd0': Read-only file system $
Quoted 1 line
I trust you'll tell me if I can help further.
It does interest me, please see if you can track this problem down. I have no time myself these days.
Signature · 1 line
Jens Axboe
Quoted 10 lines
Quoted 8 lines
inserting a read-only DVD disc into a USB drive, ... the paradoxical contradiction:
...$ sudo blockdev --getro /dev/scd0 0 $ sudo dd of=/dev/scd0 bs=64K count=1 if=/dev/zero dd: opening `/dev/scd0': Read-only file system $...
does interest me, ...
Excellent, hi.
Quoted 1 line
please see if you can track this problem down.
printk tells me,
We call set_disk_ro of drivers/block/genhd.c only once per device plug in, not once per disc insert.
Logically therefore, given a mixed collection of rewritable and read-only discs, our guessing blockdev --getro 1 at plug in will prevent writes of rewritable discs, and our guessing blockdev --getro 0 at plug in will allow writes of read-only discs.
We necessarily lose both ways.
Do we care?
May we say that blockdev --setrw --setro --getro is a facility for write-protecting DVD/ CD devices, not DVD/ CD discs, and take on the job of guessing which devices don't want blanket write protection?
Or do we learn to refresh set_disk_ro once per disc insert?
We can decide in light of the drivers/scsi/sd.c precedent. I see there a comment telling me we call set_disk_ro once per disc insert:
--- http://lxr.linux.no/source/drivers/scsi/sd.c?v=2.6.5#L1109
...
* read write protect setting, if possible - called only in sd_revalidate_disk()
...
---
Pat LaVarre
P.S. Newbie, me I haven't yet found the lines of cdrom.ko code we run only once per disc insert.
The following patch ain't it, at least not yet. dmesg tells me this source line executes indefinitely often while I have a USB DVD disc (specifically an Iomega RRD disc) present. Even with PATAPI alone connected, still it ran more often than the count of discs present.
drivers/cdrom/cdrom.c +1 -0
@@ -1297,6 +1297,7 @@ int media_changed(struct cdrom_device_inreturn ret;/* changed since last call? */ if (cdi->ops->media_changed (cdi,CDSL_CURRENT )) { +printk ("PEL: could refresh set_disk_ro\n" ); cdi->mc_flags =0x3 ;/* set bit on both queues */ ret |=1 ; }