summaryrefslogtreecommitdiff
path: root/sys/tmpfs
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2014-01-07 04:44:57 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2014-01-07 04:44:57 +0000
commitebb22813e1e8e922615745d6c1ad489c3f28b03e (patch)
tree8d7a58839277a0e99fefe1d077d76b508cb553a9 /sys/tmpfs
parent5294b6b396d7869bde427652d0887a92e11eaa11 (diff)
Delay checking the vnode locking of the target vnodes in tmpfs_rename()
until we've confirmed they're on the same filesystem as the source: not all filesystems do locking the same. problem report and testing chrisz@ ok espie@
Diffstat (limited to 'sys/tmpfs')
-rw-r--r--sys/tmpfs/tmpfs_vnops.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/sys/tmpfs/tmpfs_vnops.c b/sys/tmpfs/tmpfs_vnops.c
index 467b3f2b159..adc83757557 100644
--- a/sys/tmpfs/tmpfs_vnops.c
+++ b/sys/tmpfs/tmpfs_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tmpfs_vnops.c,v 1.11 2013/12/23 17:23:51 kettenis Exp $ */
+/* $OpenBSD: tmpfs_vnops.c,v 1.12 2014/01/07 04:44:56 guenther Exp $ */
/* $NetBSD: tmpfs_vnops.c,v 1.100 2012/11/05 17:27:39 dholland Exp $ */
/*
@@ -1302,8 +1302,6 @@ tmpfs_rename(void *v)
KASSERT(fcnp->cn_nameptr != NULL);
/* KASSERT(VOP_ISLOCKED(fdvp) != LK_EXCLUSIVE); */
/* KASSERT(VOP_ISLOCKED(fvp) != LK_EXCLUSIVE); */
- KASSERT(VOP_ISLOCKED(tdvp) == LK_EXCLUSIVE);
- KASSERT((tvp == NULL) || (VOP_ISLOCKED(tvp) == LK_EXCLUSIVE));
KASSERT(fdvp->v_type == VDIR);
KASSERT(tdvp->v_type == VDIR);
KASSERT(fcnp->cn_flags & HASBUF);
@@ -1322,6 +1320,13 @@ tmpfs_rename(void *v)
}
/*
+ * Can't check the locks on these until we know they're on
+ * the same FS, as not all FS do locking the same way.
+ */
+ KASSERT(VOP_ISLOCKED(tdvp) == LK_EXCLUSIVE);
+ KASSERT((tvp == NULL) || (VOP_ISLOCKED(tvp) == LK_EXCLUSIVE));
+
+ /*
* Reject renaming '.' and '..'.
*/
if ((fcnp->cn_namelen == 1 && fcnp->cn_nameptr[0] == '.') ||