Commit d346890b authored by Trond Myklebust's avatar Trond Myklebust

NFS: Reduce stack footprint of nfs_proc_remove()

Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 3b14d654
...@@ -406,12 +406,17 @@ nfs3_proc_remove(struct inode *dir, struct qstr *name) ...@@ -406,12 +406,17 @@ nfs3_proc_remove(struct inode *dir, struct qstr *name)
.rpc_argp = &arg, .rpc_argp = &arg,
.rpc_resp = &res, .rpc_resp = &res,
}; };
int status; int status = -ENOMEM;
dprintk("NFS call remove %s\n", name->name); dprintk("NFS call remove %s\n", name->name);
nfs_fattr_init(&res.dir_attr); res.dir_attr = nfs_alloc_fattr();
if (res.dir_attr == NULL)
goto out;
status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0); status = rpc_call_sync(NFS_CLIENT(dir), &msg, 0);
nfs_post_op_update_inode(dir, &res.dir_attr); nfs_post_op_update_inode(dir, res.dir_attr);
nfs_free_fattr(res.dir_attr);
out:
dprintk("NFS reply remove: %d\n", status); dprintk("NFS reply remove: %d\n", status);
return status; return status;
} }
...@@ -429,7 +434,7 @@ nfs3_proc_unlink_done(struct rpc_task *task, struct inode *dir) ...@@ -429,7 +434,7 @@ nfs3_proc_unlink_done(struct rpc_task *task, struct inode *dir)
if (nfs3_async_handle_jukebox(task, dir)) if (nfs3_async_handle_jukebox(task, dir))
return 0; return 0;
res = task->tk_msg.rpc_resp; res = task->tk_msg.rpc_resp;
nfs_post_op_update_inode(dir, &res->dir_attr); nfs_post_op_update_inode(dir, res->dir_attr);
return 1; return 1;
} }
......
...@@ -762,7 +762,7 @@ nfs3_xdr_wccstat(struct rpc_rqst *req, __be32 *p, struct nfs_fattr *fattr) ...@@ -762,7 +762,7 @@ nfs3_xdr_wccstat(struct rpc_rqst *req, __be32 *p, struct nfs_fattr *fattr)
static int static int
nfs3_xdr_removeres(struct rpc_rqst *req, __be32 *p, struct nfs_removeres *res) nfs3_xdr_removeres(struct rpc_rqst *req, __be32 *p, struct nfs_removeres *res)
{ {
return nfs3_xdr_wccstat(req, p, &res->dir_attr); return nfs3_xdr_wccstat(req, p, res->dir_attr);
} }
/* /*
......
...@@ -2599,14 +2599,19 @@ static int _nfs4_proc_remove(struct inode *dir, struct qstr *name) ...@@ -2599,14 +2599,19 @@ static int _nfs4_proc_remove(struct inode *dir, struct qstr *name)
.rpc_argp = &args, .rpc_argp = &args,
.rpc_resp = &res, .rpc_resp = &res,
}; };
int status; int status = -ENOMEM;
res.dir_attr = nfs_alloc_fattr();
if (res.dir_attr == NULL)
goto out;
nfs_fattr_init(&res.dir_attr);
status = nfs4_call_sync(server, &msg, &args, &res, 1); status = nfs4_call_sync(server, &msg, &args, &res, 1);
if (status == 0) { if (status == 0) {
update_changeattr(dir, &res.cinfo); update_changeattr(dir, &res.cinfo);
nfs_post_op_update_inode(dir, &res.dir_attr); nfs_post_op_update_inode(dir, res.dir_attr);
} }
nfs_free_fattr(res.dir_attr);
out:
return status; return status;
} }
...@@ -2641,7 +2646,7 @@ static int nfs4_proc_unlink_done(struct rpc_task *task, struct inode *dir) ...@@ -2641,7 +2646,7 @@ static int nfs4_proc_unlink_done(struct rpc_task *task, struct inode *dir)
if (nfs4_async_handle_error(task, res->server, NULL) == -EAGAIN) if (nfs4_async_handle_error(task, res->server, NULL) == -EAGAIN)
return 0; return 0;
update_changeattr(dir, &res->cinfo); update_changeattr(dir, &res->cinfo);
nfs_post_op_update_inode(dir, &res->dir_attr); nfs_post_op_update_inode(dir, res->dir_attr);
return 1; return 1;
} }
......
...@@ -4815,7 +4815,7 @@ static int nfs4_xdr_dec_remove(struct rpc_rqst *rqstp, __be32 *p, struct nfs_rem ...@@ -4815,7 +4815,7 @@ static int nfs4_xdr_dec_remove(struct rpc_rqst *rqstp, __be32 *p, struct nfs_rem
goto out; goto out;
if ((status = decode_remove(&xdr, &res->cinfo)) != 0) if ((status = decode_remove(&xdr, &res->cinfo)) != 0)
goto out; goto out;
decode_getfattr(&xdr, &res->dir_attr, res->server, decode_getfattr(&xdr, res->dir_attr, res->server,
!RPC_IS_ASYNC(rqstp->rq_task)); !RPC_IS_ASYNC(rqstp->rq_task));
out: out:
return status; return status;
......
...@@ -23,6 +23,7 @@ struct nfs_unlinkdata { ...@@ -23,6 +23,7 @@ struct nfs_unlinkdata {
struct nfs_removeres res; struct nfs_removeres res;
struct inode *dir; struct inode *dir;
struct rpc_cred *cred; struct rpc_cred *cred;
struct nfs_fattr dir_attr;
}; };
/** /**
...@@ -169,7 +170,7 @@ static int nfs_do_call_unlink(struct dentry *parent, struct inode *dir, struct n ...@@ -169,7 +170,7 @@ static int nfs_do_call_unlink(struct dentry *parent, struct inode *dir, struct n
} }
nfs_sb_active(dir->i_sb); nfs_sb_active(dir->i_sb);
data->args.fh = NFS_FH(dir); data->args.fh = NFS_FH(dir);
nfs_fattr_init(&data->res.dir_attr); nfs_fattr_init(data->res.dir_attr);
NFS_PROTO(dir)->unlink_setup(&msg, dir); NFS_PROTO(dir)->unlink_setup(&msg, dir);
...@@ -259,6 +260,7 @@ nfs_async_unlink(struct inode *dir, struct dentry *dentry) ...@@ -259,6 +260,7 @@ nfs_async_unlink(struct inode *dir, struct dentry *dentry)
goto out_free; goto out_free;
} }
data->res.seq_res.sr_slotid = NFS4_MAX_SLOT_TABLE; data->res.seq_res.sr_slotid = NFS4_MAX_SLOT_TABLE;
data->res.dir_attr = &data->dir_attr;
status = -EBUSY; status = -EBUSY;
spin_lock(&dentry->d_lock); spin_lock(&dentry->d_lock);
......
...@@ -386,8 +386,8 @@ struct nfs_removeargs { ...@@ -386,8 +386,8 @@ struct nfs_removeargs {
struct nfs_removeres { struct nfs_removeres {
const struct nfs_server *server; const struct nfs_server *server;
struct nfs_fattr *dir_attr;
struct nfs4_change_info cinfo; struct nfs4_change_info cinfo;
struct nfs_fattr dir_attr;
struct nfs4_sequence_res seq_res; struct nfs4_sequence_res seq_res;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment