aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4proc.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2007-07-14 15:39:58 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2007-07-19 15:21:39 -0400
commite4eff1a622edd6ab7b73acd5d8763aa2fa3fee49 (patch)
tree257d6675733d4af122a77054281e1d7d5062d904 /fs/nfs/nfs4proc.c
parent4fdc17b2a7f4d9db5b08e0f963d0027f714e4104 (diff)
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 <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4proc.c')
-rw-r--r--fs/nfs/nfs4proc.c50
1 files changed, 14 insertions, 36 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 23dc25dbc6fa..6ca2795ccd9c 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -1962,48 +1962,26 @@ static int nfs4_proc_remove(struct inode *dir, struct qstr *name)
1962 return err; 1962 return err;
1963} 1963}
1964 1964
1965struct unlink_desc { 1965static void nfs4_proc_unlink_setup(struct rpc_message *msg, struct inode *dir)
1966 struct nfs_removeargs args;
1967 struct nfs_removeres res;
1968};
1969
1970static int nfs4_proc_unlink_setup(struct rpc_message *msg, struct dentry *dir,
1971 struct qstr *name)
1972{ 1966{
1973 struct nfs_server *server = NFS_SERVER(dir->d_inode); 1967 struct nfs_server *server = NFS_SERVER(dir);
1974 struct unlink_desc *up; 1968 struct nfs_removeargs *args = msg->rpc_argp;
1969 struct nfs_removeres *res = msg->rpc_resp;
1975 1970
1976 up = kmalloc(sizeof(*up), GFP_KERNEL); 1971 args->bitmask = server->attr_bitmask;
1977 if (!up) 1972 res->server = server;
1978 return -ENOMEM;
1979
1980 up->args.fh = NFS_FH(dir->d_inode);
1981 up->args.name.len = name->len;
1982 up->args.name.name = name->name;
1983 up->args.bitmask = server->attr_bitmask;
1984 up->res.server = server;
1985 nfs_fattr_init(&up->res.dir_attr);
1986
1987 msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_REMOVE]; 1973 msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_REMOVE];
1988 msg->rpc_argp = &up->args;
1989 msg->rpc_resp = &up->res;
1990 return 0;
1991} 1974}
1992 1975
1993static int nfs4_proc_unlink_done(struct dentry *dir, struct rpc_task *task) 1976static int nfs4_proc_unlink_done(struct rpc_task *task, struct inode *dir)
1994{ 1977{
1995 struct rpc_message *msg = &task->tk_msg; 1978 struct nfs_removeres *res = task->tk_msg.rpc_resp;
1996 struct unlink_desc *up; 1979
1997 1980 if (nfs4_async_handle_error(task, res->server) == -EAGAIN)
1998 if (msg->rpc_resp != NULL) { 1981 return 0;
1999 up = container_of(msg->rpc_resp, struct unlink_desc, res); 1982 update_changeattr(dir, &res->cinfo);
2000 update_changeattr(dir->d_inode, &up->res.cinfo); 1983 nfs_post_op_update_inode(dir, &res->dir_attr);
2001 nfs_post_op_update_inode(dir->d_inode, &up->res.dir_attr); 1984 return 1;
2002 kfree(up);
2003 msg->rpc_resp = NULL;
2004 msg->rpc_argp = NULL;
2005 }
2006 return 0;
2007} 1985}
2008 1986
2009static int _nfs4_proc_rename(struct inode *old_dir, struct qstr *old_name, 1987static int _nfs4_proc_rename(struct inode *old_dir, struct qstr *old_name,