public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* 2.6.3 BUG - can't write DVD-RAM - reported as write-protected
@ 2004-03-04 21:15 Olaf Frączyk
  2004-03-05  8:23 ` Jens Axboe
  0 siblings, 1 reply; 16+ messages in thread
From: Olaf Frączyk @ 2004-03-04 21:15 UTC (permalink / raw)
  To: linux-kernel

Hi,
I switched to 2.6.3 from 2.4.x serie.
When I mount DVD-RAM it is mounted read-only:

[root@venus olaf]# mount /dev/dvdram /mnt/dvdram
mount: block device /dev/dvdram is write-protected, mounting read-only
[root@venus olaf]#

In 2.4 it is mounted correctly as read-write.

Drive: Panasonic LF-201, reported in Linux as:
MATSHITA        DVD-RAM LF-D200         A120

SCSI controller: Adaptec 2940U2W

Please CC me.

Regards,

Olaf Fraczyk


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

* Re: 2.6.3 BUG - can't write DVD-RAM - reported as write-protected
  2004-03-04 21:15 2.6.3 BUG - can't write DVD-RAM - reported as write-protected Olaf Frączyk
@ 2004-03-05  8:23 ` Jens Axboe
  2004-03-05 11:45   ` Olaf Frączyk
  0 siblings, 1 reply; 16+ messages in thread
From: Jens Axboe @ 2004-03-05  8:23 UTC (permalink / raw)
  To: Olaf Fr?czyk; +Cc: linux-kernel

On Thu, Mar 04 2004, Olaf Fr?czyk wrote:
> Hi,
> I switched to 2.6.3 from 2.4.x serie.
> When I mount DVD-RAM it is mounted read-only:
> 
> [root@venus olaf]# mount /dev/dvdram /mnt/dvdram
> mount: block device /dev/dvdram is write-protected, mounting read-only
> [root@venus olaf]#
> 
> In 2.4 it is mounted correctly as read-write.
> 
> Drive: Panasonic LF-201, reported in Linux as:
> MATSHITA        DVD-RAM LF-D200         A120
> 
> SCSI controller: Adaptec 2940U2W

What does cat /proc/sys/dev/cdrom/info say? Do you get any kernel
messages in dmesg when the rw mount fails?

-- 
Jens Axboe


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

* Re: 2.6.3 BUG - can't write DVD-RAM - reported as write-protected
  2004-03-05  8:23 ` Jens Axboe
@ 2004-03-05 11:45   ` Olaf Frączyk
  2004-03-05 20:51     ` Daniel Egger
  2004-03-07 10:59     ` Jens Axboe
  0 siblings, 2 replies; 16+ messages in thread
From: Olaf Frączyk @ 2004-03-05 11:45 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-kernel

On Fri, 2004-03-05 at 09:23, Jens Axboe wrote:
> On Thu, Mar 04 2004, Olaf Fr?czyk wrote:
> > Hi,
> > I switched to 2.6.3 from 2.4.x serie.
> > When I mount DVD-RAM it is mounted read-only:
> > 
> > [root@venus olaf]# mount /dev/dvdram /mnt/dvdram
> > mount: block device /dev/dvdram is write-protected, mounting read-only
> > [root@venus olaf]#
> > 
> > In 2.4 it is mounted correctly as read-write.
> > 
> > Drive: Panasonic LF-201, reported in Linux as:
> > MATSHITA        DVD-RAM LF-D200         A120
> > 
> > SCSI controller: Adaptec 2940U2W
> 
> What does cat /proc/sys/dev/cdrom/info say? Do you get any kernel
> messages in dmesg when the rw mount fails?

I get nothing in /var/log/dmesg and in /var/log/messages
In /proc/sys/dev/cdrom/info I get:
[olaf@venus olaf]$ cat /proc/sys/dev/cdrom/info
CD-ROM information, Id: cdrom.c 3.20 2003/12/17
 
drive name:             sr1     sr0     hdc
drive speed:            0       16      44
drive # of slots:       1       1       1
Can close tray:         1       1       1
Can open tray:          1       1       1
Can lock tray:          1       1       1
Can change speed:       1       1       1
Can select disk:        0       0       0
Can read multisession:  1       1       1
Can read MCN:           1       1       1
Reports media changed:  1       1       1
Can play audio:         1       1       1
Can write CD-R:         0       1       1
Can write CD-RW:        0       1       1
Can read DVD:           1       0       0
Can write DVD-R:        0       0       0
Can write DVD-RAM:      1       0       0
Can read MRW:           0       0       1
Can write MRW:          0       0       1

The one I'm mounting is /dev/scd1.
As there is capablity to write-protect DVD-RAM disk (like a 1.44"
Floppy), I think that the linux kernel interprets some message from
device in wrong way.

Regards,

Olaf



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

* Re: 2.6.3 BUG - can't write DVD-RAM - reported as write-protected
  2004-03-05 11:45   ` Olaf Frączyk
@ 2004-03-05 20:51     ` Daniel Egger
  2004-03-07 10:59     ` Jens Axboe
  1 sibling, 0 replies; 16+ messages in thread
From: Daniel Egger @ 2004-03-05 20:51 UTC (permalink / raw)
  To: Olaf Frączyk; +Cc: Jens Axboe, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 812 bytes --]

On Mar 5, 2004, at 12:45 pm, Olaf Frączyk wrote:

CD-ROM information, Id: cdrom.c 3.20 2003/12/17

drive name:             hdc
drive speed:            63
drive # of slots:       1
Can close tray:         1
Can open tray:          1
Can lock tray:          1
Can change speed:       1
Can select disk:        0
Can read multisession:  1
Can read MCN:           1
Reports media changed:  1
Can play audio:         1
Can write CD-R:         1
Can write CD-RW:        1
Can read DVD:           1
Can write DVD-R:        1
Can write DVD-RAM:      1
Can read MRW:           0
Can write MRW:          0

DVD-RAM mounting works for me.

However shouldn't this table also contain DVD-RW, DVD+R and DVD+RW?

This is a LG 4040B which is capable of this formats also.

Servus,
       Daniel

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 478 bytes --]

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

* Re: 2.6.3 BUG - can't write DVD-RAM - reported as write-protected
  2004-03-05 11:45   ` Olaf Frączyk
  2004-03-05 20:51     ` Daniel Egger
@ 2004-03-07 10:59     ` Jens Axboe
  2004-03-09  7:59       ` Olaf Frączyk
  1 sibling, 1 reply; 16+ messages in thread
From: Jens Axboe @ 2004-03-07 10:59 UTC (permalink / raw)
  To: Olaf Fr?czyk; +Cc: linux-kernel

On Fri, Mar 05 2004, Olaf Fr?czyk wrote:
> On Fri, 2004-03-05 at 09:23, Jens Axboe wrote:
> > On Thu, Mar 04 2004, Olaf Fr?czyk wrote:
> > > Hi,
> > > I switched to 2.6.3 from 2.4.x serie.
> > > When I mount DVD-RAM it is mounted read-only:
> > > 
> > > [root@venus olaf]# mount /dev/dvdram /mnt/dvdram
> > > mount: block device /dev/dvdram is write-protected, mounting read-only
> > > [root@venus olaf]#
> > > 
> > > In 2.4 it is mounted correctly as read-write.
> > > 
> > > Drive: Panasonic LF-201, reported in Linux as:
> > > MATSHITA        DVD-RAM LF-D200         A120
> > > 
> > > SCSI controller: Adaptec 2940U2W
> > 
> > What does cat /proc/sys/dev/cdrom/info say? Do you get any kernel
> > messages in dmesg when the rw mount fails?
> 
> I get nothing in /var/log/dmesg and in /var/log/messages
> In /proc/sys/dev/cdrom/info I get:
> [olaf@venus olaf]$ cat /proc/sys/dev/cdrom/info
> CD-ROM information, Id: cdrom.c 3.20 2003/12/17
>  
> drive name:             sr1     sr0     hdc
> drive speed:            0       16      44
> drive # of slots:       1       1       1
> Can close tray:         1       1       1
> Can open tray:          1       1       1
> Can lock tray:          1       1       1
> Can change speed:       1       1       1
> Can select disk:        0       0       0
> Can read multisession:  1       1       1
> Can read MCN:           1       1       1
> Reports media changed:  1       1       1
> Can play audio:         1       1       1
> Can write CD-R:         0       1       1
> Can write CD-RW:        0       1       1
> Can read DVD:           1       0       0
> Can write DVD-R:        0       0       0
> Can write DVD-RAM:      1       0       0
> Can read MRW:           0       0       1
> Can write MRW:          0       0       1
> 
> The one I'm mounting is /dev/scd1.
> As there is capablity to write-protect DVD-RAM disk (like a 1.44"
> Floppy), I think that the linux kernel interprets some message from
> device in wrong way.

Please repeat with this patch applied and send back the results, thanks.

===== drivers/cdrom/cdrom.c 1.48 vs edited =====
--- 1.48/drivers/cdrom/cdrom.c	Mon Feb  9 21:58:21 2004
+++ edited/drivers/cdrom/cdrom.c	Sun Mar  7 11:58:40 2004
@@ -645,9 +645,12 @@
 {
 	disc_information di;
 
-	if (cdrom_get_disc_info(cdi, &di))
+	if (cdrom_get_disc_info(cdi, &di)) {
+		printk("cdrom: read di failed\n");
 		return 0;
+	}
 
+	printk("cdrom: erasable: %d\n", di.erasable);
 	return di.erasable;
 }
 

-- 
Jens Axboe


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

* Re: 2.6.3 BUG - can't write DVD-RAM - reported as write-protected
  2004-03-07 10:59     ` Jens Axboe
@ 2004-03-09  7:59       ` Olaf Frączyk
  2004-03-09  9:12         ` Jens Axboe
  0 siblings, 1 reply; 16+ messages in thread
From: Olaf Frączyk @ 2004-03-09  7:59 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-kernel

On Sun, 2004-03-07 at 11:59, Jens Axboe wrote:
> On Fri, Mar 05 2004, Olaf Fr?czyk wrote:
> > On Fri, 2004-03-05 at 09:23, Jens Axboe wrote:
> > > On Thu, Mar 04 2004, Olaf Fr?czyk wrote:
> > > > Hi,
> > > > I switched to 2.6.3 from 2.4.x serie.
> > > > When I mount DVD-RAM it is mounted read-only:
> > > > 
> > > > [root@venus olaf]# mount /dev/dvdram /mnt/dvdram
> > > > mount: block device /dev/dvdram is write-protected, mounting read-only
> > > > [root@venus olaf]#
> > > > 
> > > > In 2.4 it is mounted correctly as read-write.
> > > > 
> > > > Drive: Panasonic LF-201, reported in Linux as:
> > > > MATSHITA        DVD-RAM LF-D200         A120
> > > > 
> > > > SCSI controller: Adaptec 2940U2W
> > > 
> > > What does cat /proc/sys/dev/cdrom/info say? Do you get any kernel
> > > messages in dmesg when the rw mount fails?
> > 
> > I get nothing in /var/log/dmesg and in /var/log/messages
> > In /proc/sys/dev/cdrom/info I get:
> > [olaf@venus olaf]$ cat /proc/sys/dev/cdrom/info
> > CD-ROM information, Id: cdrom.c 3.20 2003/12/17
> >  
> > drive name:             sr1     sr0     hdc
> > drive speed:            0       16      44
> > drive # of slots:       1       1       1
> > Can close tray:         1       1       1
> > Can open tray:          1       1       1
> > Can lock tray:          1       1       1
> > Can change speed:       1       1       1
> > Can select disk:        0       0       0
> > Can read multisession:  1       1       1
> > Can read MCN:           1       1       1
> > Reports media changed:  1       1       1
> > Can play audio:         1       1       1
> > Can write CD-R:         0       1       1
> > Can write CD-RW:        0       1       1
> > Can read DVD:           1       0       0
> > Can write DVD-R:        0       0       0
> > Can write DVD-RAM:      1       0       0
> > Can read MRW:           0       0       1
> > Can write MRW:          0       0       1
> > 
> > The one I'm mounting is /dev/scd1.
> > As there is capablity to write-protect DVD-RAM disk (like a 1.44"
> > Floppy), I think that the linux kernel interprets some message from
> > device in wrong way.
> 
> Please repeat with this patch applied and send back the results, thanks.
> 
> ===== drivers/cdrom/cdrom.c 1.48 vs edited =====
> --- 1.48/drivers/cdrom/cdrom.c	Mon Feb  9 21:58:21 2004
> +++ edited/drivers/cdrom/cdrom.c	Sun Mar  7 11:58:40 2004
> @@ -645,9 +645,12 @@
>  {
>  	disc_information di;
>  
> -	if (cdrom_get_disc_info(cdi, &di))
> +	if (cdrom_get_disc_info(cdi, &di)) {
> +		printk("cdrom: read di failed\n");
>  		return 0;
> +	}
>  
> +	printk("cdrom: erasable: %d\n", di.erasable);
>  	return di.erasable;
>  }
>  
I get:
cdrom: read di failed

Regards,

Olaf


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

* Re: 2.6.3 BUG - can't write DVD-RAM - reported as write-protected
  2004-03-09  7:59       ` Olaf Frączyk
@ 2004-03-09  9:12         ` Jens Axboe
  2004-03-11  1:48           ` Thomas Duda
  2004-03-14 11:17           ` Olaf Frączyk
  0 siblings, 2 replies; 16+ messages in thread
From: Jens Axboe @ 2004-03-09  9:12 UTC (permalink / raw)
  To: Olaf Fr?czyk; +Cc: linux-kernel

On Tue, Mar 09 2004, Olaf Fr?czyk wrote:
> On Sun, 2004-03-07 at 11:59, Jens Axboe wrote:
> > On Fri, Mar 05 2004, Olaf Fr?czyk wrote:
> > > On Fri, 2004-03-05 at 09:23, Jens Axboe wrote:
> > > > On Thu, Mar 04 2004, Olaf Fr?czyk wrote:
> > > > > Hi,
> > > > > I switched to 2.6.3 from 2.4.x serie.
> > > > > When I mount DVD-RAM it is mounted read-only:
> > > > > 
> > > > > [root@venus olaf]# mount /dev/dvdram /mnt/dvdram
> > > > > mount: block device /dev/dvdram is write-protected, mounting read-only
> > > > > [root@venus olaf]#
> > > > > 
> > > > > In 2.4 it is mounted correctly as read-write.
> > > > > 
> > > > > Drive: Panasonic LF-201, reported in Linux as:
> > > > > MATSHITA        DVD-RAM LF-D200         A120
> > > > > 
> > > > > SCSI controller: Adaptec 2940U2W
> > > > 
> > > > What does cat /proc/sys/dev/cdrom/info say? Do you get any kernel
> > > > messages in dmesg when the rw mount fails?
> > > 
> > > I get nothing in /var/log/dmesg and in /var/log/messages
> > > In /proc/sys/dev/cdrom/info I get:
> > > [olaf@venus olaf]$ cat /proc/sys/dev/cdrom/info
> > > CD-ROM information, Id: cdrom.c 3.20 2003/12/17
> > >  
> > > drive name:             sr1     sr0     hdc
> > > drive speed:            0       16      44
> > > drive # of slots:       1       1       1
> > > Can close tray:         1       1       1
> > > Can open tray:          1       1       1
> > > Can lock tray:          1       1       1
> > > Can change speed:       1       1       1
> > > Can select disk:        0       0       0
> > > Can read multisession:  1       1       1
> > > Can read MCN:           1       1       1
> > > Reports media changed:  1       1       1
> > > Can play audio:         1       1       1
> > > Can write CD-R:         0       1       1
> > > Can write CD-RW:        0       1       1
> > > Can read DVD:           1       0       0
> > > Can write DVD-R:        0       0       0
> > > Can write DVD-RAM:      1       0       0
> > > Can read MRW:           0       0       1
> > > Can write MRW:          0       0       1
> > > 
> > > The one I'm mounting is /dev/scd1.
> > > As there is capablity to write-protect DVD-RAM disk (like a 1.44"
> > > Floppy), I think that the linux kernel interprets some message from
> > > device in wrong way.
> > 
> > Please repeat with this patch applied and send back the results, thanks.
> > 
> > ===== drivers/cdrom/cdrom.c 1.48 vs edited =====
> > --- 1.48/drivers/cdrom/cdrom.c	Mon Feb  9 21:58:21 2004
> > +++ edited/drivers/cdrom/cdrom.c	Sun Mar  7 11:58:40 2004
> > @@ -645,9 +645,12 @@
> >  {
> >  	disc_information di;
> >  
> > -	if (cdrom_get_disc_info(cdi, &di))
> > +	if (cdrom_get_disc_info(cdi, &di)) {
> > +		printk("cdrom: read di failed\n");
> >  		return 0;
> > +	}
> >  
> > +	printk("cdrom: erasable: %d\n", di.erasable);
> >  	return di.erasable;
> >  }
> >  
> I get:
> cdrom: read di failed

Can you try to instrument drivers/cdrom/cdrom.c:cdrom_get_disc_info()
and find out where it fails? Change the cgc.quiet = 1 to a = 0 in there
as well (that alone might be enough to pin point the problem).

-- 
Jens Axboe


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

* Re: 2.6.3 BUG - can't write DVD-RAM - reported as write-protected
  2004-03-09  9:12         ` Jens Axboe
@ 2004-03-11  1:48           ` Thomas Duda
  2004-03-12 20:03             ` News on: " Thomas Duda
  2004-03-14 11:17           ` Olaf Frączyk
  1 sibling, 1 reply; 16+ messages in thread
From: Thomas Duda @ 2004-03-11  1:48 UTC (permalink / raw)
  To: axboe; +Cc: olaf, linux-kernel, degger

Hi,

to me this seems to be a problem with dvdram drives connected to a scsi
hba.
I've got exactly the same software setup based on 2.6.2 on 3 systems
with
a dvdram drive. One is a Panasonic LFD-201 (SCSI), another one is a
Panasonic
LFD-521 (IDE), the third is an LG-4020B (IDE).

The SCSI LFD-201 is connected to an Adaptec 7890. There is no way I can
use it to write data. A mount always happens read-only. Even though "Can
write DVD-RAM" is reported in /proc/sys/dev/cdrom/info.

Another phenomen: mkfs.ext2 /dev/scd0 runs as usual. No errors or any
other messages. The drive led lightens up. However - the dvdram doesn't
have
an ext2 fs afterwards. If I do a tune2fs -c 0 -t 0 /dev/scd0 it tells me
"bad superblock".

The 2 IDE dvdram drives in the other machines perform the task as
expected.

If I take the dvdram out of the scsi drive into the ide drives, format
it with mkfs.ext2, put it back into the scsi drive, then I see an ext2
fs
on it.

Just for clarification: They all workfine with all their speced out
capabilities
with plain Suse 9.0 out-of-the-box! (off-course with ide-scsi, kernel
2.4.21-192)

To me this looks like a problem in 2.6.2/3 with scsi connected dvdram
drives only..?
So may be the problem lies not in the cdrom stuff but in interfacing
that to the 
scsi layer..?

As a remark: I noticed that /proc/sys/dev/cdrom/info doesn't report
anything
related to dvd-rw nor dvd+rw write capabilites for the ide based LG
GSA-4040B
or the Panasonic LFD-521E (dvd-rw only!). Is this intentional?

regs

td


Jens Axboe schrieb:
> 
> On Tue, Mar 09 2004, Olaf Fr?czyk wrote:
> > On Sun, 2004-03-07 at 11:59, Jens Axboe wrote:
> > > On Fri, Mar 05 2004, Olaf Fr?czyk wrote:
> > > > On Fri, 2004-03-05 at 09:23, Jens Axboe wrote:
> > > > > On Thu, Mar 04 2004, Olaf Fr?czyk wrote:
> > > > > > Hi,
> > > > > > I switched to 2.6.3 from 2.4.x serie.
> > > > > > When I mount DVD-RAM it is mounted read-only:
> > > > > >
> > > > > > [root@venus olaf]# mount /dev/dvdram /mnt/dvdram
> > > > > > mount: block device /dev/dvdram is write-protected, mounting read-only
> > > > > > [root@venus olaf]#
> > > > > >
> > > > > > In 2.4 it is mounted correctly as read-write.
> > > > > >
> > > > > > Drive: Panasonic LF-201, reported in Linux as:
> > > > > > MATSHITA        DVD-RAM LF-D200         A120
> > > > > >
> > > > > > SCSI controller: Adaptec 2940U2W
> > > > >
> > > > > What does cat /proc/sys/dev/cdrom/info say? Do you get any kernel
> > > > > messages in dmesg when the rw mount fails?
> > > >
> > > > I get nothing in /var/log/dmesg and in /var/log/messages
> > > > In /proc/sys/dev/cdrom/info I get:
> > > > [olaf@venus olaf]$ cat /proc/sys/dev/cdrom/info
> > > > CD-ROM information, Id: cdrom.c 3.20 2003/12/17
> > > >
> > > > drive name:             sr1     sr0     hdc
> > > > drive speed:            0       16      44
> > > > drive # of slots:       1       1       1
> > > > Can close tray:         1       1       1
> > > > Can open tray:          1       1       1
> > > > Can lock tray:          1       1       1
> > > > Can change speed:       1       1       1
> > > > Can select disk:        0       0       0
> > > > Can read multisession:  1       1       1
> > > > Can read MCN:           1       1       1
> > > > Reports media changed:  1       1       1
> > > > Can play audio:         1       1       1
> > > > Can write CD-R:         0       1       1
> > > > Can write CD-RW:        0       1       1
> > > > Can read DVD:           1       0       0
> > > > Can write DVD-R:        0       0       0
> > > > Can write DVD-RAM:      1       0       0
> > > > Can read MRW:           0       0       1
> > > > Can write MRW:          0       0       1
> > > >
> > > > The one I'm mounting is /dev/scd1.
> > > > As there is capablity to write-protect DVD-RAM disk (like a 1.44"
> > > > Floppy), I think that the linux kernel interprets some message from
> > > > device in wrong way.
> > >
> > > Please repeat with this patch applied and send back the results, thanks.
> > >
> > > ===== drivers/cdrom/cdrom.c 1.48 vs edited =====
> > > --- 1.48/drivers/cdrom/cdrom.c      Mon Feb  9 21:58:21 2004
> > > +++ edited/drivers/cdrom/cdrom.c    Sun Mar  7 11:58:40 2004
> > > @@ -645,9 +645,12 @@
> > >  {
> > >     disc_information di;
> > >
> > > -   if (cdrom_get_disc_info(cdi, &di))
> > > +   if (cdrom_get_disc_info(cdi, &di)) {
> > > +           printk("cdrom: read di failed\n");
> > >             return 0;
> > > +   }
> > >
> > > +   printk("cdrom: erasable: %d\n", di.erasable);
> > >     return di.erasable;
> > >  }
> > >
> > I get:
> > cdrom: read di failed
> 
> Can you try to instrument drivers/cdrom/cdrom.c:cdrom_get_disc_info()
> and find out where it fails? Change the cgc.quiet = 1 to a = 0 in there
> as well (that alone might be enough to pin point the problem).
> 
> --
> Jens Axboe
> 
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/


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

* News on: Re: 2.6.3 BUG - can't write DVD-RAM - reported as  write-protected
  2004-03-11  1:48           ` Thomas Duda
@ 2004-03-12 20:03             ` Thomas Duda
  0 siblings, 0 replies; 16+ messages in thread
From: Thomas Duda @ 2004-03-12 20:03 UTC (permalink / raw)
  To: linux-kernel, linux-scsi; +Cc: axboe, olaf, degger

G'day folks...

I am cross-posting this to kernel and scsi because
I think you guys should know about it.

Had some spare time and lots of equipment available,
so I got to investigate this issue a bit further.

Now, I am in shock...

It looks like Linux 2.6.x (tested 2.6.2->2.6.4) doesn't
allow writing to SCSI based DVD-RAM or CD-R anymore at all.
 
I probed several scsi hba models (onboard + isa/pci) from
Initio, Dawicontrol, Tekram and Adaptec.

No luck in writing a single bit onto media..! In every
scsi setup/combination of hardware 2.6.x mounts were
always read-only. Using IDE drives worked flawlessly.
Also checking with a scsi jaz drive seemed to work ok.

Cross checking with linux 2.4.21-192 (Suse) I didn't
encounter any trouble. No matter what scsi setup/combination
I used.

Is someone is going to look into that..? 

thx & regs

td


As a side note - who believes the new aic7xxx scsi driver
has production quality? Not me! Under load this driver seems
to have LOTS of problems (tested with various seagate/ibm/hitachi
disks in single disk configuration). 










Thomas Duda schrieb:
> 
> Hi,
> 
> to me this seems to be a problem with dvdram drives connected to a scsi
> hba.
> I've got exactly the same software setup based on 2.6.2 on 3 systems
> with
> a dvdram drive. One is a Panasonic LFD-201 (SCSI), another one is a
> Panasonic
> LFD-521 (IDE), the third is an LG-4020B (IDE).
> 
> The SCSI LFD-201 is connected to an Adaptec 7890. There is no way I can
> use it to write data. A mount always happens read-only. Even though "Can
> write DVD-RAM" is reported in /proc/sys/dev/cdrom/info.
> 
> Another phenomen: mkfs.ext2 /dev/scd0 runs as usual. No errors or any
> other messages. The drive led lightens up. However - the dvdram doesn't
> have
> an ext2 fs afterwards. If I do a tune2fs -c 0 -t 0 /dev/scd0 it tells me
> "bad superblock".
> 
> The 2 IDE dvdram drives in the other machines perform the task as
> expected.
> 
> If I take the dvdram out of the scsi drive into the ide drives, format
> it with mkfs.ext2, put it back into the scsi drive, then I see an ext2
> fs
> on it.
> 
> Just for clarification: They all workfine with all their speced out
> capabilities
> with plain Suse 9.0 out-of-the-box! (off-course with ide-scsi, kernel
> 2.4.21-192)
> 
> To me this looks like a problem in 2.6.2/3 with scsi connected dvdram
> drives only..?
> So may be the problem lies not in the cdrom stuff but in interfacing
> that to the
> scsi layer..?
> 
> As a remark: I noticed that /proc/sys/dev/cdrom/info doesn't report
> anything
> related to dvd-rw nor dvd+rw write capabilites for the ide based LG
> GSA-4040B
> or the Panasonic LFD-521E (dvd-rw only!). Is this intentional?
> 
> regs
> 
> td
> 
> Jens Axboe schrieb:
> >
> > On Tue, Mar 09 2004, Olaf Fr?czyk wrote:
> > > On Sun, 2004-03-07 at 11:59, Jens Axboe wrote:
> > > > On Fri, Mar 05 2004, Olaf Fr?czyk wrote:
> > > > > On Fri, 2004-03-05 at 09:23, Jens Axboe wrote:
> > > > > > On Thu, Mar 04 2004, Olaf Fr?czyk wrote:
> > > > > > > Hi,
> > > > > > > I switched to 2.6.3 from 2.4.x serie.
> > > > > > > When I mount DVD-RAM it is mounted read-only:
> > > > > > >
> > > > > > > [root@venus olaf]# mount /dev/dvdram /mnt/dvdram
> > > > > > > mount: block device /dev/dvdram is write-protected, mounting read-only
> > > > > > > [root@venus olaf]#
> > > > > > >
> > > > > > > In 2.4 it is mounted correctly as read-write.
> > > > > > >
> > > > > > > Drive: Panasonic LF-201, reported in Linux as:
> > > > > > > MATSHITA        DVD-RAM LF-D200         A120
> > > > > > >
> > > > > > > SCSI controller: Adaptec 2940U2W
> > > > > >
> > > > > > What does cat /proc/sys/dev/cdrom/info say? Do you get any kernel
> > > > > > messages in dmesg when the rw mount fails?
> > > > >
> > > > > I get nothing in /var/log/dmesg and in /var/log/messages
> > > > > In /proc/sys/dev/cdrom/info I get:
> > > > > [olaf@venus olaf]$ cat /proc/sys/dev/cdrom/info
> > > > > CD-ROM information, Id: cdrom.c 3.20 2003/12/17
> > > > >
> > > > > drive name:             sr1     sr0     hdc
> > > > > drive speed:            0       16      44
> > > > > drive # of slots:       1       1       1
> > > > > Can close tray:         1       1       1
> > > > > Can open tray:          1       1       1
> > > > > Can lock tray:          1       1       1
> > > > > Can change speed:       1       1       1
> > > > > Can select disk:        0       0       0
> > > > > Can read multisession:  1       1       1
> > > > > Can read MCN:           1       1       1
> > > > > Reports media changed:  1       1       1
> > > > > Can play audio:         1       1       1
> > > > > Can write CD-R:         0       1       1
> > > > > Can write CD-RW:        0       1       1
> > > > > Can read DVD:           1       0       0
> > > > > Can write DVD-R:        0       0       0
> > > > > Can write DVD-RAM:      1       0       0
> > > > > Can read MRW:           0       0       1
> > > > > Can write MRW:          0       0       1
> > > > >
> > > > > The one I'm mounting is /dev/scd1.
> > > > > As there is capablity to write-protect DVD-RAM disk (like a 1.44"
> > > > > Floppy), I think that the linux kernel interprets some message from
> > > > > device in wrong way.
> > > >
> > > > Please repeat with this patch applied and send back the results, thanks.
> > > >
> > > > ===== drivers/cdrom/cdrom.c 1.48 vs edited =====
> > > > --- 1.48/drivers/cdrom/cdrom.c      Mon Feb  9 21:58:21 2004
> > > > +++ edited/drivers/cdrom/cdrom.c    Sun Mar  7 11:58:40 2004
> > > > @@ -645,9 +645,12 @@
> > > >  {
> > > >     disc_information di;
> > > >
> > > > -   if (cdrom_get_disc_info(cdi, &di))
> > > > +   if (cdrom_get_disc_info(cdi, &di)) {
> > > > +           printk("cdrom: read di failed\n");
> > > >             return 0;
> > > > +   }
> > > >
> > > > +   printk("cdrom: erasable: %d\n", di.erasable);
> > > >     return di.erasable;
> > > >  }
> > > >
> > > I get:
> > > cdrom: read di failed
> >
> > Can you try to instrument drivers/cdrom/cdrom.c:cdrom_get_disc_info()
> > and find out where it fails? Change the cgc.quiet = 1 to a = 0 in there
> > as well (that alone might be enough to pin point the problem).
> >
> > --
> > Jens Axboe
> >
> > -
> > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> > Please read the FAQ at  http://www.tux.org/lkml/
> 
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

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

* Re: 2.6.3 BUG - can't write DVD-RAM - reported as write-protected
  2004-03-09  9:12         ` Jens Axboe
  2004-03-11  1:48           ` Thomas Duda
@ 2004-03-14 11:17           ` Olaf Frączyk
  2004-03-14 11:22             ` Jens Axboe
  1 sibling, 1 reply; 16+ messages in thread
From: Olaf Frączyk @ 2004-03-14 11:17 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-kernel

On Tue, 2004-03-09 at 10:12, Jens Axboe wrote: 
> On Tue, Mar 09 2004, Olaf Fr?czyk wrote:
> > On Sun, 2004-03-07 at 11:59, Jens Axboe wrote:
> > > On Fri, Mar 05 2004, Olaf Fr?czyk wrote:
> > > > On Fri, 2004-03-05 at 09:23, Jens Axboe wrote:
> > > > > On Thu, Mar 04 2004, Olaf Fr?czyk wrote:
> > > > > > Hi,
> > > > > > I switched to 2.6.3 from 2.4.x serie.
> > > > > > When I mount DVD-RAM it is mounted read-only:
> > > > > > 
> > > > > > [root@venus olaf]# mount /dev/dvdram /mnt/dvdram
> > > > > > mount: block device /dev/dvdram is write-protected, mounting read-only
> > > > > > [root@venus olaf]#
> > > > > > 
> > > > > > In 2.4 it is mounted correctly as read-write.
> > > > > > 
> > > > > > Drive: Panasonic LF-201, reported in Linux as:
> > > > > > MATSHITA        DVD-RAM LF-D200         A120
> > > > > > 
> > > > > > SCSI controller: Adaptec 2940U2W
> > > > > 
> > > > > What does cat /proc/sys/dev/cdrom/info say? Do you get any kernel
> > > > > messages in dmesg when the rw mount fails?
> > > > 
> > > > I get nothing in /var/log/dmesg and in /var/log/messages
> > > > In /proc/sys/dev/cdrom/info I get:
> > > > [olaf@venus olaf]$ cat /proc/sys/dev/cdrom/info
> > > > CD-ROM information, Id: cdrom.c 3.20 2003/12/17
> > > >  
> > > > drive name:             sr1     sr0     hdc
> > > > drive speed:            0       16      44
> > > > drive # of slots:       1       1       1
> > > > Can close tray:         1       1       1
> > > > Can open tray:          1       1       1
> > > > Can lock tray:          1       1       1
> > > > Can change speed:       1       1       1
> > > > Can select disk:        0       0       0
> > > > Can read multisession:  1       1       1
> > > > Can read MCN:           1       1       1
> > > > Reports media changed:  1       1       1
> > > > Can play audio:         1       1       1
> > > > Can write CD-R:         0       1       1
> > > > Can write CD-RW:        0       1       1
> > > > Can read DVD:           1       0       0
> > > > Can write DVD-R:        0       0       0
> > > > Can write DVD-RAM:      1       0       0
> > > > Can read MRW:           0       0       1
> > > > Can write MRW:          0       0       1
> > > > 
> > > > The one I'm mounting is /dev/scd1.
> > > > As there is capablity to write-protect DVD-RAM disk (like a 1.44"
> > > > Floppy), I think that the linux kernel interprets some message from
> > > > device in wrong way.
> > > 
> > > Please repeat with this patch applied and send back the results, thanks.
> > > 
> > > ===== drivers/cdrom/cdrom.c 1.48 vs edited =====
> > > -- 1.48/drivers/cdrom/cdrom.c	Mon Feb  9 21:58:21 2004
> > > +++ edited/drivers/cdrom/cdrom.c	Sun Mar  7 11:58:40 2004
> > > @@ -645,9 +645,12 @@
> > >  {
> > >  	disc_information di;
> > >  
> > > -	if (cdrom_get_disc_info(cdi, &di))
> > > +	if (cdrom_get_disc_info(cdi, &di)) {
> > > +		printk("cdrom: read di failed\n");
> > >  		return 0;
> > > +	}
> > >  
> > > +	printk("cdrom: erasable: %d\n", di.erasable);
> > >  	return di.erasable;
> > >  }
> > >  
> > I get:
> > cdrom: read di failed
> 
> Can you try to instrument drivers/cdrom/cdrom.c:cdrom_get_disc_info()
> and find out where it fails? Change the cgc.quiet = 1 to a = 0 in there
> as well (that alone might be enough to pin point the problem).
Sorry for the delay. I couldn't take tha machine down.
After setting cgc.quiet=0 I get no additional messages from kernel.
cdrom_get_disc_info returns after FIRST:
cdo->generic_packet(cdi, &cgc).

BTW, I suppose return codes are interpreted not well:
In cdrom_get_disc_info we return after first (cdo->generic_packet) if it
returns not 0. (Success?) And we return with not 0 value.
And in cdrom_media_erasable we assume that not 0 is error, not success.
So probably in cdrom_get_disc_info we should have:
        if (!(ret = cdo->generic_packet(cdi, &cgc)))
                return ret;

I tried it, but it changed nothing regarding to the problem.
It returns then after second cdo->generic_packet, but I still get: 
read di failed.

Regards,

Olaf


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

* Re: 2.6.3 BUG - can't write DVD-RAM - reported as write-protected
  2004-03-14 11:17           ` Olaf Frączyk
@ 2004-03-14 11:22             ` Jens Axboe
  2004-03-14 11:23               ` Jens Axboe
  2004-03-23 14:50               ` Olaf Frączyk
  0 siblings, 2 replies; 16+ messages in thread
From: Jens Axboe @ 2004-03-14 11:22 UTC (permalink / raw)
  To: Olaf Fr?czyk; +Cc: linux-kernel, td

On Sun, Mar 14 2004, Olaf Fr?czyk wrote:
> On Tue, 2004-03-09 at 10:12, Jens Axboe wrote: 
> > On Tue, Mar 09 2004, Olaf Fr?czyk wrote:
> > > On Sun, 2004-03-07 at 11:59, Jens Axboe wrote:
> > > > On Fri, Mar 05 2004, Olaf Fr?czyk wrote:
> > > > > On Fri, 2004-03-05 at 09:23, Jens Axboe wrote:
> > > > > > On Thu, Mar 04 2004, Olaf Fr?czyk wrote:
> > > > > > > Hi,
> > > > > > > I switched to 2.6.3 from 2.4.x serie.
> > > > > > > When I mount DVD-RAM it is mounted read-only:
> > > > > > > 
> > > > > > > [root@venus olaf]# mount /dev/dvdram /mnt/dvdram
> > > > > > > mount: block device /dev/dvdram is write-protected, mounting read-only
> > > > > > > [root@venus olaf]#
> > > > > > > 
> > > > > > > In 2.4 it is mounted correctly as read-write.
> > > > > > > 
> > > > > > > Drive: Panasonic LF-201, reported in Linux as:
> > > > > > > MATSHITA        DVD-RAM LF-D200         A120
> > > > > > > 
> > > > > > > SCSI controller: Adaptec 2940U2W
> > > > > > 
> > > > > > What does cat /proc/sys/dev/cdrom/info say? Do you get any kernel
> > > > > > messages in dmesg when the rw mount fails?
> > > > > 
> > > > > I get nothing in /var/log/dmesg and in /var/log/messages
> > > > > In /proc/sys/dev/cdrom/info I get:
> > > > > [olaf@venus olaf]$ cat /proc/sys/dev/cdrom/info
> > > > > CD-ROM information, Id: cdrom.c 3.20 2003/12/17
> > > > >  
> > > > > drive name:             sr1     sr0     hdc
> > > > > drive speed:            0       16      44
> > > > > drive # of slots:       1       1       1
> > > > > Can close tray:         1       1       1
> > > > > Can open tray:          1       1       1
> > > > > Can lock tray:          1       1       1
> > > > > Can change speed:       1       1       1
> > > > > Can select disk:        0       0       0
> > > > > Can read multisession:  1       1       1
> > > > > Can read MCN:           1       1       1
> > > > > Reports media changed:  1       1       1
> > > > > Can play audio:         1       1       1
> > > > > Can write CD-R:         0       1       1
> > > > > Can write CD-RW:        0       1       1
> > > > > Can read DVD:           1       0       0
> > > > > Can write DVD-R:        0       0       0
> > > > > Can write DVD-RAM:      1       0       0
> > > > > Can read MRW:           0       0       1
> > > > > Can write MRW:          0       0       1
> > > > > 
> > > > > The one I'm mounting is /dev/scd1.
> > > > > As there is capablity to write-protect DVD-RAM disk (like a 1.44"
> > > > > Floppy), I think that the linux kernel interprets some message from
> > > > > device in wrong way.
> > > > 
> > > > Please repeat with this patch applied and send back the results, thanks.
> > > > 
> > > > ===== drivers/cdrom/cdrom.c 1.48 vs edited =====
> > > > -- 1.48/drivers/cdrom/cdrom.c	Mon Feb  9 21:58:21 2004
> > > > +++ edited/drivers/cdrom/cdrom.c	Sun Mar  7 11:58:40 2004
> > > > @@ -645,9 +645,12 @@
> > > >  {
> > > >  	disc_information di;
> > > >  
> > > > -	if (cdrom_get_disc_info(cdi, &di))
> > > > +	if (cdrom_get_disc_info(cdi, &di)) {
> > > > +		printk("cdrom: read di failed\n");
> > > >  		return 0;
> > > > +	}
> > > >  
> > > > +	printk("cdrom: erasable: %d\n", di.erasable);
> > > >  	return di.erasable;
> > > >  }
> > > >  
> > > I get:
> > > cdrom: read di failed
> > 
> > Can you try to instrument drivers/cdrom/cdrom.c:cdrom_get_disc_info()
> > and find out where it fails? Change the cgc.quiet = 1 to a = 0 in there
> > as well (that alone might be enough to pin point the problem).
> Sorry for the delay. I couldn't take tha machine down.
> After setting cgc.quiet=0 I get no additional messages from kernel.
> cdrom_get_disc_info returns after FIRST:
> cdo->generic_packet(cdi, &cgc).

Ok, at least that's a little clue... Maybe your drive is buggy (I think
we already established that, question is what the bug is) and doesn't
like to return just two bytes, please try with attached patch.

> BTW, I suppose return codes are interpreted not well:
> In cdrom_get_disc_info we return after first (cdo->generic_packet) if it
> returns not 0. (Success?) And we return with not 0 value.
> And in cdrom_media_erasable we assume that not 0 is error, not success.
> So probably in cdrom_get_disc_info we should have:
>         if (!(ret = cdo->generic_packet(cdi, &cgc)))
>                 return ret;

No, you are not reading the code correctly. ->generic_packet() returns 0
on success, or the error (standard kernel practice).
cdrom_media_erasable() returns a bool, and if cdrom_get_disc_info()
fails then we return it's not erasable.

> I tried it, but it changed nothing regarding to the problem.
> It returns then after second cdo->generic_packet, but I still get: 
> read di failed.

You broke it, the first check simply returns the header so .erasable
must be 0 because we cleared the buffer first.

===== drivers/cdrom/cdrom.c 1.49 vs edited =====
--- 1.49/drivers/cdrom/cdrom.c	Thu Mar 11 13:31:15 2004
+++ edited/drivers/cdrom/cdrom.c	Sun Mar 14 12:21:44 2004
@@ -2658,11 +2658,13 @@
 	/* set up command and get the disc info */
 	init_cdrom_command(&cgc, di, sizeof(*di), CGC_DATA_READ);
 	cgc.cmd[0] = GPCMD_READ_DISC_INFO;
-	cgc.cmd[8] = cgc.buflen = 2;
-	cgc.quiet = 1;
+	cgc.cmd[8] = cgc.buflen = 8;
+	cgc.quiet = 0;
 
-	if ((ret = cdo->generic_packet(cdi, &cgc)))
+	if ((ret = cdo->generic_packet(cdi, &cgc))) {
+		printk("cdrom: read_di failed, %d\n", ret);
 		return ret;
+	}
 
 	/* not all drives have the same disc_info length, so requeue
 	 * packet with the length the drive tells us it can supply
@@ -2673,6 +2675,7 @@
 	if (cgc.buflen > sizeof(disc_information))
 		cgc.buflen = sizeof(disc_information);
 
+	printk("cdrom: re-reading di, len=%d\n", cgc.buflen);
 	cgc.cmd[8] = cgc.buflen;
 	return cdo->generic_packet(cdi, &cgc);
 }

-- 
Jens Axboe


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

* Re: 2.6.3 BUG - can't write DVD-RAM - reported as write-protected
  2004-03-14 11:22             ` Jens Axboe
@ 2004-03-14 11:23               ` Jens Axboe
  2004-03-23 14:50               ` Olaf Frączyk
  1 sibling, 0 replies; 16+ messages in thread
From: Jens Axboe @ 2004-03-14 11:23 UTC (permalink / raw)
  To: Olaf Fr?czyk; +Cc: linux-kernel, td


BTW, both of you please use 2.6.4 as the base, not 2.6.3. The latter has
some other scsi problems that could affect this.

On Sun, Mar 14 2004, Jens Axboe wrote:
> On Sun, Mar 14 2004, Olaf Fr?czyk wrote:
> > On Tue, 2004-03-09 at 10:12, Jens Axboe wrote: 
> > > On Tue, Mar 09 2004, Olaf Fr?czyk wrote:
> > > > On Sun, 2004-03-07 at 11:59, Jens Axboe wrote:
> > > > > On Fri, Mar 05 2004, Olaf Fr?czyk wrote:
> > > > > > On Fri, 2004-03-05 at 09:23, Jens Axboe wrote:
> > > > > > > On Thu, Mar 04 2004, Olaf Fr?czyk wrote:
> > > > > > > > Hi,
> > > > > > > > I switched to 2.6.3 from 2.4.x serie.
> > > > > > > > When I mount DVD-RAM it is mounted read-only:
> > > > > > > > 
> > > > > > > > [root@venus olaf]# mount /dev/dvdram /mnt/dvdram
> > > > > > > > mount: block device /dev/dvdram is write-protected, mounting read-only
> > > > > > > > [root@venus olaf]#
> > > > > > > > 
> > > > > > > > In 2.4 it is mounted correctly as read-write.
> > > > > > > > 
> > > > > > > > Drive: Panasonic LF-201, reported in Linux as:
> > > > > > > > MATSHITA        DVD-RAM LF-D200         A120
> > > > > > > > 
> > > > > > > > SCSI controller: Adaptec 2940U2W
> > > > > > > 
> > > > > > > What does cat /proc/sys/dev/cdrom/info say? Do you get any kernel
> > > > > > > messages in dmesg when the rw mount fails?
> > > > > > 
> > > > > > I get nothing in /var/log/dmesg and in /var/log/messages
> > > > > > In /proc/sys/dev/cdrom/info I get:
> > > > > > [olaf@venus olaf]$ cat /proc/sys/dev/cdrom/info
> > > > > > CD-ROM information, Id: cdrom.c 3.20 2003/12/17
> > > > > >  
> > > > > > drive name:             sr1     sr0     hdc
> > > > > > drive speed:            0       16      44
> > > > > > drive # of slots:       1       1       1
> > > > > > Can close tray:         1       1       1
> > > > > > Can open tray:          1       1       1
> > > > > > Can lock tray:          1       1       1
> > > > > > Can change speed:       1       1       1
> > > > > > Can select disk:        0       0       0
> > > > > > Can read multisession:  1       1       1
> > > > > > Can read MCN:           1       1       1
> > > > > > Reports media changed:  1       1       1
> > > > > > Can play audio:         1       1       1
> > > > > > Can write CD-R:         0       1       1
> > > > > > Can write CD-RW:        0       1       1
> > > > > > Can read DVD:           1       0       0
> > > > > > Can write DVD-R:        0       0       0
> > > > > > Can write DVD-RAM:      1       0       0
> > > > > > Can read MRW:           0       0       1
> > > > > > Can write MRW:          0       0       1
> > > > > > 
> > > > > > The one I'm mounting is /dev/scd1.
> > > > > > As there is capablity to write-protect DVD-RAM disk (like a 1.44"
> > > > > > Floppy), I think that the linux kernel interprets some message from
> > > > > > device in wrong way.
> > > > > 
> > > > > Please repeat with this patch applied and send back the results, thanks.
> > > > > 
> > > > > ===== drivers/cdrom/cdrom.c 1.48 vs edited =====
> > > > > -- 1.48/drivers/cdrom/cdrom.c	Mon Feb  9 21:58:21 2004
> > > > > +++ edited/drivers/cdrom/cdrom.c	Sun Mar  7 11:58:40 2004
> > > > > @@ -645,9 +645,12 @@
> > > > >  {
> > > > >  	disc_information di;
> > > > >  
> > > > > -	if (cdrom_get_disc_info(cdi, &di))
> > > > > +	if (cdrom_get_disc_info(cdi, &di)) {
> > > > > +		printk("cdrom: read di failed\n");
> > > > >  		return 0;
> > > > > +	}
> > > > >  
> > > > > +	printk("cdrom: erasable: %d\n", di.erasable);
> > > > >  	return di.erasable;
> > > > >  }
> > > > >  
> > > > I get:
> > > > cdrom: read di failed
> > > 
> > > Can you try to instrument drivers/cdrom/cdrom.c:cdrom_get_disc_info()
> > > and find out where it fails? Change the cgc.quiet = 1 to a = 0 in there
> > > as well (that alone might be enough to pin point the problem).
> > Sorry for the delay. I couldn't take tha machine down.
> > After setting cgc.quiet=0 I get no additional messages from kernel.
> > cdrom_get_disc_info returns after FIRST:
> > cdo->generic_packet(cdi, &cgc).
> 
> Ok, at least that's a little clue... Maybe your drive is buggy (I think
> we already established that, question is what the bug is) and doesn't
> like to return just two bytes, please try with attached patch.
> 
> > BTW, I suppose return codes are interpreted not well:
> > In cdrom_get_disc_info we return after first (cdo->generic_packet) if it
> > returns not 0. (Success?) And we return with not 0 value.
> > And in cdrom_media_erasable we assume that not 0 is error, not success.
> > So probably in cdrom_get_disc_info we should have:
> >         if (!(ret = cdo->generic_packet(cdi, &cgc)))
> >                 return ret;
> 
> No, you are not reading the code correctly. ->generic_packet() returns 0
> on success, or the error (standard kernel practice).
> cdrom_media_erasable() returns a bool, and if cdrom_get_disc_info()
> fails then we return it's not erasable.
> 
> > I tried it, but it changed nothing regarding to the problem.
> > It returns then after second cdo->generic_packet, but I still get: 
> > read di failed.
> 
> You broke it, the first check simply returns the header so .erasable
> must be 0 because we cleared the buffer first.
> 
> ===== drivers/cdrom/cdrom.c 1.49 vs edited =====
> --- 1.49/drivers/cdrom/cdrom.c	Thu Mar 11 13:31:15 2004
> +++ edited/drivers/cdrom/cdrom.c	Sun Mar 14 12:21:44 2004
> @@ -2658,11 +2658,13 @@
>  	/* set up command and get the disc info */
>  	init_cdrom_command(&cgc, di, sizeof(*di), CGC_DATA_READ);
>  	cgc.cmd[0] = GPCMD_READ_DISC_INFO;
> -	cgc.cmd[8] = cgc.buflen = 2;
> -	cgc.quiet = 1;
> +	cgc.cmd[8] = cgc.buflen = 8;
> +	cgc.quiet = 0;
>  
> -	if ((ret = cdo->generic_packet(cdi, &cgc)))
> +	if ((ret = cdo->generic_packet(cdi, &cgc))) {
> +		printk("cdrom: read_di failed, %d\n", ret);
>  		return ret;
> +	}
>  
>  	/* not all drives have the same disc_info length, so requeue
>  	 * packet with the length the drive tells us it can supply
> @@ -2673,6 +2675,7 @@
>  	if (cgc.buflen > sizeof(disc_information))
>  		cgc.buflen = sizeof(disc_information);
>  
> +	printk("cdrom: re-reading di, len=%d\n", cgc.buflen);
>  	cgc.cmd[8] = cgc.buflen;
>  	return cdo->generic_packet(cdi, &cgc);
>  }
> 
> -- 
> Jens Axboe
> 

-- 
Jens Axboe


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

* Re: 2.6.3 BUG - can't write DVD-RAM - reported as write-protected
  2004-03-14 11:22             ` Jens Axboe
  2004-03-14 11:23               ` Jens Axboe
@ 2004-03-23 14:50               ` Olaf Frączyk
  2004-03-23 15:23                 ` Jens Axboe
  2004-03-23 15:32                 ` Olaf Frączyk
  1 sibling, 2 replies; 16+ messages in thread
From: Olaf Frączyk @ 2004-03-23 14:50 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-kernel, td

On Sun, 2004-03-14 at 12:22, Jens Axboe wrote:
> On Sun, Mar 14 2004, Olaf Fr?czyk wrote:
> > On Tue, 2004-03-09 at 10:12, Jens Axboe wrote: 
> > > On Tue, Mar 09 2004, Olaf Fr?czyk wrote:
> > > > On Sun, 2004-03-07 at 11:59, Jens Axboe wrote:
> > > > > On Fri, Mar 05 2004, Olaf Fr?czyk wrote:
> > > > > > On Fri, 2004-03-05 at 09:23, Jens Axboe wrote:
> > > > > > > On Thu, Mar 04 2004, Olaf Fr?czyk wrote:
> > > > > > > > Hi,
> > > > > > > > I switched to 2.6.3 from 2.4.x serie.
> > > > > > > > When I mount DVD-RAM it is mounted read-only:
> > > > > > > > 
> > > > > > > > [root@venus olaf]# mount /dev/dvdram /mnt/dvdram
> > > > > > > > mount: block device /dev/dvdram is write-protected, mounting read-only
> > > > > > > > [root@venus olaf]#
> > > > > > > > 
> > > > > > > > In 2.4 it is mounted correctly as read-write.
> > > > > > > > 
> > > > > > > > Drive: Panasonic LF-201, reported in Linux as:
> > > > > > > > MATSHITA        DVD-RAM LF-D200         A120
> > > > > > > > 
> > > > > > > > SCSI controller: Adaptec 2940U2W
> > > > > > > 
> > > > > > > What does cat /proc/sys/dev/cdrom/info say? Do you get any kernel
> > > > > > > messages in dmesg when the rw mount fails?
> > > > > > 
> > > > > > I get nothing in /var/log/dmesg and in /var/log/messages
> > > > > > In /proc/sys/dev/cdrom/info I get:
> > > > > > [olaf@venus olaf]$ cat /proc/sys/dev/cdrom/info
> > > > > > CD-ROM information, Id: cdrom.c 3.20 2003/12/17
> > > > > >  
> > > > > > drive name:             sr1     sr0     hdc
> > > > > > drive speed:            0       16      44
> > > > > > drive # of slots:       1       1       1
> > > > > > Can close tray:         1       1       1
> > > > > > Can open tray:          1       1       1
> > > > > > Can lock tray:          1       1       1
> > > > > > Can change speed:       1       1       1
> > > > > > Can select disk:        0       0       0
> > > > > > Can read multisession:  1       1       1
> > > > > > Can read MCN:           1       1       1
> > > > > > Reports media changed:  1       1       1
> > > > > > Can play audio:         1       1       1
> > > > > > Can write CD-R:         0       1       1
> > > > > > Can write CD-RW:        0       1       1
> > > > > > Can read DVD:           1       0       0
> > > > > > Can write DVD-R:        0       0       0
> > > > > > Can write DVD-RAM:      1       0       0
> > > > > > Can read MRW:           0       0       1
> > > > > > Can write MRW:          0       0       1
> > > > > > 
> > > > > > The one I'm mounting is /dev/scd1.
> > > > > > As there is capablity to write-protect DVD-RAM disk (like a 1.44"
> > > > > > Floppy), I think that the linux kernel interprets some message from
> > > > > > device in wrong way.
> > > > > 
> > > > > Please repeat with this patch applied and send back the results, thanks.
> > > > > 
> > > > > ===== drivers/cdrom/cdrom.c 1.48 vs edited =====
> > > > > -- 1.48/drivers/cdrom/cdrom.c	Mon Feb  9 21:58:21 2004
> > > > > +++ edited/drivers/cdrom/cdrom.c	Sun Mar  7 11:58:40 2004
> > > > > @@ -645,9 +645,12 @@
> > > > >  {
> > > > >  	disc_information di;
> > > > >  
> > > > > -	if (cdrom_get_disc_info(cdi, &di))
> > > > > +	if (cdrom_get_disc_info(cdi, &di)) {
> > > > > +		printk("cdrom: read di failed\n");
> > > > >  		return 0;
> > > > > +	}
> > > > >  
> > > > > +	printk("cdrom: erasable: %d\n", di.erasable);
> > > > >  	return di.erasable;
> > > > >  }
> > > > >  
> > > > I get:
> > > > cdrom: read di failed
> > > 
> > > Can you try to instrument drivers/cdrom/cdrom.c:cdrom_get_disc_info()
> > > and find out where it fails? Change the cgc.quiet = 1 to a = 0 in there
> > > as well (that alone might be enough to pin point the problem).
> > Sorry for the delay. I couldn't take tha machine down.
> > After setting cgc.quiet=0 I get no additional messages from kernel.
> > cdrom_get_disc_info returns after FIRST:
> > cdo->generic_packet(cdi, &cgc).
> 
> Ok, at least that's a little clue... Maybe your drive is buggy (I think
> we already established that, question is what the bug is) and doesn't
> like to return just two bytes, please try with attached patch.
> 
> > BTW, I suppose return codes are interpreted not well:
> > In cdrom_get_disc_info we return after first (cdo->generic_packet) if it
> > returns not 0. (Success?) And we return with not 0 value.
> > And in cdrom_media_erasable we assume that not 0 is error, not success.
> > So probably in cdrom_get_disc_info we should have:
> >         if (!(ret = cdo->generic_packet(cdi, &cgc)))
> >                 return ret;
> 
> No, you are not reading the code correctly. ->generic_packet() returns 0
> on success, or the error (standard kernel practice).
> cdrom_media_erasable() returns a bool, and if cdrom_get_disc_info()
> fails then we return it's not erasable.
> 
> > I tried it, but it changed nothing regarding to the problem.
> > It returns then after second cdo->generic_packet, but I still get: 
> > read di failed.
> 
> You broke it, the first check simply returns the header so .erasable
> must be 0 because we cleared the buffer first.
> 
> ===== drivers/cdrom/cdrom.c 1.49 vs edited =====
> --- 1.49/drivers/cdrom/cdrom.c	Thu Mar 11 13:31:15 2004
> +++ edited/drivers/cdrom/cdrom.c	Sun Mar 14 12:21:44 2004
> @@ -2658,11 +2658,13 @@
>  	/* set up command and get the disc info */
>  	init_cdrom_command(&cgc, di, sizeof(*di), CGC_DATA_READ);
>  	cgc.cmd[0] = GPCMD_READ_DISC_INFO;
> -	cgc.cmd[8] = cgc.buflen = 2;
> -	cgc.quiet = 1;
> +	cgc.cmd[8] = cgc.buflen = 8;
> +	cgc.quiet = 0;
>  
> -	if ((ret = cdo->generic_packet(cdi, &cgc)))
> +	if ((ret = cdo->generic_packet(cdi, &cgc))) {
> +		printk("cdrom: read_di failed, %d\n", ret);
>  		return ret;
> +	}
>  
>  	/* not all drives have the same disc_info length, so requeue
>  	 * packet with the length the drive tells us it can supply
> @@ -2673,6 +2675,7 @@
>  	if (cgc.buflen > sizeof(disc_information))
>  		cgc.buflen = sizeof(disc_information);
>  
> +	printk("cdrom: re-reading di, len=%d\n", cgc.buflen);
>  	cgc.cmd[8] = cgc.buflen;
>  	return cdo->generic_packet(cdi, &cgc);
>  }
On 2.6.4 with your patch I get:
Mar 23 15:46:03 venus kernel: cdrom: read_di failed, -95

Regards,

Olaf


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

* Re: 2.6.3 BUG - can't write DVD-RAM - reported as write-protected
  2004-03-23 14:50               ` Olaf Frączyk
@ 2004-03-23 15:23                 ` Jens Axboe
  2004-03-23 15:36                   ` Olaf Frączyk
  2004-03-23 15:32                 ` Olaf Frączyk
  1 sibling, 1 reply; 16+ messages in thread
From: Jens Axboe @ 2004-03-23 15:23 UTC (permalink / raw)
  To: Olaf Fr?czyk; +Cc: linux-kernel, td

On Tue, Mar 23 2004, Olaf Fr?czyk wrote:
> > You broke it, the first check simply returns the header so .erasable
> > must be 0 because we cleared the buffer first.
> > 
> > ===== drivers/cdrom/cdrom.c 1.49 vs edited =====
> > --- 1.49/drivers/cdrom/cdrom.c	Thu Mar 11 13:31:15 2004
> > +++ edited/drivers/cdrom/cdrom.c	Sun Mar 14 12:21:44 2004
> > @@ -2658,11 +2658,13 @@
> >  	/* set up command and get the disc info */
> >  	init_cdrom_command(&cgc, di, sizeof(*di), CGC_DATA_READ);
> >  	cgc.cmd[0] = GPCMD_READ_DISC_INFO;
> > -	cgc.cmd[8] = cgc.buflen = 2;
> > -	cgc.quiet = 1;
> > +	cgc.cmd[8] = cgc.buflen = 8;
> > +	cgc.quiet = 0;
> >  
> > -	if ((ret = cdo->generic_packet(cdi, &cgc)))
> > +	if ((ret = cdo->generic_packet(cdi, &cgc))) {
> > +		printk("cdrom: read_di failed, %d\n", ret);
> >  		return ret;
> > +	}
> >  
> >  	/* not all drives have the same disc_info length, so requeue
> >  	 * packet with the length the drive tells us it can supply
> > @@ -2673,6 +2675,7 @@
> >  	if (cgc.buflen > sizeof(disc_information))
> >  		cgc.buflen = sizeof(disc_information);
> >  
> > +	printk("cdrom: re-reading di, len=%d\n", cgc.buflen);
> >  	cgc.cmd[8] = cgc.buflen;
> >  	return cdo->generic_packet(cdi, &cgc);
> >  }
> On 2.6.4 with your patch I get:
> Mar 23 15:46:03 venus kernel: cdrom: read_di failed, -95

Ok, so your drive doesn't support GPCMD_READ_DISC_INFO at all. Probably
the best bet is simply to allow writable open if cdrom_get_disc_info()
fails after all, even though I hate doing stuff like that.

===== drivers/cdrom/cdrom.c 1.50 vs edited =====
--- 1.50/drivers/cdrom/cdrom.c	Tue Mar 16 09:41:01 2004
+++ edited/drivers/cdrom/cdrom.c	Tue Mar 23 16:23:07 2004
@@ -725,7 +725,7 @@
 	disc_information di;
 
 	if (cdrom_get_disc_info(cdi, &di))
-		return 0;
+		return -1;
 
 	return di.erasable;
 }
@@ -735,7 +735,16 @@
  */
 static int cdrom_dvdram_open_write(struct cdrom_device_info *cdi)
 {
-	return !cdrom_media_erasable(cdi);
+	int ret = cdrom_media_erasable(cdi);
+
+	/*
+	 * allow writable open if media info read worked and media is
+	 * erasable, _or_ if it fails since not all drives support it
+	 */
+	if (!ret)
+		return 1;
+
+	return 0;
 }
 
 static int cdrom_mrw_open_write(struct cdrom_device_info *cdi)

-- 
Jens Axboe


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

* Re: 2.6.3 BUG - can't write DVD-RAM - reported as write-protected
  2004-03-23 14:50               ` Olaf Frączyk
  2004-03-23 15:23                 ` Jens Axboe
@ 2004-03-23 15:32                 ` Olaf Frączyk
  1 sibling, 0 replies; 16+ messages in thread
From: Olaf Frączyk @ 2004-03-23 15:32 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-kernel, td

On Tue, 2004-03-23 at 15:50, Olaf Frączyk wrote:
> On Sun, 2004-03-14 at 12:22, Jens Axboe wrote:
> > On Sun, Mar 14 2004, Olaf Fr?czyk wrote:
> > > On Tue, 2004-03-09 at 10:12, Jens Axboe wrote: 
> > > > On Tue, Mar 09 2004, Olaf Fr?czyk wrote:
> > > > > On Sun, 2004-03-07 at 11:59, Jens Axboe wrote:
> > > > > > On Fri, Mar 05 2004, Olaf Fr?czyk wrote:
> > > > > > > On Fri, 2004-03-05 at 09:23, Jens Axboe wrote:
> > > > > > > > On Thu, Mar 04 2004, Olaf Fr?czyk wrote:
> > > > > > > > > Hi,
> > > > > > > > > I switched to 2.6.3 from 2.4.x serie.
> > > > > > > > > When I mount DVD-RAM it is mounted read-only:
> > > > > > > > > 
> > > > > > > > > [root@venus olaf]# mount /dev/dvdram /mnt/dvdram
> > > > > > > > > mount: block device /dev/dvdram is write-protected, mounting read-only
> > > > > > > > > [root@venus olaf]#
> > > > > > > > > 
> > > > > > > > > In 2.4 it is mounted correctly as read-write.
> > > > > > > > > 
> > > > > > > > > Drive: Panasonic LF-201, reported in Linux as:
> > > > > > > > > MATSHITA        DVD-RAM LF-D200         A120
> > > > > > > > > 
> > > > > > > > > SCSI controller: Adaptec 2940U2W
> > > > > > > > 
> > > > > > > > What does cat /proc/sys/dev/cdrom/info say? Do you get any kernel
> > > > > > > > messages in dmesg when the rw mount fails?
> > > > > > > 
> > > > > > > I get nothing in /var/log/dmesg and in /var/log/messages
> > > > > > > In /proc/sys/dev/cdrom/info I get:
> > > > > > > [olaf@venus olaf]$ cat /proc/sys/dev/cdrom/info
> > > > > > > CD-ROM information, Id: cdrom.c 3.20 2003/12/17
> > > > > > >  
> > > > > > > drive name:             sr1     sr0     hdc
> > > > > > > drive speed:            0       16      44
> > > > > > > drive # of slots:       1       1       1
> > > > > > > Can close tray:         1       1       1
> > > > > > > Can open tray:          1       1       1
> > > > > > > Can lock tray:          1       1       1
> > > > > > > Can change speed:       1       1       1
> > > > > > > Can select disk:        0       0       0
> > > > > > > Can read multisession:  1       1       1
> > > > > > > Can read MCN:           1       1       1
> > > > > > > Reports media changed:  1       1       1
> > > > > > > Can play audio:         1       1       1
> > > > > > > Can write CD-R:         0       1       1
> > > > > > > Can write CD-RW:        0       1       1
> > > > > > > Can read DVD:           1       0       0
> > > > > > > Can write DVD-R:        0       0       0
> > > > > > > Can write DVD-RAM:      1       0       0
> > > > > > > Can read MRW:           0       0       1
> > > > > > > Can write MRW:          0       0       1
> > > > > > > 
> > > > > > > The one I'm mounting is /dev/scd1.
> > > > > > > As there is capablity to write-protect DVD-RAM disk (like a 1.44"
> > > > > > > Floppy), I think that the linux kernel interprets some message from
> > > > > > > device in wrong way.
> > > > > > 
> > > > > > Please repeat with this patch applied and send back the results, thanks.
> > > > > > 
> > > > > > ===== drivers/cdrom/cdrom.c 1.48 vs edited =====
> > > > > > -- 1.48/drivers/cdrom/cdrom.c	Mon Feb  9 21:58:21 2004
> > > > > > +++ edited/drivers/cdrom/cdrom.c	Sun Mar  7 11:58:40 2004
> > > > > > @@ -645,9 +645,12 @@
> > > > > >  {
> > > > > >  	disc_information di;
> > > > > >  
> > > > > > -	if (cdrom_get_disc_info(cdi, &di))
> > > > > > +	if (cdrom_get_disc_info(cdi, &di)) {
> > > > > > +		printk("cdrom: read di failed\n");
> > > > > >  		return 0;
> > > > > > +	}
> > > > > >  
> > > > > > +	printk("cdrom: erasable: %d\n", di.erasable);
> > > > > >  	return di.erasable;
> > > > > >  }
> > > > > >  
> > > > > I get:
> > > > > cdrom: read di failed
> > > > 
> > > > Can you try to instrument drivers/cdrom/cdrom.c:cdrom_get_disc_info()
> > > > and find out where it fails? Change the cgc.quiet = 1 to a = 0 in there
> > > > as well (that alone might be enough to pin point the problem).
> > > Sorry for the delay. I couldn't take tha machine down.
> > > After setting cgc.quiet=0 I get no additional messages from kernel.
> > > cdrom_get_disc_info returns after FIRST:
> > > cdo->generic_packet(cdi, &cgc).
> > 
> > Ok, at least that's a little clue... Maybe your drive is buggy (I think
> > we already established that, question is what the bug is) and doesn't
> > like to return just two bytes, please try with attached patch.
> > 
> > > BTW, I suppose return codes are interpreted not well:
> > > In cdrom_get_disc_info we return after first (cdo->generic_packet) if it
> > > returns not 0. (Success?) And we return with not 0 value.
> > > And in cdrom_media_erasable we assume that not 0 is error, not success.
> > > So probably in cdrom_get_disc_info we should have:
> > >         if (!(ret = cdo->generic_packet(cdi, &cgc)))
> > >                 return ret;
> > 
> > No, you are not reading the code correctly. ->generic_packet() returns 0
> > on success, or the error (standard kernel practice).
> > cdrom_media_erasable() returns a bool, and if cdrom_get_disc_info()
> > fails then we return it's not erasable.
> > 
> > > I tried it, but it changed nothing regarding to the problem.
> > > It returns then after second cdo->generic_packet, but I still get: 
> > > read di failed.
> > 
> > You broke it, the first check simply returns the header so .erasable
> > must be 0 because we cleared the buffer first.
> > 
> > ===== drivers/cdrom/cdrom.c 1.49 vs edited =====
> > --- 1.49/drivers/cdrom/cdrom.c	Thu Mar 11 13:31:15 2004
> > +++ edited/drivers/cdrom/cdrom.c	Sun Mar 14 12:21:44 2004
> > @@ -2658,11 +2658,13 @@
> >  	/* set up command and get the disc info */
> >  	init_cdrom_command(&cgc, di, sizeof(*di), CGC_DATA_READ);
> >  	cgc.cmd[0] = GPCMD_READ_DISC_INFO;
> > -	cgc.cmd[8] = cgc.buflen = 2;
> > -	cgc.quiet = 1;
> > +	cgc.cmd[8] = cgc.buflen = 8;
> > +	cgc.quiet = 0;
> >  
> > -	if ((ret = cdo->generic_packet(cdi, &cgc)))
> > +	if ((ret = cdo->generic_packet(cdi, &cgc))) {
> > +		printk("cdrom: read_di failed, %d\n", ret);
> >  		return ret;
> > +	}
> >  
> >  	/* not all drives have the same disc_info length, so requeue
> >  	 * packet with the length the drive tells us it can supply
> > @@ -2673,6 +2675,7 @@
> >  	if (cgc.buflen > sizeof(disc_information))
> >  		cgc.buflen = sizeof(disc_information);
> >  
> > +	printk("cdrom: re-reading di, len=%d\n", cgc.buflen);
> >  	cgc.cmd[8] = cgc.buflen;
> >  	return cdo->generic_packet(cdi, &cgc);
> >  }
> On 2.6.4 with your patch I get:
> Mar 23 15:46:03 venus kernel: cdrom: read_di failed, -95
I have found, that I can't mount CD in my Yamaha 6416S now. It worked
with 2.6.3. So we have two problems now. Should I start separate thread
or continue here?

When I try to mount CD I get in command line:
[root@venus scsi]#  mount /dev/scd0 /mnt/cdrom
/dev/scd0: Invalid argument
mount: block device /dev/scd0 is write-protected, mounting read-only
/dev/scd0: Invalid argument
mount: /dev/scd0: can't read superblock

And in /var/log/messages:
Mar 23 16:23:08 venus kernel: end_request: I/O error, dev sr0, sector 0
Mar 23 16:23:08 venus kernel: FAT: unable to read boot sector

Regards,

Olaf




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

* Re: 2.6.3 BUG - can't write DVD-RAM - reported as write-protected
  2004-03-23 15:23                 ` Jens Axboe
@ 2004-03-23 15:36                   ` Olaf Frączyk
  0 siblings, 0 replies; 16+ messages in thread
From: Olaf Frączyk @ 2004-03-23 15:36 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-kernel, td

On Tue, 2004-03-23 at 16:23, Jens Axboe wrote:
> On Tue, Mar 23 2004, Olaf Fr?czyk wrote:
> > > You broke it, the first check simply returns the header so .erasable
> > > must be 0 because we cleared the buffer first.
> > > 
> > > ===== drivers/cdrom/cdrom.c 1.49 vs edited =====
> > > --- 1.49/drivers/cdrom/cdrom.c	Thu Mar 11 13:31:15 2004
> > > +++ edited/drivers/cdrom/cdrom.c	Sun Mar 14 12:21:44 2004
> > > @@ -2658,11 +2658,13 @@
> > >  	/* set up command and get the disc info */
> > >  	init_cdrom_command(&cgc, di, sizeof(*di), CGC_DATA_READ);
> > >  	cgc.cmd[0] = GPCMD_READ_DISC_INFO;
> > > -	cgc.cmd[8] = cgc.buflen = 2;
> > > -	cgc.quiet = 1;
> > > +	cgc.cmd[8] = cgc.buflen = 8;
> > > +	cgc.quiet = 0;
> > >  
> > > -	if ((ret = cdo->generic_packet(cdi, &cgc)))
> > > +	if ((ret = cdo->generic_packet(cdi, &cgc))) {
> > > +		printk("cdrom: read_di failed, %d\n", ret);
> > >  		return ret;
> > > +	}
> > >  
> > >  	/* not all drives have the same disc_info length, so requeue
> > >  	 * packet with the length the drive tells us it can supply
> > > @@ -2673,6 +2675,7 @@
> > >  	if (cgc.buflen > sizeof(disc_information))
> > >  		cgc.buflen = sizeof(disc_information);
> > >  
> > > +	printk("cdrom: re-reading di, len=%d\n", cgc.buflen);
> > >  	cgc.cmd[8] = cgc.buflen;
> > >  	return cdo->generic_packet(cdi, &cgc);
> > >  }
> > On 2.6.4 with your patch I get:
> > Mar 23 15:46:03 venus kernel: cdrom: read_di failed, -95
> 
> Ok, so your drive doesn't support GPCMD_READ_DISC_INFO at all. Probably
> the best bet is simply to allow writable open if cdrom_get_disc_info()
> fails after all, even though I hate doing stuff like that.
> 
> ===== drivers/cdrom/cdrom.c 1.50 vs edited =====
> --- 1.50/drivers/cdrom/cdrom.c	Tue Mar 16 09:41:01 2004
> +++ edited/drivers/cdrom/cdrom.c	Tue Mar 23 16:23:07 2004
> @@ -725,7 +725,7 @@
>  	disc_information di;
>  
>  	if (cdrom_get_disc_info(cdi, &di))
> -		return 0;
> +		return -1;
>  
>  	return di.erasable;
>  }
> @@ -735,7 +735,16 @@
>   */
>  static int cdrom_dvdram_open_write(struct cdrom_device_info *cdi)
>  {
> -	return !cdrom_media_erasable(cdi);
> +	int ret = cdrom_media_erasable(cdi);
> +
> +	/*
> +	 * allow writable open if media info read worked and media is
> +	 * erasable, _or_ if it fails since not all drives support it
> +	 */
> +	if (!ret)
> +		return 1;
> +
> +	return 0;
>  }
>  
>  static int cdrom_mrw_open_write(struct cdrom_device_info *cdi)
Just to be sure. In 2.4 it was not checked?
Will your patch go in 2.6.5/2.6.6 or I'll have to patch it manually till
end of my life ? :)
Regards,

Olaf


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

end of thread, other threads:[~2004-03-23 15:31 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-04 21:15 2.6.3 BUG - can't write DVD-RAM - reported as write-protected Olaf Frączyk
2004-03-05  8:23 ` Jens Axboe
2004-03-05 11:45   ` Olaf Frączyk
2004-03-05 20:51     ` Daniel Egger
2004-03-07 10:59     ` Jens Axboe
2004-03-09  7:59       ` Olaf Frączyk
2004-03-09  9:12         ` Jens Axboe
2004-03-11  1:48           ` Thomas Duda
2004-03-12 20:03             ` News on: " Thomas Duda
2004-03-14 11:17           ` Olaf Frączyk
2004-03-14 11:22             ` Jens Axboe
2004-03-14 11:23               ` Jens Axboe
2004-03-23 14:50               ` Olaf Frączyk
2004-03-23 15:23                 ` Jens Axboe
2004-03-23 15:36                   ` Olaf Frączyk
2004-03-23 15:32                 ` Olaf Frączyk

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