From 4fdc17b2a7f4d9db5b08e0f963d0027f714e4104 Mon Sep 17 00:00:00 2001 From: Trond Myklebust Date: Sat, 14 Jul 2007 15:39:57 -0400 Subject: NFS: Introduce struct nfs_removeargs+nfs_removeres We need a common structure for setting up an unlink() rpc call in order to fix the asynchronous unlink code. Signed-off-by: Trond Myklebust --- fs/nfs/proc.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'fs/nfs/proc.c') diff --git a/fs/nfs/proc.c b/fs/nfs/proc.c index 7be0ee2782cb..3b3eb692e0f4 100644 --- a/fs/nfs/proc.c +++ b/fs/nfs/proc.c @@ -272,14 +272,14 @@ nfs_proc_mknod(struct inode *dir, struct dentry *dentry, struct iattr *sattr, static int nfs_proc_remove(struct inode *dir, struct qstr *name) { - struct nfs_diropargs arg = { - .fh = NFS_FH(dir), - .name = name->name, - .len = name->len + struct nfs_removeargs arg = { + .fh = NFS_FH(dir), + .name.len = name->len, + .name.name = name->name, }; - struct rpc_message msg = { - .rpc_proc = &nfs_procedures[NFSPROC_REMOVE], - .rpc_argp = &arg, + struct rpc_message msg = { + .rpc_proc = &nfs_procedures[NFSPROC_REMOVE], + .rpc_argp = &arg, }; int status; @@ -294,14 +294,14 @@ nfs_proc_remove(struct inode *dir, struct qstr *name) static int nfs_proc_unlink_setup(struct rpc_message *msg, struct dentry *dir, struct qstr *name) { - struct nfs_diropargs *arg; + struct nfs_removeargs *arg; arg = kmalloc(sizeof(*arg), GFP_KERNEL); if (!arg) return -ENOMEM; arg->fh = NFS_FH(dir->d_inode); - arg->name = name->name; - arg->len = name->len; + arg->name.name = name->name; + arg->name.len = name->len; msg->rpc_proc = &nfs_procedures[NFSPROC_REMOVE]; msg->rpc_argp = arg; return 0; -- cgit v1.2.2 From e4eff1a622edd6ab7b73acd5d8763aa2fa3fee49 Mon Sep 17 00:00:00 2001 From: Trond Myklebust Date: Sat, 14 Jul 2007 15:39:58 -0400 Subject: SUNRPC: Clean up the sillyrename code Fix a couple of bugs: - Don't rely on the parent dentry still being valid when the call completes. Fixes a race with shrink_dcache_for_umount_subtree() - Don't remove the file if the filehandle has been labelled as stale. Fix a couple of inefficiencies - Remove the global list of sillyrenamed files. Instead we can cache the sillyrename information in the dentry->d_fsdata - Move common code from unlink_setup/unlink_done into fs/nfs/unlink.c Signed-off-by: Trond Myklebust --- fs/nfs/proc.c | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) (limited to 'fs/nfs/proc.c') diff --git a/fs/nfs/proc.c b/fs/nfs/proc.c index 3b3eb692e0f4..845cdde1d8b7 100644 --- a/fs/nfs/proc.c +++ b/fs/nfs/proc.c @@ -291,32 +291,16 @@ nfs_proc_remove(struct inode *dir, struct qstr *name) return status; } -static int -nfs_proc_unlink_setup(struct rpc_message *msg, struct dentry *dir, struct qstr *name) +static void +nfs_proc_unlink_setup(struct rpc_message *msg, struct inode *dir) { - struct nfs_removeargs *arg; - - arg = kmalloc(sizeof(*arg), GFP_KERNEL); - if (!arg) - return -ENOMEM; - arg->fh = NFS_FH(dir->d_inode); - arg->name.name = name->name; - arg->name.len = name->len; msg->rpc_proc = &nfs_procedures[NFSPROC_REMOVE]; - msg->rpc_argp = arg; - return 0; } -static int -nfs_proc_unlink_done(struct dentry *dir, struct rpc_task *task) +static int nfs_proc_unlink_done(struct rpc_task *task, struct inode *dir) { - struct rpc_message *msg = &task->tk_msg; - - if (msg->rpc_argp) { - nfs_mark_for_revalidate(dir->d_inode); - kfree(msg->rpc_argp); - } - return 0; + nfs_mark_for_revalidate(dir); + return 1; } static int -- cgit v1.2.2