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>
This commit is contained in:
@@ -349,23 +349,23 @@ out:
|
||||
static int
|
||||
nfs3_proc_remove(struct inode *dir, struct qstr *name)
|
||||
{
|
||||
struct nfs_fattr dir_attr;
|
||||
struct nfs3_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 = &nfs3_procedures[NFS3PROC_REMOVE],
|
||||
.rpc_argp = &arg,
|
||||
.rpc_resp = &dir_attr,
|
||||
struct nfs_removeres res;
|
||||
struct rpc_message msg = {
|
||||
.rpc_proc = &nfs3_procedures[NFS3PROC_REMOVE],
|
||||
.rpc_argp = &arg,
|
||||
.rpc_resp = &res,
|
||||
};
|
||||
int status;
|
||||
|
||||
dprintk("NFS call remove %s\n", name->name);
|
||||
nfs_fattr_init(&dir_attr);
|
||||
nfs_fattr_init(&res.dir_attr);
|
||||
status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0);
|
||||
nfs_post_op_update_inode(dir, &dir_attr);
|
||||
nfs_post_op_update_inode(dir, &res.dir_attr);
|
||||
dprintk("NFS reply remove: %d\n", status);
|
||||
return status;
|
||||
}
|
||||
@@ -374,17 +374,17 @@ static int
|
||||
nfs3_proc_unlink_setup(struct rpc_message *msg, struct dentry *dir, struct qstr *name)
|
||||
{
|
||||
struct unlinkxdr {
|
||||
struct nfs3_diropargs arg;
|
||||
struct nfs_fattr res;
|
||||
struct nfs_removeargs arg;
|
||||
struct nfs_removeres res;
|
||||
} *ptr;
|
||||
|
||||
ptr = kmalloc(sizeof(*ptr), GFP_KERNEL);
|
||||
if (!ptr)
|
||||
return -ENOMEM;
|
||||
ptr->arg.fh = NFS_FH(dir->d_inode);
|
||||
ptr->arg.name = name->name;
|
||||
ptr->arg.len = name->len;
|
||||
nfs_fattr_init(&ptr->res);
|
||||
ptr->arg.name.name = name->name;
|
||||
ptr->arg.name.len = name->len;
|
||||
nfs_fattr_init(&ptr->res.dir_attr);
|
||||
msg->rpc_proc = &nfs3_procedures[NFS3PROC_REMOVE];
|
||||
msg->rpc_argp = &ptr->arg;
|
||||
msg->rpc_resp = &ptr->res;
|
||||
@@ -400,7 +400,7 @@ nfs3_proc_unlink_done(struct dentry *dir, struct rpc_task *task)
|
||||
if (nfs3_async_handle_jukebox(task, dir->d_inode))
|
||||
return 1;
|
||||
if (msg->rpc_argp) {
|
||||
dir_attr = (struct nfs_fattr*)msg->rpc_resp;
|
||||
dir_attr = &((struct nfs_removeres*)msg->rpc_resp)->dir_attr;
|
||||
nfs_post_op_update_inode(dir->d_inode, dir_attr);
|
||||
kfree(msg->rpc_argp);
|
||||
}
|
||||
|
Reference in New Issue
Block a user