mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-24 17:59:32 +00:00
NFS: Fix old dentry rehash after move
Now that nfs_rename()'s d_move has moved within the RPC task's rpc_call_done
callback, rehashing new_dentry will actually rehash the old dentry's name
in nfs_rename(). d_move() is going to rehash the new dentry for us anyway,
so doing it again here is unnecessary.
Reported-by: Chuck Lever <chuck.lever@oracle.com>
Fixes: 920b4530fb
("NFS: nfs_rename() handle -ERESTARTSYS dentry left behind")
Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
Tested-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
This commit is contained in:
parent
da066f3f03
commit
d4ea7e3c5c
1 changed files with 2 additions and 7 deletions
|
@ -2055,7 +2055,7 @@ int nfs_rename(struct inode *old_dir, struct dentry *old_dentry,
|
||||||
{
|
{
|
||||||
struct inode *old_inode = d_inode(old_dentry);
|
struct inode *old_inode = d_inode(old_dentry);
|
||||||
struct inode *new_inode = d_inode(new_dentry);
|
struct inode *new_inode = d_inode(new_dentry);
|
||||||
struct dentry *dentry = NULL, *rehash = NULL;
|
struct dentry *dentry = NULL;
|
||||||
struct rpc_task *task;
|
struct rpc_task *task;
|
||||||
int error = -EBUSY;
|
int error = -EBUSY;
|
||||||
|
|
||||||
|
@ -2078,10 +2078,8 @@ int nfs_rename(struct inode *old_dir, struct dentry *old_dentry,
|
||||||
* To prevent any new references to the target during the
|
* To prevent any new references to the target during the
|
||||||
* rename, we unhash the dentry in advance.
|
* rename, we unhash the dentry in advance.
|
||||||
*/
|
*/
|
||||||
if (!d_unhashed(new_dentry)) {
|
if (!d_unhashed(new_dentry))
|
||||||
d_drop(new_dentry);
|
d_drop(new_dentry);
|
||||||
rehash = new_dentry;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (d_count(new_dentry) > 2) {
|
if (d_count(new_dentry) > 2) {
|
||||||
int err;
|
int err;
|
||||||
|
@ -2098,7 +2096,6 @@ int nfs_rename(struct inode *old_dir, struct dentry *old_dentry,
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
new_dentry = dentry;
|
new_dentry = dentry;
|
||||||
rehash = NULL;
|
|
||||||
new_inode = NULL;
|
new_inode = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2119,8 +2116,6 @@ int nfs_rename(struct inode *old_dir, struct dentry *old_dentry,
|
||||||
error = task->tk_status;
|
error = task->tk_status;
|
||||||
rpc_put_task(task);
|
rpc_put_task(task);
|
||||||
out:
|
out:
|
||||||
if (rehash)
|
|
||||||
d_rehash(rehash);
|
|
||||||
trace_nfs_rename_exit(old_dir, old_dentry,
|
trace_nfs_rename_exit(old_dir, old_dentry,
|
||||||
new_dir, new_dentry, error);
|
new_dir, new_dentry, error);
|
||||||
/* new dentry created? */
|
/* new dentry created? */
|
||||||
|
|
Loading…
Reference in a new issue