public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@suse.de>
To: Olaf Fr?czyk <olaf@cbk.poznan.pl>
Cc: linux-kernel@vger.kernel.org, td@linuxgang.com
Subject: Re: 2.6.3 BUG - can't write DVD-RAM - reported as write-protected
Date: Tue, 23 Mar 2004 16:23:39 +0100	[thread overview]
Message-ID: <20040323152339.GI1481@suse.de> (raw)
In-Reply-To: <1080053402.1473.0.camel@venus.local.navi.pl>

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


  reply	other threads:[~2004-03-23 15:23 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2004-03-23 15:36                   ` Olaf Frączyk
2004-03-23 15:32                 ` Olaf Frączyk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040323152339.GI1481@suse.de \
    --to=axboe@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=olaf@cbk.poznan.pl \
    --cc=td@linuxgang.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox