diff options
author | Kenneth D. Merry <ken@FreeBSD.org> | 2001-11-27 03:55:43 +0000 |
---|---|---|
committer | Kenneth D. Merry <ken@FreeBSD.org> | 2001-11-27 03:55:43 +0000 |
commit | 94a0557ad7bd344f3846a2d9218a8c0f79491ff4 (patch) | |
tree | 6337f257b351d5fe883ff59bd94a905f1cc38da8 /sys/fs | |
parent | 5cd818b1b74afef0eeeb8126ddf34107a022eb08 (diff) | |
download | src-94a0557ad7bd344f3846a2d9218a8c0f79491ff4.tar.gz src-94a0557ad7bd344f3846a2d9218a8c0f79491ff4.zip |
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
Notes
Notes:
svn path=/head/; revision=86941
Diffstat (limited to 'sys/fs')
-rw-r--r-- | sys/fs/cd9660/cd9660_vfsops.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/sys/fs/cd9660/cd9660_vfsops.c b/sys/fs/cd9660/cd9660_vfsops.c index 73a5bcea8c54..5d7ff1b83454 100644 --- a/sys/fs/cd9660/cd9660_vfsops.c +++ b/sys/fs/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); |