Commit 80a491fd authored by Jeff Layton's avatar Jeff Layton Committed by Trond Myklebust

nfs: convert nfs_rename to use async_rename infrastructure

There isn't much sense in maintaining two separate versions of rename
code. Convert nfs_rename to use the asynchronous rename infrastructure
that nfs_sillyrename uses, and emulate synchronous behavior by having
the task just wait on the reply.
Signed-off-by: default avatarJeff Layton <jlayton@redhat.com>
Tested-by: default avatarAnna Schumaker <Anna.Schumaker@netapp.com>
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
parent 0e862a40
...@@ -1940,6 +1940,7 @@ int nfs_rename(struct inode *old_dir, struct dentry *old_dentry, ...@@ -1940,6 +1940,7 @@ int nfs_rename(struct inode *old_dir, struct dentry *old_dentry,
struct inode *old_inode = old_dentry->d_inode; struct inode *old_inode = old_dentry->d_inode;
struct inode *new_inode = new_dentry->d_inode; struct inode *new_inode = new_dentry->d_inode;
struct dentry *dentry = NULL, *rehash = NULL; struct dentry *dentry = NULL, *rehash = NULL;
struct rpc_task *task;
int error = -EBUSY; int error = -EBUSY;
dfprintk(VFS, "NFS: rename(%pd2 -> %pd2, ct=%d)\n", dfprintk(VFS, "NFS: rename(%pd2 -> %pd2, ct=%d)\n",
...@@ -1987,8 +1988,16 @@ int nfs_rename(struct inode *old_dir, struct dentry *old_dentry, ...@@ -1987,8 +1988,16 @@ int nfs_rename(struct inode *old_dir, struct dentry *old_dentry,
if (new_inode != NULL) if (new_inode != NULL)
NFS_PROTO(new_inode)->return_delegation(new_inode); NFS_PROTO(new_inode)->return_delegation(new_inode);
error = NFS_PROTO(old_dir)->rename(old_dir, &old_dentry->d_name, task = nfs_async_rename(old_dir, new_dir, old_dentry, new_dentry, NULL);
new_dir, &new_dentry->d_name); if (IS_ERR(task)) {
error = PTR_ERR(task);
goto out;
}
error = rpc_wait_for_completion_task(task);
if (error == 0)
error = task->tk_status;
rpc_put_task(task);
nfs_mark_for_revalidate(old_inode); nfs_mark_for_revalidate(old_inode);
out: out:
if (rehash) if (rehash)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment