diff options
author | Jeff Layton <jlayton@redhat.com> | 2010-09-17 17:31:57 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2010-09-17 17:31:57 -0400 |
commit | d3d4152a5d59af9e13a73efa9e9c24383fbe307f (patch) | |
tree | 552ea5586bb64f8fef93825c72e88b9248d02b79 /fs/nfs/proc.c | |
parent | 779c51795bfb35c2403c924b9de90ca9356bc693 (diff) |
nfs: make sillyrename an async operation
A synchronous rename can be interrupted by a SIGKILL. If that happens
during a sillyrename operation, it's possible for the rename call to
be sent to the server, but the task exits before processing the
reply. If this happens, the sillyrenamed file won't get cleaned up
during nfs_dentry_iput and the server is left with a dangling .nfs* file
hanging around.
Fix this problem by turning sillyrename into an asynchronous operation
and have the task doing the sillyrename just wait on the reply. If the
task is killed before the sillyrename completes, it'll still proceed
to completion.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Reviewed-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/proc.c')
-rw-r--r-- | fs/nfs/proc.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/fs/nfs/proc.c b/fs/nfs/proc.c index 0aff10c3bbce..e5e84aa2af17 100644 --- a/fs/nfs/proc.c +++ b/fs/nfs/proc.c | |||
@@ -365,6 +365,23 @@ static int nfs_proc_unlink_done(struct rpc_task *task, struct inode *dir) | |||
365 | return 1; | 365 | return 1; |
366 | } | 366 | } |
367 | 367 | ||
368 | static void | ||
369 | nfs_proc_rename_setup(struct rpc_message *msg, struct inode *dir) | ||
370 | { | ||
371 | msg->rpc_proc = &nfs_procedures[NFSPROC_RENAME]; | ||
372 | } | ||
373 | |||
374 | static int | ||
375 | nfs_proc_rename_done(struct rpc_task *task, struct inode *old_dir, | ||
376 | struct inode *new_dir) | ||
377 | { | ||
378 | if (nfs_async_handle_expired_key(task)) | ||
379 | return 0; | ||
380 | nfs_mark_for_revalidate(old_dir); | ||
381 | nfs_mark_for_revalidate(new_dir); | ||
382 | return 1; | ||
383 | } | ||
384 | |||
368 | static int | 385 | static int |
369 | nfs_proc_rename(struct inode *old_dir, struct qstr *old_name, | 386 | nfs_proc_rename(struct inode *old_dir, struct qstr *old_name, |
370 | struct inode *new_dir, struct qstr *new_name) | 387 | struct inode *new_dir, struct qstr *new_name) |
@@ -703,6 +720,8 @@ const struct nfs_rpc_ops nfs_v2_clientops = { | |||
703 | .unlink_setup = nfs_proc_unlink_setup, | 720 | .unlink_setup = nfs_proc_unlink_setup, |
704 | .unlink_done = nfs_proc_unlink_done, | 721 | .unlink_done = nfs_proc_unlink_done, |
705 | .rename = nfs_proc_rename, | 722 | .rename = nfs_proc_rename, |
723 | .rename_setup = nfs_proc_rename_setup, | ||
724 | .rename_done = nfs_proc_rename_done, | ||
706 | .link = nfs_proc_link, | 725 | .link = nfs_proc_link, |
707 | .symlink = nfs_proc_symlink, | 726 | .symlink = nfs_proc_symlink, |
708 | .mkdir = nfs_proc_mkdir, | 727 | .mkdir = nfs_proc_mkdir, |