aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cdrom/cdrom.c
diff options
context:
space:
mode:
authorJens Axboe <axboe@suse.de>2006-06-16 01:46:37 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-06-17 13:44:26 -0400
commit16070428d389ff47aa3476b0911179ad90c640a2 (patch)
treefb9b9a15a720bf5fb070f2a0fd611aaabd9d1b52 /drivers/cdrom/cdrom.c
parent553698f944ed715dfe023b4cef07601f0ce735f0 (diff)
[PATCH] fix cdrom open
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. This just inserts the release call in the error path to balance the call to "->open()" done by "open_for_data()". Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Jens Axboe <axboe@suse.de> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/cdrom/cdrom.c')
-rw-r--r--drivers/cdrom/cdrom.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/cdrom/cdrom.c b/drivers/cdrom/cdrom.c
index a59876a0bfa1..3170eaa25087 100644
--- a/drivers/cdrom/cdrom.c
+++ b/drivers/cdrom/cdrom.c
@@ -1009,9 +1009,9 @@ int cdrom_open(struct cdrom_device_info *cdi, struct inode *ip, struct file *fp)
1009 if (fp->f_mode & FMODE_WRITE) { 1009 if (fp->f_mode & FMODE_WRITE) {
1010 ret = -EROFS; 1010 ret = -EROFS;
1011 if (cdrom_open_write(cdi)) 1011 if (cdrom_open_write(cdi))
1012 goto err; 1012 goto err_release;
1013 if (!CDROM_CAN(CDC_RAM)) 1013 if (!CDROM_CAN(CDC_RAM))
1014 goto err; 1014 goto err_release;
1015 ret = 0; 1015 ret = 0;
1016 cdi->media_written = 0; 1016 cdi->media_written = 0;
1017 } 1017 }
@@ -1026,6 +1026,8 @@ int cdrom_open(struct cdrom_device_info *cdi, struct inode *ip, struct file *fp)
1026 not be mounting, but opening with O_NONBLOCK */ 1026 not be mounting, but opening with O_NONBLOCK */
1027 check_disk_change(ip->i_bdev); 1027 check_disk_change(ip->i_bdev);
1028 return 0; 1028 return 0;
1029err_release:
1030 cdi->ops->release(cdi);
1029err: 1031err:
1030 cdi->use_count--; 1032 cdi->use_count--;
1031 return ret; 1033 return ret;