diff options
author | jhb <jhb@FreeBSD.org> | 2012-03-02 18:55:19 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2012-03-02 18:55:19 +0000 |
commit | 7bf627fd71f760e5b8625b518deb7bf4f20a4457 (patch) | |
tree | 283357f5fff10643b6db17b4a253ea7b03aef481 | |
parent | 867957a35936d68f21e0b415c035d218626e5372 (diff) | |
download | FreeBSD-src-7bf627fd71f760e5b8625b518deb7bf4f20a4457.zip FreeBSD-src-7bf627fd71f760e5b8625b518deb7bf4f20a4457.tar.gz |
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
-rw-r--r-- | sys/fs/tmpfs/tmpfs_vnops.c | 2 | ||||
-rw-r--r-- | sys/ufs/ufs/ufs_vnops.c | 7 |
2 files changed, 9 insertions, 0 deletions
diff --git a/sys/fs/tmpfs/tmpfs_vnops.c b/sys/fs/tmpfs/tmpfs_vnops.c index 93fea8b..d5cae29 100644 --- a/sys/fs/tmpfs/tmpfs_vnops.c +++ b/sys/fs/tmpfs/tmpfs_vnops.c @@ -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; diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index ab33ef3..02ee1e0 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -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); |