diff options
author | Jeff Layton <jlayton@redhat.com> | 2014-03-17 07:06:56 -0400 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@primarydata.com> | 2014-03-17 15:14:17 -0400 |
commit | 80a491fd40770db143d250772778ff4f89b807ef (patch) | |
tree | 1086dc1865bab7fb3934d587742976e647b25895 /fs/nfs | |
parent | 0e862a405185b28e775eeeae6b04bfa39724b1ad (diff) |
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: Jeff Layton <jlayton@redhat.com>
Tested-by: Anna Schumaker <Anna.Schumaker@netapp.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/dir.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index c8e48c26418b..b31f5d2400bd 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c | |||
@@ -1940,6 +1940,7 @@ int nfs_rename(struct inode *old_dir, struct dentry *old_dentry, | |||
1940 | struct inode *old_inode = old_dentry->d_inode; | 1940 | struct inode *old_inode = old_dentry->d_inode; |
1941 | struct inode *new_inode = new_dentry->d_inode; | 1941 | struct inode *new_inode = new_dentry->d_inode; |
1942 | struct dentry *dentry = NULL, *rehash = NULL; | 1942 | struct dentry *dentry = NULL, *rehash = NULL; |
1943 | struct rpc_task *task; | ||
1943 | int error = -EBUSY; | 1944 | int error = -EBUSY; |
1944 | 1945 | ||
1945 | dfprintk(VFS, "NFS: rename(%pd2 -> %pd2, ct=%d)\n", | 1946 | 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 | if (new_inode != NULL) | 1988 | if (new_inode != NULL) |
1988 | NFS_PROTO(new_inode)->return_delegation(new_inode); | 1989 | NFS_PROTO(new_inode)->return_delegation(new_inode); |
1989 | 1990 | ||
1990 | error = NFS_PROTO(old_dir)->rename(old_dir, &old_dentry->d_name, | 1991 | task = nfs_async_rename(old_dir, new_dir, old_dentry, new_dentry, NULL); |
1991 | new_dir, &new_dentry->d_name); | 1992 | if (IS_ERR(task)) { |
1993 | error = PTR_ERR(task); | ||
1994 | goto out; | ||
1995 | } | ||
1996 | |||
1997 | error = rpc_wait_for_completion_task(task); | ||
1998 | if (error == 0) | ||
1999 | error = task->tk_status; | ||
2000 | rpc_put_task(task); | ||
1992 | nfs_mark_for_revalidate(old_inode); | 2001 | nfs_mark_for_revalidate(old_inode); |
1993 | out: | 2002 | out: |
1994 | if (rehash) | 2003 | if (rehash) |