Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Mar 2012 18:29:10 +0000 (UTC)
From:      John Baldwin <jhb@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: r233385 - in stable/9/sys: fs/tmpfs i386/conf ufs/ufs
Message-ID:  <201203231829.q2NITAFU088752@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhb
Date: Fri Mar 23 18:29:09 2012
New Revision: 233385
URL: http://svn.freebsd.org/changeset/base/233385

Log:
  MFC 232401:
  Similar to the fixes in 226967 and 226987, purge any name cache entries
  associated with the previous vnode (if any) associated with the target of
  a rename().  Otherwise, a lookup of the target pathname concurrent with a
  rename() could re-add a name cache entry after the namei(RENAME) lookup
  in kern_renameat() had purged the target pathname.

Modified:
  stable/9/sys/fs/tmpfs/tmpfs_vnops.c
  stable/9/sys/ufs/ufs/ufs_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)
  stable/9/sys/fs/   (props changed)
  stable/9/sys/fs/ntfs/   (props changed)
  stable/9/sys/i386/conf/XENHVM   (props changed)

Modified: stable/9/sys/fs/tmpfs/tmpfs_vnops.c
==============================================================================
--- stable/9/sys/fs/tmpfs/tmpfs_vnops.c	Fri Mar 23 18:22:38 2012	(r233384)
+++ stable/9/sys/fs/tmpfs/tmpfs_vnops.c	Fri Mar 23 18:29:09 2012	(r233385)
@@ -1136,6 +1136,8 @@ tmpfs_rename(struct vop_rename_args *v)
 		tmpfs_free_dirent(VFS_TO_TMPFS(tvp->v_mount), de, TRUE);
 	}
 	cache_purge(fvp);
+	if (tvp != NULL)
+		cache_purge(tvp);
 
 	error = 0;
 

Modified: stable/9/sys/ufs/ufs/ufs_vnops.c
==============================================================================
--- stable/9/sys/ufs/ufs/ufs_vnops.c	Fri Mar 23 18:22:38 2012	(r233384)
+++ stable/9/sys/ufs/ufs/ufs_vnops.c	Fri Mar 23 18:29:09 2012	(r233385)
@@ -1534,8 +1534,15 @@ relock:
 	 * ufs_lookup_ino() and then VFS_VGET(), another thread might do a
 	 * normal lookup of the from name just before the VFS_VGET() call,
 	 * causing the cache entry to be re-instantiated.
+	 *
+	 * The same issue also applies to tvp if it exists as
+	 * otherwise we may have a stale name cache entry for the new
+	 * name that references the old i-node if it has other links
+	 * or open file descriptors.
 	 */
 	cache_purge(fvp);
+	if (tvp)
+		cache_purge(tvp);
 
 unlockout:
 	vput(fdvp);



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