public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* open write failure not predicted by blockdev getro
@ 2004-07-13 21:38 Pat LaVarre
  2004-07-14  5:36 ` Jens Axboe
  0 siblings, 1 reply; 3+ messages in thread
From: Pat LaVarre @ 2004-07-13 21:38 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-scsi

> 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



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: open write failure not predicted by blockdev getro
  2004-07-13 21:38 open write failure not predicted by blockdev getro Pat LaVarre
@ 2004-07-14  5:36 ` Jens Axboe
  2004-07-15  0:00   ` Pat LaVarre
  0 siblings, 1 reply; 3+ messages in thread
From: Jens Axboe @ 2004-07-14  5:36 UTC (permalink / raw)
  To: Pat LaVarre; +Cc: linux-scsi

On Tue, Jul 13 2004, Pat LaVarre wrote:
> > 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.

It does interest me, please see if you can track this problem down. I
have no time myself these days.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: open write failure not predicted by blockdev getro
  2004-07-14  5:36 ` Jens Axboe
@ 2004-07-15  0:00   ` Pat LaVarre
  0 siblings, 0 replies; 3+ messages in thread
From: Pat LaVarre @ 2004-07-15  0:00 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-scsi

> > 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.

> 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.

diff -urp linux-2.6.8-rc1/drivers/cdrom/cdrom.c linux-2.6.8-rc1-pel/drivers/cdrom/cdrom.c
--- linux-2.6.8-rc1/drivers/cdrom/cdrom.c	2004-07-13 08:26:02.000000000 -0600
+++ linux-2.6.8-rc1-pel/drivers/cdrom/cdrom.c	2004-07-14 17:46:24.013859464 -0600
@@ -1297,6 +1297,7 @@ int media_changed(struct cdrom_device_in
 	    return 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;
 	}



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-07-15  0:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-13 21:38 open write failure not predicted by blockdev getro Pat LaVarre
2004-07-14  5:36 ` Jens Axboe
2004-07-15  0:00   ` Pat LaVarre

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox