aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4proc.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2007-07-14 15:39:57 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2007-07-19 15:21:39 -0400
commit4fdc17b2a7f4d9db5b08e0f963d0027f714e4104 (patch)
tree502aacc94e06962c2f3352b6ced1146245158be1 /fs/nfs/nfs4proc.c
parent3062c532ad410fe0e8320566fe2879a396be6701 (diff)
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 <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs/nfs4proc.c')
-rw-r--r--fs/nfs/nfs4proc.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 7ead63e065ab..23dc25dbc6fa 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -1925,28 +1925,27 @@ out:
1925static int _nfs4_proc_remove(struct inode *dir, struct qstr *name) 1925static int _nfs4_proc_remove(struct inode *dir, struct qstr *name)
1926{ 1926{
1927 struct nfs_server *server = NFS_SERVER(dir); 1927 struct nfs_server *server = NFS_SERVER(dir);
1928 struct nfs4_remove_arg args = { 1928 struct nfs_removeargs args = {
1929 .fh = NFS_FH(dir), 1929 .fh = NFS_FH(dir),
1930 .name = name, 1930 .name.len = name->len,
1931 .name.name = name->name,
1931 .bitmask = server->attr_bitmask, 1932 .bitmask = server->attr_bitmask,
1932 }; 1933 };
1933 struct nfs_fattr dir_attr; 1934 struct nfs_removeres res = {
1934 struct nfs4_remove_res res = {
1935 .server = server, 1935 .server = server,
1936 .dir_attr = &dir_attr,
1937 }; 1936 };
1938 struct rpc_message msg = { 1937 struct rpc_message msg = {
1939 .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_REMOVE], 1938 .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_REMOVE],
1940 .rpc_argp = &args, 1939 .rpc_argp = &args,
1941 .rpc_resp = &res, 1940 .rpc_resp = &res,
1942 }; 1941 };
1943 int status; 1942 int status;
1944 1943
1945 nfs_fattr_init(res.dir_attr); 1944 nfs_fattr_init(&res.dir_attr);
1946 status = rpc_call_sync(server->client, &msg, 0); 1945 status = rpc_call_sync(server->client, &msg, 0);
1947 if (status == 0) { 1946 if (status == 0) {
1948 update_changeattr(dir, &res.cinfo); 1947 update_changeattr(dir, &res.cinfo);
1949 nfs_post_op_update_inode(dir, res.dir_attr); 1948 nfs_post_op_update_inode(dir, &res.dir_attr);
1950 } 1949 }
1951 return status; 1950 return status;
1952} 1951}
@@ -1964,9 +1963,8 @@ static int nfs4_proc_remove(struct inode *dir, struct qstr *name)
1964} 1963}
1965 1964
1966struct unlink_desc { 1965struct unlink_desc {
1967 struct nfs4_remove_arg args; 1966 struct nfs_removeargs args;
1968 struct nfs4_remove_res res; 1967 struct nfs_removeres res;
1969 struct nfs_fattr dir_attr;
1970}; 1968};
1971 1969
1972static int nfs4_proc_unlink_setup(struct rpc_message *msg, struct dentry *dir, 1970static int nfs4_proc_unlink_setup(struct rpc_message *msg, struct dentry *dir,
@@ -1980,10 +1978,11 @@ static int nfs4_proc_unlink_setup(struct rpc_message *msg, struct dentry *dir,
1980 return -ENOMEM; 1978 return -ENOMEM;
1981 1979
1982 up->args.fh = NFS_FH(dir->d_inode); 1980 up->args.fh = NFS_FH(dir->d_inode);
1983 up->args.name = name; 1981 up->args.name.len = name->len;
1982 up->args.name.name = name->name;
1984 up->args.bitmask = server->attr_bitmask; 1983 up->args.bitmask = server->attr_bitmask;
1985 up->res.server = server; 1984 up->res.server = server;
1986 up->res.dir_attr = &up->dir_attr; 1985 nfs_fattr_init(&up->res.dir_attr);
1987 1986
1988 msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_REMOVE]; 1987 msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_REMOVE];
1989 msg->rpc_argp = &up->args; 1988 msg->rpc_argp = &up->args;
@@ -1999,7 +1998,7 @@ static int nfs4_proc_unlink_done(struct dentry *dir, struct rpc_task *task)
1999 if (msg->rpc_resp != NULL) { 1998 if (msg->rpc_resp != NULL) {
2000 up = container_of(msg->rpc_resp, struct unlink_desc, res); 1999 up = container_of(msg->rpc_resp, struct unlink_desc, res);
2001 update_changeattr(dir->d_inode, &up->res.cinfo); 2000 update_changeattr(dir->d_inode, &up->res.cinfo);
2002 nfs_post_op_update_inode(dir->d_inode, up->res.dir_attr); 2001 nfs_post_op_update_inode(dir->d_inode, &up->res.dir_attr);
2003 kfree(up); 2002 kfree(up);
2004 msg->rpc_resp = NULL; 2003 msg->rpc_resp = NULL;
2005 msg->rpc_argp = NULL; 2004 msg->rpc_argp = NULL;