summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2009-12-19 00:27:18 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2009-12-19 00:27:18 +0000
commit20223e980d9e90e1b19206fac6fd99b3de16c00b (patch)
treecddfbd3e432c61855097e75aba7f6c44655fe337
parenta071d2844b0aca1fbdd02c554f6f4dbff82b2fcc (diff)
Re-introduce the remaining bits of thib@'s Aug 2006 VOP_CLOSE()
locking fixes. Tweak cd9660 code to be the same as everywhere else, no functional change. ok beck@
-rw-r--r--sys/isofs/cd9660/cd9660_vfsops.c13
-rw-r--r--sys/isofs/udf/udf_vfsops.c5
-rw-r--r--sys/msdosfs/msdosfs_vfsops.c6
-rw-r--r--sys/ufs/ffs/ffs_vfsops.c6
4 files changed, 19 insertions, 11 deletions
diff --git a/sys/isofs/cd9660/cd9660_vfsops.c b/sys/isofs/cd9660/cd9660_vfsops.c
index 3d6a644f031..30056271f4a 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.52 2009/12/12 06:44:46 krw Exp $ */
+/* $OpenBSD: cd9660_vfsops.c,v 1.53 2009/12/19 00:27:17 krw Exp $ */
/* $NetBSD: cd9660_vfsops.c,v 1.26 1997/06/13 15:38:58 pk Exp $ */
/*-
@@ -225,7 +225,6 @@ iso_mountfs(devvp, mp, p, argp)
struct buf *pribp = NULL, *supbp = NULL;
dev_t dev = devvp->v_rdev;
int error = EINVAL;
- int needclose = 0;
int ronly = (mp->mnt_flag & MNT_RDONLY) != 0;
extern struct vnode *rootvp;
int iso_bsize;
@@ -260,7 +259,6 @@ iso_mountfs(devvp, mp, p, argp)
error = VOP_OPEN(devvp, ronly ? FREAD : FREAD|FWRITE, FSCRED, p);
if (error)
return (error);
- needclose = 1;
/*
* This is the "logical sector size". The standard says this
@@ -446,11 +444,10 @@ out:
brelse(bp);
if (supbp)
brelse(supbp);
- if (needclose) {
- vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, p);
- VOP_CLOSE(devvp, ronly ? FREAD : FREAD|FWRITE, NOCRED, p);
- VOP_UNLOCK(devvp, 0, p);
- }
+
+ 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);
diff --git a/sys/isofs/udf/udf_vfsops.c b/sys/isofs/udf/udf_vfsops.c
index e422db60dd2..40875383e6d 100644
--- a/sys/isofs/udf/udf_vfsops.c
+++ b/sys/isofs/udf/udf_vfsops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: udf_vfsops.c,v 1.31 2009/08/27 23:14:47 jolan Exp $ */
+/* $OpenBSD: udf_vfsops.c,v 1.32 2009/12/19 00:27:17 krw Exp $ */
/*
* Copyright (c) 2001, 2002 Scott Long <scottl@freebsd.org>
@@ -443,7 +443,10 @@ bail:
}
if (bp != NULL)
brelse(bp);
+
+ vn_lock(devvp, LK_EXCLUSIVE|LK_RETRY, p);
VOP_CLOSE(devvp, FREAD, FSCRED, p);
+ VOP_UNLOCK(devvp, 0, p);
return (error);
}
diff --git a/sys/msdosfs/msdosfs_vfsops.c b/sys/msdosfs/msdosfs_vfsops.c
index 3e828b33f2f..20f0ad8fc63 100644
--- a/sys/msdosfs/msdosfs_vfsops.c
+++ b/sys/msdosfs/msdosfs_vfsops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: msdosfs_vfsops.c,v 1.55 2009/10/31 12:00:08 fgsch Exp $ */
+/* $OpenBSD: msdosfs_vfsops.c,v 1.56 2009/12/19 00:27:17 krw Exp $ */
/* $NetBSD: msdosfs_vfsops.c,v 1.48 1997/10/18 02:54:57 briggs Exp $ */
/*-
@@ -548,7 +548,11 @@ 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);
diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c
index 2364d4f429c..1f331380576 100644
--- a/sys/ufs/ffs/ffs_vfsops.c
+++ b/sys/ufs/ffs/ffs_vfsops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ffs_vfsops.c,v 1.120 2009/07/09 22:29:56 thib Exp $ */
+/* $OpenBSD: ffs_vfsops.c,v 1.121 2009/12/19 00:27:17 krw Exp $ */
/* $NetBSD: ffs_vfsops.c,v 1.19 1996/02/09 22:22:26 christos Exp $ */
/*
@@ -915,7 +915,11 @@ out:
devvp->v_specmountpoint = NULL;
if (bp)
brelse(bp);
+
+ vn_lock(devvp, LK_EXCLUSIVE|LK_RETRY, p);
(void)VOP_CLOSE(devvp, ronly ? FREAD : FREAD|FWRITE, cred, p);
+ VOP_UNLOCK(devvp, 0, p);
+
if (ump) {
free(ump->um_fs, M_UFSMNT);
free(ump, M_UFSMNT);