summaryrefslogtreecommitdiff
path: root/sys/isofs
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2009-12-12 06:44:47 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2009-12-12 06:44:47 +0000
commit6d9e20614adecd5f67d46e3ed51ec1614930dfce (patch)
tree0e3be0802714616901a39018c5ed75562cef6d77 /sys/isofs
parent583cd66bd18d6e3ac9f2e06b7b79b3bf48c9a25b (diff)
Add some locking around VOP_CLOSE() and friends. Lets VFSDEBUG
kernels once again mount cd9660 filesystems without crashing. From an old reverted diff of thib@, parts of which apparently did not get re-committed. ok oga@ beck@
Diffstat (limited to 'sys/isofs')
-rw-r--r--sys/isofs/cd9660/cd9660_vfsops.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/sys/isofs/cd9660/cd9660_vfsops.c b/sys/isofs/cd9660/cd9660_vfsops.c
index 856cf5f868f..3d6a644f031 100644
--- a/sys/isofs/cd9660/cd9660_vfsops.c
+++ b/sys/isofs/cd9660/cd9660_vfsops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cd9660_vfsops.c,v 1.51 2009/10/31 12:00:08 fgsch Exp $ */
+/* $OpenBSD: cd9660_vfsops.c,v 1.52 2009/12/12 06:44:46 krw Exp $ */
/* $NetBSD: cd9660_vfsops.c,v 1.26 1997/06/13 15:38:58 pk Exp $ */
/*-
@@ -251,7 +251,10 @@ iso_mountfs(devvp, mp, p, argp)
return (error);
if (vcount(devvp) > 1 && devvp != rootvp)
return (EBUSY);
- if ((error = vinvalbuf(devvp, V_SAVE, p->p_ucred, p, 0, 0)) != 0)
+ vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, p);
+ error = vinvalbuf(devvp, V_SAVE, p->p_ucred, p, 0, 0);
+ VOP_UNLOCK(devvp, 0, p);
+ if (error)
return (error);
error = VOP_OPEN(devvp, ronly ? FREAD : FREAD|FWRITE, FSCRED, p);
@@ -443,9 +446,12 @@ out:
brelse(bp);
if (supbp)
brelse(supbp);
- if (needclose)
- (void)VOP_CLOSE(devvp, ronly ? FREAD : FREAD|FWRITE, NOCRED,
- p);
+ if (needclose) {
+ vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, p);
+ VOP_CLOSE(devvp, ronly ? FREAD : FREAD|FWRITE, NOCRED, p);
+ VOP_UNLOCK(devvp, 0, p);
+ }
+
if (isomp) {
free((caddr_t)isomp, M_ISOFSMNT);
mp->mnt_data = (qaddr_t)0;
@@ -581,8 +587,9 @@ cd9660_unmount(mp, mntflags, p)
#endif
isomp->im_devvp->v_specmountpoint = NULL;
+ vn_lock(isomp->im_devvp, LK_EXCLUSIVE | LK_RETRY, p);
error = VOP_CLOSE(isomp->im_devvp, FREAD, NOCRED, p);
- vrele(isomp->im_devvp);
+ vput(isomp->im_devvp);
free((caddr_t)isomp, M_ISOFSMNT);
mp->mnt_data = (qaddr_t)0;
mp->mnt_flag &= ~MNT_LOCAL;