Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 02 Jun 2010 11:16:45 +0300
From:      Mikolaj Golub <to.my.trociny@gmail.com>
To:        Kostik Belousov <kostikbel@gmail.com>
Cc:        freebsd-fs@freebsd.org
Subject:   Re: nullfs: vop_rename: fdvp is locked but should not be
Message-ID:  <86bpbtonma.fsf@zhuzha.ua1>
In-Reply-To: <20100601140721.GH83316@deviant.kiev.zoral.com.ua> (Kostik Belousov's message of "Tue, 1 Jun 2010 17:07:21 %2B0300")
References:  <86fx16onx6.fsf@zhuzha.ua1> <20100601140721.GH83316@deviant.kiev.zoral.com.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
--=-=-=


 KB> I am curious to look at the final patch. Note that you proposing to add
 KB> fs-specific check to vfs_subr.c. Checking that the the vnode locks are
 KB> different instead of that vnodes itself are different might be better
 KB> approach for vop_rename_pre.

Ok. Looks a bit tricky :-). Then may be it is safe just to skip ASSERT() if
the "target" and "from" vnodes are on different fs, like in the patch below?

I have tried the patch on CURRENT. It looks like it works...

-- 
Mikolaj Golub


--=-=-=
Content-Type: text/x-patch
Content-Disposition: inline; filename=vfs_subr.c.vop_rename_pre.patch

Index: sys/kern/vfs_subr.c
===================================================================
--- sys/kern/vfs_subr.c	(revision 208724)
+++ sys/kern/vfs_subr.c	(working copy)
@@ -3793,9 +3793,10 @@ vop_rename_pre(void *ap)
 	ASSERT_VI_UNLOCKED(a->a_fdvp, "VOP_RENAME");
 
 	/* Check the source (from). */
-	if (a->a_tdvp != a->a_fdvp && a->a_tvp != a->a_fdvp)
+	if (a->a_tdvp != a->a_fdvp && a->a_tdvp->v_mount == a->a_fdvp->v_mount
+		&& a->a_tvp != a->a_fdvp)
 		ASSERT_VOP_UNLOCKED(a->a_fdvp, "vop_rename: fdvp locked");
-	if (a->a_tvp != a->a_fvp)
+	if (a->a_tvp != a->a_fvp && a->a_tvp && a->a_tvp->v_mount == a->a_fvp->v_mount)
 		ASSERT_VOP_UNLOCKED(a->a_fvp, "vop_rename: fvp locked");
 
 	/* Check the target. */

--=-=-=--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86bpbtonma.fsf>