linux25-rename-rehash-not-move-20050116

not tested yet
This commit is contained in:
Chas Williams 2005-01-16 16:36:53 +00:00 committed by Derrick Brashear
parent 9e81a8e4c2
commit 8db7eb1876

View File

@ -1333,6 +1333,8 @@ afs_linux_rename(struct inode *oldip, struct dentry *olddp,
const char *newname = newdp->d_name.name;
#if defined(AFS_LINUX26_ENV)
struct dentry *rehash = NULL;
lock_kernel();
#endif
/* Remove old and new entries from name hash. New one will change below.
@ -1341,10 +1343,17 @@ afs_linux_rename(struct inode *oldip, struct dentry *olddp,
* cases. Let another lookup put things right, if need be.
*/
#if defined(AFS_LINUX26_ENV)
if (!d_unhashed(olddp))
d_drop(olddp);
if (!d_unhashed(newdp))
if (!d_unhashed(newdp)) {
d_drop(newdp);
rehash = newdp;
}
#ifdef maybe
if (atomic_read(&olddp->d_count) > 1) {
printk("afs_linux_rename::shrink_dcache_parent()\n");
shrink_dcache_parent(olddp);
}
#endif
#else
if (!list_empty(&olddp->d_hash))
d_drop(olddp);
@ -1355,13 +1364,11 @@ afs_linux_rename(struct inode *oldip, struct dentry *olddp,
code = afs_rename(ITOAFS(oldip), oldname, ITOAFS(newip), newname, credp);
AFS_GUNLOCK();
if (!code) {
/* update time so it doesn't expire immediately */
newdp->d_time = jiffies;
d_move(olddp, newdp);
}
#if defined(AFS_LINUX26_ENV)
if (rehash)
d_rehash(rehash);
unlock_kernel();
#endif