From d86fc745bd2cb49f9b6a4d76caee22f6eaeae1de Mon Sep 17 00:00:00 2001 From: guenther Date: Tue, 7 Jan 2014 04:44:56 +0000 Subject: [PATCH] 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@ --- sys/tmpfs/tmpfs_vnops.c | 11 ++++++++--- 1 file 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); @@ -1321,6 +1319,13 @@ tmpfs_rename(void *v) return EXDEV; } + /* + * 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 '..'. */ -- 2.20.1