summaryrefslogtreecommitdiffstats
path: root/sys/isofs/cd9660
diff options
context:
space:
mode:
authorken <ken@FreeBSD.org>2001-11-27 03:55:43 +0000
committerken <ken@FreeBSD.org>2001-11-27 03:55:43 +0000
commit5cc7e8df852e541e8cfba5e8557163397f67596f (patch)
tree6337f257b351d5fe883ff59bd94a905f1cc38da8 /sys/isofs/cd9660
parent33d2e7c7bc018ba78912bcfcc4b4b74f24a1a518 (diff)
downloadFreeBSD-src-5cc7e8df852e541e8cfba5e8557163397f67596f.zip
FreeBSD-src-5cc7e8df852e541e8cfba5e8557163397f67596f.tar.gz
Fix mounting root from a ISO9660 filesystem on a SCSI CDROM.
The problem was that the ISO9660 code wasn't opening the device prior to issuing ioctl calls. In particular, the device must be open before iso_get_ssector() is called in iso_mountroot(). If the device isn't opened first, the disk layer blows up due to an uninitialized variable. The solution was to open the device, call iso_get_ssector() and then close it again. The ATAPI CDROM driver doesn't have this problem because it doesn't use the disk layer, and evidently doesn't mind if someone issues an ioctl without first issuing an open call. Thanks to phk for pointing me at the source of this problem. Tested by: dirk MFC after: 1 week
Diffstat (limited to 'sys/isofs/cd9660')
-rw-r--r--sys/isofs/cd9660/cd9660_vfsops.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/sys/isofs/cd9660/cd9660_vfsops.c b/sys/isofs/cd9660/cd9660_vfsops.c
index 73a5bce..5d7ff1b 100644
--- a/sys/isofs/cd9660/cd9660_vfsops.c
+++ b/sys/isofs/cd9660/cd9660_vfsops.c
@@ -156,7 +156,17 @@ iso_mountroot(mp, td)
return (error);
}
args.flags = ISOFSMNT_ROOT;
+
+ vn_lock(rootvp, LK_EXCLUSIVE | LK_RETRY, td);
+ error = VOP_OPEN(rootvp, FREAD, FSCRED, td);
+ VOP_UNLOCK(rootvp, 0, td);
+ if (error)
+ return error;
+
args.ssector = iso_get_ssector(rootdev, td);
+
+ (void)VOP_CLOSE(rootvp, FREAD, NOCRED, td);
+
if (bootverbose)
printf("iso_mountroot(): using session at block %d\n",
args.ssector);
OpenPOWER on IntegriCloud