summaryrefslogtreecommitdiff
path: root/sys/msdosfs
diff options
context:
space:
mode:
authorThordur I. Bjornsson <thib@cvs.openbsd.org>2006-08-06 18:42:02 +0000
committerThordur I. Bjornsson <thib@cvs.openbsd.org>2006-08-06 18:42:02 +0000
commit86b0e9841c734d03c0061a08c6defcd360133f65 (patch)
tree0934a3c5c967aacd5db1309cd537b488566addec /sys/msdosfs
parentaea23d2253246c3537bcfc024f98ae378b87f0e7 (diff)
obey the locking disaplince wrt to VOP_CLOSE during umounts
and mount error paths. ok sturm@ pedro@
Diffstat (limited to 'sys/msdosfs')
-rw-r--r--sys/msdosfs/msdosfs_vfsops.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/msdosfs/msdosfs_vfsops.c b/sys/msdosfs/msdosfs_vfsops.c
index 1bf90685d14..42945651bd0 100644
--- a/sys/msdosfs/msdosfs_vfsops.c
+++ b/sys/msdosfs/msdosfs_vfsops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: msdosfs_vfsops.c,v 1.37 2006/07/19 15:48:06 sturm Exp $ */
+/* $OpenBSD: msdosfs_vfsops.c,v 1.38 2006/08/06 18:42:01 thib Exp $ */
/* $NetBSD: msdosfs_vfsops.c,v 1.48 1997/10/18 02:54:57 briggs Exp $ */
/*-
@@ -593,7 +593,9 @@ error_exit:
devvp->v_specmountpoint = NULL;
if (bp)
brelse(bp);
+ vn_lock(devvp, LK_EXCLUSIVE|LK_RETRY, p);
(void) VOP_CLOSE(devvp, ronly ? FREAD : FREAD|FWRITE, NOCRED, p);
+ VOP_UNLOCK(devvp, 0, p);
if (pmp) {
if (pmp->pm_inusemap)
free(pmp->pm_inusemap, M_MSDOSFSFAT);
@@ -639,9 +641,11 @@ msdosfs_unmount(mp, mntflags, p)
#ifdef MSDOSFS_DEBUG
vprint("msdosfs_umount(): just before calling VOP_CLOSE()\n", vp);
#endif
+ vn_lock(vp, LK_EXCLUSIVE|LK_RETRY, p);
error = VOP_CLOSE(vp,
pmp->pm_flags & MSDOSFSMNT_RONLY ? FREAD : FREAD|FWRITE, NOCRED, p);
- vrele(vp);
+ vput(vp);
+
free(pmp->pm_inusemap, M_MSDOSFSFAT);
free(pmp, M_MSDOSFSMNT);
mp->mnt_data = (qaddr_t)0;