aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs3proc.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/nfs3proc.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/nfs3proc.c')
-rw-r--r--fs/nfs/nfs3proc.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c
index 814d886b6aa4..eac07f2c99dd 100644
--- a/fs/nfs/nfs3proc.c
+++ b/fs/nfs/nfs3proc.c
@@ -349,23 +349,23 @@ out:
349static int 349static int
350nfs3_proc_remove(struct inode *dir, struct qstr *name) 350nfs3_proc_remove(struct inode *dir, struct qstr *name)
351{ 351{
352 struct nfs_fattr dir_attr; 352 struct nfs_removeargs arg = {
353 struct nfs3_diropargs arg = { 353 .fh = NFS_FH(dir),
354 .fh = NFS_FH(dir), 354 .name.len = name->len,
355 .name = name->name, 355 .name.name = name->name,
356 .len = name->len
357 }; 356 };
358 struct rpc_message msg = { 357 struct nfs_removeres res;
359 .rpc_proc = &nfs3_procedures[NFS3PROC_REMOVE], 358 struct rpc_message msg = {
360 .rpc_argp = &arg, 359 .rpc_proc = &nfs3_procedures[NFS3PROC_REMOVE],
361 .rpc_resp = &dir_attr, 360 .rpc_argp = &arg,
361 .rpc_resp = &res,
362 }; 362 };
363 int status; 363 int status;
364 364
365 dprintk("NFS call remove %s\n", name->name); 365 dprintk("NFS call remove %s\n", name->name);
366 nfs_fattr_init(&dir_attr); 366 nfs_fattr_init(&res.dir_attr);
367 status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0); 367 status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0);
368 nfs_post_op_update_inode(dir, &dir_attr); 368 nfs_post_op_update_inode(dir, &res.dir_attr);
369 dprintk("NFS reply remove: %d\n", status); 369 dprintk("NFS reply remove: %d\n", status);
370 return status; 370 return status;
371} 371}
@@ -374,17 +374,17 @@ static int
374nfs3_proc_unlink_setup(struct rpc_message *msg, struct dentry *dir, struct qstr *name) 374nfs3_proc_unlink_setup(struct rpc_message *msg, struct dentry *dir, struct qstr *name)
375{ 375{
376 struct unlinkxdr { 376 struct unlinkxdr {
377 struct nfs3_diropargs arg; 377 struct nfs_removeargs arg;
378 struct nfs_fattr res; 378 struct nfs_removeres res;
379 } *ptr; 379 } *ptr;
380 380
381 ptr = kmalloc(sizeof(*ptr), GFP_KERNEL); 381 ptr = kmalloc(sizeof(*ptr), GFP_KERNEL);
382 if (!ptr) 382 if (!ptr)
383 return -ENOMEM; 383 return -ENOMEM;
384 ptr->arg.fh = NFS_FH(dir->d_inode); 384 ptr->arg.fh = NFS_FH(dir->d_inode);
385 ptr->arg.name = name->name; 385 ptr->arg.name.name = name->name;
386 ptr->arg.len = name->len; 386 ptr->arg.name.len = name->len;
387 nfs_fattr_init(&ptr->res); 387 nfs_fattr_init(&ptr->res.dir_attr);
388 msg->rpc_proc = &nfs3_procedures[NFS3PROC_REMOVE]; 388 msg->rpc_proc = &nfs3_procedures[NFS3PROC_REMOVE];
389 msg->rpc_argp = &ptr->arg; 389 msg->rpc_argp = &ptr->arg;
390 msg->rpc_resp = &ptr->res; 390 msg->rpc_resp = &ptr->res;
@@ -400,7 +400,7 @@ nfs3_proc_unlink_done(struct dentry *dir, struct rpc_task *task)
400 if (nfs3_async_handle_jukebox(task, dir->d_inode)) 400 if (nfs3_async_handle_jukebox(task, dir->d_inode))
401 return 1; 401 return 1;
402 if (msg->rpc_argp) { 402 if (msg->rpc_argp) {
403 dir_attr = (struct nfs_fattr*)msg->rpc_resp; 403 dir_attr = &((struct nfs_removeres*)msg->rpc_resp)->dir_attr;
404 nfs_post_op_update_inode(dir->d_inode, dir_attr); 404 nfs_post_op_update_inode(dir->d_inode, dir_attr);
405 kfree(msg->rpc_argp); 405 kfree(msg->rpc_argp);
406 } 406 }