From 5cc7e8df852e541e8cfba5e8557163397f67596f Mon Sep 17 00:00:00 2001 From: ken Date: Tue, 27 Nov 2001 03:55:43 +0000 Subject: 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 --- sys/isofs/cd9660/cd9660_vfsops.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'sys/isofs/cd9660') 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); -- cgit v1.1