* [PATCH] fix cdrom open
@ 2006-06-16 3:56 Stephen Rothwell
2006-06-16 5:45 ` Jens Axboe
0 siblings, 1 reply; 2+ messages in thread
From: Stephen Rothwell @ 2006-06-16 3:56 UTC (permalink / raw)
To: Jens Axboe; +Cc: LKML
Hi Jens,
Some time ago the cdrom open routine was changed so that we call the
driver's open routine before checking to see if it is read only. However,
if we discovered that a read write open was not possible and the open
flags required a writable open, we just returned -EROFS without calling
the driver's release routine. This seems to work for most cdrom drivers,
but breaks the Powerpc iSeries virtual cdrom rather badly. The following
patch just inserts the release call in the error path.
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
It would be good is this could go into 2.6.17 as it affects the new distro
kernels.
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c
index a59876a..3170eaa 100644
--- a/drivers/cdrom/cdrom.c
+++ b/drivers/cdrom/cdrom.c
@@ -1009,9 +1009,9 @@ int cdrom_open(struct cdrom_device_info
if (fp->f_mode & FMODE_WRITE) {
ret = -EROFS;
if (cdrom_open_write(cdi))
- goto err;
+ goto err_release;
if (!CDROM_CAN(CDC_RAM))
- goto err;
+ goto err_release;
ret = 0;
cdi->media_written = 0;
}
@@ -1026,6 +1026,8 @@ int cdrom_open(struct cdrom_device_info
not be mounting, but opening with O_NONBLOCK */
check_disk_change(ip->i_bdev);
return 0;
+err_release:
+ cdi->ops->release(cdi);
err:
cdi->use_count--;
return ret;
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] fix cdrom open
2006-06-16 3:56 [PATCH] fix cdrom open Stephen Rothwell
@ 2006-06-16 5:45 ` Jens Axboe
0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2006-06-16 5:45 UTC (permalink / raw)
To: Stephen Rothwell; +Cc: LKML
On Fri, Jun 16 2006, Stephen Rothwell wrote:
> Hi Jens,
>
> Some time ago the cdrom open routine was changed so that we call the
> driver's open routine before checking to see if it is read only. However,
> if we discovered that a read write open was not possible and the open
> flags required a writable open, we just returned -EROFS without calling
> the driver's release routine. This seems to work for most cdrom drivers,
> but breaks the Powerpc iSeries virtual cdrom rather badly. The following
> patch just inserts the release call in the error path.
>
> Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
>
> It would be good is this could go into 2.6.17 as it affects the new distro
> kernels.
Looks good, I'll forward it for 2.6.17 inclusion.
--
Jens Axboe
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-06-16 5:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-16 3:56 [PATCH] fix cdrom open Stephen Rothwell
2006-06-16 5:45 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox