From owner-svn-src-head@FreeBSD.ORG Fri Mar 2 18:55:19 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id EE953106566C; Fri, 2 Mar 2012 18:55:19 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D7B0A8FC21; Fri, 2 Mar 2012 18:55:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q22ItJFL042971; Fri, 2 Mar 2012 18:55:19 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q22ItJtT042968; Fri, 2 Mar 2012 18:55:19 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201203021855.q22ItJtT042968@svn.freebsd.org> From: John Baldwin Date: Fri, 2 Mar 2012 18:55:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232401 - in head/sys: fs/tmpfs ufs/ufs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Mar 2012 18:55:20 -0000 Author: jhb Date: Fri Mar 2 18:55:19 2012 New Revision: 232401 URL: http://svn.freebsd.org/changeset/base/232401 Log: 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. MFC after: 2 weeks Modified: head/sys/fs/tmpfs/tmpfs_vnops.c head/sys/ufs/ufs/ufs_vnops.c Modified: head/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- head/sys/fs/tmpfs/tmpfs_vnops.c Fri Mar 2 18:18:14 2012 (r232400) +++ head/sys/fs/tmpfs/tmpfs_vnops.c Fri Mar 2 18:55:19 2012 (r232401) @@ -1135,6 +1135,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: head/sys/ufs/ufs/ufs_vnops.c ============================================================================== --- head/sys/ufs/ufs/ufs_vnops.c Fri Mar 2 18:18:14 2012 (r232400) +++ head/sys/ufs/ufs/ufs_vnops.c Fri Mar 2 18:55:19 2012 (r232401) @@ -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);