Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 9 Jan 2012 13:35:10 +0000 (UTC)
From:      Ivan Voras <ivoras@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r229855 - stable/9/sys/fs/tmpfs
Message-ID:  <201201091335.q09DZAuZ043011@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ivoras
Date: Mon Jan  9 13:35:10 2012
New Revision: 229855
URL: http://svn.freebsd.org/changeset/base/229855

Log:
  MFC r227822: Avoid panics from recursive rename operations.
  
  PR:		kern/159418

Modified:
  stable/9/sys/fs/tmpfs/tmpfs_vnops.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)

Modified: stable/9/sys/fs/tmpfs/tmpfs_vnops.c
==============================================================================
--- stable/9/sys/fs/tmpfs/tmpfs_vnops.c	Mon Jan  9 12:06:09 2012	(r229854)
+++ stable/9/sys/fs/tmpfs/tmpfs_vnops.c	Mon Jan  9 13:35:10 2012	(r229855)
@@ -965,11 +965,8 @@ tmpfs_rename(struct vop_rename_args *v)
 
 	/* If we need to move the directory between entries, lock the
 	 * source so that we can safely operate on it. */
-	if (tdvp != fdvp) {
-		error = vn_lock(fdvp, LK_EXCLUSIVE | LK_RETRY);
-		if (error != 0)
-			goto out;
-	}
+	if (fdvp != tdvp && fdvp != tvp)
+		vn_lock(fdvp, LK_EXCLUSIVE | LK_RETRY);
 	fdnode = VP_TO_TMPFS_DIR(fdvp);
 	fnode = VP_TO_TMPFS_NODE(fvp);
 	de = tmpfs_dir_lookup(fdnode, fnode, fcnp);
@@ -1143,7 +1140,7 @@ tmpfs_rename(struct vop_rename_args *v)
 	error = 0;
 
 out_locked:
-	if (fdnode != tdnode)
+	if (fdvp != tdvp && fdvp != tvp)
 		VOP_UNLOCK(fdvp, 0);
 
 out:



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