All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cdrom: MO-drive open write fix (trivial)
@ 2004-08-06 16:33 Stefan Meyknecht
  2004-08-07  5:06 ` Andrew Morton
  0 siblings, 1 reply; 10+ messages in thread
From: Stefan Meyknecht @ 2004-08-06 16:33 UTC (permalink / raw)
  To: linux-kernel; +Cc: axboe

[PATCH] cdrom: MO-drive open write fix

Allow mounting mo-drives readwrite.

Please apply.

Stefan


--- linux/drivers/cdrom/cdrom.c.orig	2004-08-06 18:04:16.269803330 +0200
+++ linux/drivers/cdrom/cdrom.c	2004-08-06 18:04:33.570828588 +0200
@@ -899,7 +899,7 @@ int cdrom_open(struct cdrom_device_info 
 			ret = -EROFS;
 			if (cdrom_open_write(cdi))
 				goto err;
-			if (!CDROM_CAN(CDC_RAM))
+			if (!CDROM_CAN(CDC_RAM) && !CDROM_CAN(CDC_MO_DRIVE))
 				goto err;
 			ret = 0;
 		}


--
Stefan Meyknecht
stefan at meyknecht dot org

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

* Re: [PATCH] cdrom: MO-drive open write fix (trivial)
  2004-08-06 16:33 [PATCH] cdrom: MO-drive open write fix (trivial) Stefan Meyknecht
@ 2004-08-07  5:06 ` Andrew Morton
  2004-08-07  8:38   ` Jens Axboe
  0 siblings, 1 reply; 10+ messages in thread
From: Andrew Morton @ 2004-08-07  5:06 UTC (permalink / raw)
  To: Stefan Meyknecht; +Cc: linux-kernel, Jens Axboe

Stefan Meyknecht <sm0407@nurfuerspam.de> wrote:
>
> [PATCH] cdrom: MO-drive open write fix
> 
> Allow mounting mo-drives readwrite.
> 
> Please apply.
> 
> Stefan
> 
> 
> --- linux/drivers/cdrom/cdrom.c.orig	2004-08-06 18:04:16.269803330 +0200
> +++ linux/drivers/cdrom/cdrom.c	2004-08-06 18:04:33.570828588 +0200
> @@ -899,7 +899,7 @@ int cdrom_open(struct cdrom_device_info 
>  			ret = -EROFS;
>  			if (cdrom_open_write(cdi))
>  				goto err;
> -			if (!CDROM_CAN(CDC_RAM))
> +			if (!CDROM_CAN(CDC_RAM) && !CDROM_CAN(CDC_MO_DRIVE))
>  				goto err;
>  			ret = 0;
>  		}

I forwarded this to Jens last time you sent it and he said "Not really,
CDC_RAM is an umbrella that should already cover these devices.  I'll reply
to him."

So...  could you describe the actual bug which you're seeing - maybe
there's some different fix which we need.


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

* Re: [PATCH] cdrom: MO-drive open write fix (trivial)
  2004-08-07  5:06 ` Andrew Morton
@ 2004-08-07  8:38   ` Jens Axboe
  2004-08-07 10:35     ` Stefan Meyknecht
  2004-08-07 12:12     ` Stefan Meyknecht
  0 siblings, 2 replies; 10+ messages in thread
From: Jens Axboe @ 2004-08-07  8:38 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Stefan Meyknecht, linux-kernel

On Fri, Aug 06 2004, Andrew Morton wrote:
> Stefan Meyknecht <sm0407@nurfuerspam.de> wrote:
> >
> > [PATCH] cdrom: MO-drive open write fix
> > 
> > Allow mounting mo-drives readwrite.
> > 
> > Please apply.
> > 
> > Stefan
> > 
> > 
> > --- linux/drivers/cdrom/cdrom.c.orig	2004-08-06 18:04:16.269803330 +0200
> > +++ linux/drivers/cdrom/cdrom.c	2004-08-06 18:04:33.570828588 +0200
> > @@ -899,7 +899,7 @@ int cdrom_open(struct cdrom_device_info 
> >  			ret = -EROFS;
> >  			if (cdrom_open_write(cdi))
> >  				goto err;
> > -			if (!CDROM_CAN(CDC_RAM))
> > +			if (!CDROM_CAN(CDC_RAM) && !CDROM_CAN(CDC_MO_DRIVE))
> >  				goto err;
> >  			ret = 0;
> >  		}
> 
> I forwarded this to Jens last time you sent it and he said "Not really,
> CDC_RAM is an umbrella that should already cover these devices.  I'll reply
> to him."
> 
> So...  could you describe the actual bug which you're seeing - maybe
> there's some different fix which we need.

Sorry, guess I forgot to reply on linux-kernel. What I mean is that MO
drives should just have CDC_RAM set - it doesn't denote a specific
device type, rather just the ability to work like a hard drive. If you
could look into why that isn't set for your mo device and send a patch
for that, it would be much better.

Jens


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

* Re: [PATCH] cdrom: MO-drive open write fix (trivial)
  2004-08-07  8:38   ` Jens Axboe
@ 2004-08-07 10:35     ` Stefan Meyknecht
  2004-08-07 12:12     ` Stefan Meyknecht
  1 sibling, 0 replies; 10+ messages in thread
From: Stefan Meyknecht @ 2004-08-07 10:35 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Andrew Morton, linux-kernel

Hi,

thanks for your feedback.

Jens Axboe <axboe@suse.de> wrote:
> Sorry, guess I forgot to reply on linux-kernel. What I mean is that
> MO drives should just have CDC_RAM set - it doesn't denote a
> specific device type, rather just the ability to work like a hard
> drive. If you could look into why that isn't set for your mo device
> and send a patch for that, it would be much better.

You are right. After inserting some debug messages I found out that in 
function cdrom_open_write CDC_RAM is initially set. The function 
cdrom_is_random_writable sets ram_write to 0 and therefore CDC_RAM 
gets masked out later. cdrom_is_random_writable calls 
cdrom_get_random_writable and there cdi->ops->generic_packet returns 
-5 (-EIO?). But I have no idea what to do in this case.

-- 
Stefan Meyknecht
stefan at meyknecht dot org

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

* Re: [PATCH] cdrom: MO-drive open write fix (trivial)
  2004-08-07  8:38   ` Jens Axboe
  2004-08-07 10:35     ` Stefan Meyknecht
@ 2004-08-07 12:12     ` Stefan Meyknecht
  2004-08-07 21:57       ` Alan Cox
  2004-08-09  6:33       ` Jens Axboe
  1 sibling, 2 replies; 10+ messages in thread
From: Stefan Meyknecht @ 2004-08-07 12:12 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Andrew Morton, linux-kernel

Jens Axboe <axboe@suse.de> wrote:
> drive. If you could look into why that isn't set for your mo device
> and send a patch for that, it would be much better.

Assuming mo devices can do random writing, how about this patch:

--- linux/drivers/cdrom/cdrom.c.orig	2004-08-07 14:02:28.958908544 +0200
+++ linux/drivers/cdrom/cdrom.c	2004-08-07 13:58:29.306167698 +0200
@@ -833,8 +833,11 @@ static int cdrom_open_write(struct cdrom
 	if (!cdrom_is_mrw(cdi, &mrw_write))
 		mrw = 1;
 
-	(void) cdrom_is_random_writable(cdi, &ram_write);
-
+	if (CDROM_CAN(CDC_MO_DRIVE))
+		ram_write = 1;
+	else
+		(void) cdrom_is_random_writable(cdi, &ram_write);
+	
 	if (mrw)
 		cdi->mask &= ~CDC_MRW;
 	else
@@ -855,7 +858,7 @@ static int cdrom_open_write(struct cdrom
 	else if (CDROM_CAN(CDC_DVD_RAM))
 		ret = cdrom_dvdram_open_write(cdi);
  	else if (CDROM_CAN(CDC_RAM) &&
- 		 !CDROM_CAN(CDC_CD_R|CDC_CD_RW|CDC_DVD|CDC_DVD_R|CDC_MRW))
+ 		 !CDROM_CAN(CDC_CD_R|CDC_CD_RW|CDC_DVD|CDC_DVD_R|CDC_MRW|CDC_MO_DRIVE))
  		ret = cdrom_ram_open_write(cdi);
 	else if (CDROM_CAN(CDC_MO_DRIVE))
 		ret = mo_open_write(cdi);

-- 
Stefan Meyknecht
stefan at meyknecht dot org

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

* Re: [PATCH] cdrom: MO-drive open write fix (trivial)
  2004-08-07 12:12     ` Stefan Meyknecht
@ 2004-08-07 21:57       ` Alan Cox
  2004-08-09  6:33       ` Jens Axboe
  1 sibling, 0 replies; 10+ messages in thread
From: Alan Cox @ 2004-08-07 21:57 UTC (permalink / raw)
  To: Stefan Meyknecht; +Cc: Jens Axboe, Andrew Morton, Linux Kernel Mailing List

On Sad, 2004-08-07 at 13:12, Stefan Meyknecht wrote:
> Jens Axboe <axboe@suse.de> wrote:
> > drive. If you could look into why that isn't set for your mo device
> > and send a patch for that, it would be much better.
> 
> Assuming mo devices can do random writing, how about this patch:

They can do so. I ended up using verified writes on mine because I found
MO devices pretty flakey and often needing retried reads or
write/verifies.

Maybe my drive just needs cleaning more.


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

* Re: [PATCH] cdrom: MO-drive open write fix (trivial)
  2004-08-07 12:12     ` Stefan Meyknecht
  2004-08-07 21:57       ` Alan Cox
@ 2004-08-09  6:33       ` Jens Axboe
  2004-08-13 17:17         ` Stefan Meyknecht
  1 sibling, 1 reply; 10+ messages in thread
From: Jens Axboe @ 2004-08-09  6:33 UTC (permalink / raw)
  To: Stefan Meyknecht; +Cc: Andrew Morton, linux-kernel

On Sat, Aug 07 2004, Stefan Meyknecht wrote:
> Jens Axboe <axboe@suse.de> wrote:
> > drive. If you could look into why that isn't set for your mo device
> > and send a patch for that, it would be much better.
> 
> Assuming mo devices can do random writing, how about this patch:
> 
> --- linux/drivers/cdrom/cdrom.c.orig	2004-08-07 14:02:28.958908544 +0200
> +++ linux/drivers/cdrom/cdrom.c	2004-08-07 13:58:29.306167698 +0200
> @@ -833,8 +833,11 @@ static int cdrom_open_write(struct cdrom
>  	if (!cdrom_is_mrw(cdi, &mrw_write))
>  		mrw = 1;
>  
> -	(void) cdrom_is_random_writable(cdi, &ram_write);
> -
> +	if (CDROM_CAN(CDC_MO_DRIVE))
> +		ram_write = 1;
> +	else
> +		(void) cdrom_is_random_writable(cdi, &ram_write);
> +	
>  	if (mrw)
>  		cdi->mask &= ~CDC_MRW;
>  	else
> @@ -855,7 +858,7 @@ static int cdrom_open_write(struct cdrom
>  	else if (CDROM_CAN(CDC_DVD_RAM))
>  		ret = cdrom_dvdram_open_write(cdi);
>   	else if (CDROM_CAN(CDC_RAM) &&
> - 		 !CDROM_CAN(CDC_CD_R|CDC_CD_RW|CDC_DVD|CDC_DVD_R|CDC_MRW))
> + 		 !CDROM_CAN(CDC_CD_R|CDC_CD_RW|CDC_DVD|CDC_DVD_R|CDC_MRW|CDC_MO_DRIVE))
>   		ret = cdrom_ram_open_write(cdi);
>  	else if (CDROM_CAN(CDC_MO_DRIVE))
>  		ret = mo_open_write(cdi);

Patch looks fine (last hunk is a little code, but that's not your
fault). Thanks!

-- 
Jens Axboe


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

* Re: [PATCH] cdrom: MO-drive open write fix (trivial)
  2004-08-09  6:33       ` Jens Axboe
@ 2004-08-13 17:17         ` Stefan Meyknecht
  2004-08-13 17:26           ` Jens Axboe
  0 siblings, 1 reply; 10+ messages in thread
From: Stefan Meyknecht @ 2004-08-13 17:17 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Andrew Morton, linux-kernel

Hi,

Jens Axboe <axboe@suse.de> wrote:
> Patch looks fine (last hunk is a little code, but that's not your
> fault). Thanks!

Do you consider including the patch into 2.6.8 or is it too late? 
Please mail me if something is missing or to resend.

-- 
Stefan Meyknecht
stefan at meyknecht dot org

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

* Re: [PATCH] cdrom: MO-drive open write fix (trivial)
  2004-08-13 17:17         ` Stefan Meyknecht
@ 2004-08-13 17:26           ` Jens Axboe
  2004-08-13 17:47             ` Stefan Meyknecht
  0 siblings, 1 reply; 10+ messages in thread
From: Jens Axboe @ 2004-08-13 17:26 UTC (permalink / raw)
  To: Stefan Meyknecht; +Cc: Andrew Morton, linux-kernel

On Fri, Aug 13 2004, Stefan Meyknecht wrote:
> Hi,
> 
> Jens Axboe <axboe@suse.de> wrote:
> > Patch looks fine (last hunk is a little code, but that's not your
> > fault). Thanks!
> 
> Do you consider including the patch into 2.6.8 or is it too late? 
> Please mail me if something is missing or to resend.

IMHO it's fine for 2.6.8, please resend the patch and CC Linus.

-- 
Jens Axboe


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

* Re: [PATCH] cdrom: MO-drive open write fix (trivial)
  2004-08-13 17:26           ` Jens Axboe
@ 2004-08-13 17:47             ` Stefan Meyknecht
  0 siblings, 0 replies; 10+ messages in thread
From: Stefan Meyknecht @ 2004-08-13 17:47 UTC (permalink / raw)
  To: Jens Axboe; +Cc: Andrew Morton, linux-kernel, Linus Torvalds

Jens Axboe <axboe@suse.de> wrote:
> On Fri, Aug 13 2004, Stefan Meyknecht wrote:
> > Jens Axboe <axboe@suse.de> wrote:
> > > Patch looks fine (last hunk is a little code, but that's not
> > > your fault). Thanks!
> >
> > Do you consider including the patch into 2.6.8 or is it too late?
> > Please mail me if something is missing or to resend.
>
> IMHO it's fine for 2.6.8, please resend the patch and CC Linus.


[PATCH] cdrom: MO-drive open write fix

This patch allows mounting MO-drives readwrite.



--- linux/drivers/cdrom/cdrom.c.orig	2004-08-07 14:02:28.958908544 +0200
+++ linux/drivers/cdrom/cdrom.c	2004-08-07 13:58:29.306167698 +0200
@@ -833,8 +833,11 @@ static int cdrom_open_write(struct cdrom
 	if (!cdrom_is_mrw(cdi, &mrw_write))
 		mrw = 1;
 
-	(void) cdrom_is_random_writable(cdi, &ram_write);
-
+	if (CDROM_CAN(CDC_MO_DRIVE))
+		ram_write = 1;
+	else
+		(void) cdrom_is_random_writable(cdi, &ram_write);
+	
 	if (mrw)
 		cdi->mask &= ~CDC_MRW;
 	else
@@ -855,7 +858,7 @@ static int cdrom_open_write(struct cdrom
 	else if (CDROM_CAN(CDC_DVD_RAM))
 		ret = cdrom_dvdram_open_write(cdi);
  	else if (CDROM_CAN(CDC_RAM) &&
- 		 !CDROM_CAN(CDC_CD_R|CDC_CD_RW|CDC_DVD|CDC_DVD_R|CDC_MRW))
+ 		 !CDROM_CAN(CDC_CD_R|CDC_CD_RW|CDC_DVD|CDC_DVD_R|CDC_MRW|CDC_MO_DRIVE))
  		ret = cdrom_ram_open_write(cdi);
 	else if (CDROM_CAN(CDC_MO_DRIVE))
 		ret = mo_open_write(cdi);

-- 
Stefan Meyknecht
stefan at meyknecht dot org

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

end of thread, other threads:[~2004-08-13 17:49 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-08-06 16:33 [PATCH] cdrom: MO-drive open write fix (trivial) Stefan Meyknecht
2004-08-07  5:06 ` Andrew Morton
2004-08-07  8:38   ` Jens Axboe
2004-08-07 10:35     ` Stefan Meyknecht
2004-08-07 12:12     ` Stefan Meyknecht
2004-08-07 21:57       ` Alan Cox
2004-08-09  6:33       ` Jens Axboe
2004-08-13 17:17         ` Stefan Meyknecht
2004-08-13 17:26           ` Jens Axboe
2004-08-13 17:47             ` Stefan Meyknecht

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.