Commit d9afbd1b authored by Trond Myklebust's avatar Trond Myklebust

NFSv4.1: Simplify the sequence setup

Nobody calls nfs4_setup_sequence or nfs41_setup_sequence without
also calling rpc_call_start() on success. This commit therefore
folds the rpc_call_start call into nfs41_setup_sequence().
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 6ba7db34
...@@ -273,6 +273,7 @@ static inline int nfs4_setup_sequence(const struct nfs_server *server, ...@@ -273,6 +273,7 @@ static inline int nfs4_setup_sequence(const struct nfs_server *server,
struct nfs4_sequence_args *args, struct nfs4_sequence_res *res, struct nfs4_sequence_args *args, struct nfs4_sequence_res *res,
struct rpc_task *task) struct rpc_task *task)
{ {
rpc_call_start(task);
return 0; return 0;
} }
......
...@@ -307,12 +307,10 @@ static void filelayout_read_prepare(struct rpc_task *task, void *data) ...@@ -307,12 +307,10 @@ static void filelayout_read_prepare(struct rpc_task *task, void *data)
} }
rdata->read_done_cb = filelayout_read_done_cb; rdata->read_done_cb = filelayout_read_done_cb;
if (nfs41_setup_sequence(rdata->ds_clp->cl_session, nfs41_setup_sequence(rdata->ds_clp->cl_session,
&rdata->args.seq_args, &rdata->res.seq_res, &rdata->args.seq_args,
task)) &rdata->res.seq_res,
return; task);
rpc_call_start(task);
} }
static void filelayout_read_call_done(struct rpc_task *task, void *data) static void filelayout_read_call_done(struct rpc_task *task, void *data)
...@@ -409,12 +407,10 @@ static void filelayout_write_prepare(struct rpc_task *task, void *data) ...@@ -409,12 +407,10 @@ static void filelayout_write_prepare(struct rpc_task *task, void *data)
rpc_exit(task, 0); rpc_exit(task, 0);
return; return;
} }
if (nfs41_setup_sequence(wdata->ds_clp->cl_session, nfs41_setup_sequence(wdata->ds_clp->cl_session,
&wdata->args.seq_args, &wdata->res.seq_res, &wdata->args.seq_args,
task)) &wdata->res.seq_res,
return; task);
rpc_call_start(task);
} }
static void filelayout_write_call_done(struct rpc_task *task, void *data) static void filelayout_write_call_done(struct rpc_task *task, void *data)
...@@ -450,12 +446,10 @@ static void filelayout_commit_prepare(struct rpc_task *task, void *data) ...@@ -450,12 +446,10 @@ static void filelayout_commit_prepare(struct rpc_task *task, void *data)
{ {
struct nfs_commit_data *wdata = data; struct nfs_commit_data *wdata = data;
if (nfs41_setup_sequence(wdata->ds_clp->cl_session, nfs41_setup_sequence(wdata->ds_clp->cl_session,
&wdata->args.seq_args, &wdata->res.seq_res, &wdata->args.seq_args,
task)) &wdata->res.seq_res,
return; task);
rpc_call_start(task);
} }
static void filelayout_write_commit_done(struct rpc_task *task, void *data) static void filelayout_write_commit_done(struct rpc_task *task, void *data)
......
...@@ -513,7 +513,7 @@ int nfs41_setup_sequence(struct nfs4_session *session, ...@@ -513,7 +513,7 @@ int nfs41_setup_sequence(struct nfs4_session *session,
dprintk("--> %s\n", __func__); dprintk("--> %s\n", __func__);
/* slot already allocated? */ /* slot already allocated? */
if (res->sr_slot != NULL) if (res->sr_slot != NULL)
return 0; goto out_success;
tbl = &session->fc_slot_table; tbl = &session->fc_slot_table;
...@@ -563,6 +563,8 @@ int nfs41_setup_sequence(struct nfs4_session *session, ...@@ -563,6 +563,8 @@ int nfs41_setup_sequence(struct nfs4_session *session,
* set to 1 if an rpc level failure occurs. * set to 1 if an rpc level failure occurs.
*/ */
res->sr_status = 1; res->sr_status = 1;
out_success:
rpc_call_start(task);
return 0; return 0;
} }
EXPORT_SYMBOL_GPL(nfs41_setup_sequence); EXPORT_SYMBOL_GPL(nfs41_setup_sequence);
...@@ -575,8 +577,10 @@ int nfs4_setup_sequence(const struct nfs_server *server, ...@@ -575,8 +577,10 @@ int nfs4_setup_sequence(const struct nfs_server *server,
struct nfs4_session *session = nfs4_get_session(server); struct nfs4_session *session = nfs4_get_session(server);
int ret = 0; int ret = 0;
if (session == NULL) if (session == NULL) {
rpc_call_start(task);
goto out; goto out;
}
dprintk("--> %s clp %p session %p sr_slot %d\n", dprintk("--> %s clp %p session %p sr_slot %d\n",
__func__, session->clp, session, res->sr_slot ? __func__, session->clp, session, res->sr_slot ?
...@@ -601,10 +605,7 @@ static void nfs41_call_sync_prepare(struct rpc_task *task, void *calldata) ...@@ -601,10 +605,7 @@ static void nfs41_call_sync_prepare(struct rpc_task *task, void *calldata)
dprintk("--> %s data->seq_server %p\n", __func__, data->seq_server); dprintk("--> %s data->seq_server %p\n", __func__, data->seq_server);
if (nfs41_setup_sequence(session, data->seq_args, nfs41_setup_sequence(session, data->seq_args, data->seq_res, task);
data->seq_res, task))
return;
rpc_call_start(task);
} }
static void nfs41_call_priv_sync_prepare(struct rpc_task *task, void *calldata) static void nfs41_call_priv_sync_prepare(struct rpc_task *task, void *calldata)
...@@ -1485,8 +1486,6 @@ static void nfs4_open_prepare(struct rpc_task *task, void *calldata) ...@@ -1485,8 +1486,6 @@ static void nfs4_open_prepare(struct rpc_task *task, void *calldata)
&data->o_res.seq_res, &data->o_res.seq_res,
task) != 0) task) != 0)
nfs_release_seqid(data->o_arg.seqid); nfs_release_seqid(data->o_arg.seqid);
else
rpc_call_start(task);
return; return;
unlock_no_action: unlock_no_action:
rcu_read_unlock(); rcu_read_unlock();
...@@ -2192,8 +2191,6 @@ static void nfs4_close_prepare(struct rpc_task *task, void *data) ...@@ -2192,8 +2191,6 @@ static void nfs4_close_prepare(struct rpc_task *task, void *data)
&calldata->res.seq_res, &calldata->res.seq_res,
task) != 0) task) != 0)
nfs_release_seqid(calldata->arg.seqid); nfs_release_seqid(calldata->arg.seqid);
else
rpc_call_start(task);
out: out:
dprintk("%s: done!\n", __func__); dprintk("%s: done!\n", __func__);
} }
...@@ -2932,12 +2929,10 @@ static void nfs4_proc_unlink_setup(struct rpc_message *msg, struct inode *dir) ...@@ -2932,12 +2929,10 @@ static void nfs4_proc_unlink_setup(struct rpc_message *msg, struct inode *dir)
static void nfs4_proc_unlink_rpc_prepare(struct rpc_task *task, struct nfs_unlinkdata *data) static void nfs4_proc_unlink_rpc_prepare(struct rpc_task *task, struct nfs_unlinkdata *data)
{ {
if (nfs4_setup_sequence(NFS_SERVER(data->dir), nfs4_setup_sequence(NFS_SERVER(data->dir),
&data->args.seq_args, &data->args.seq_args,
&data->res.seq_res, &data->res.seq_res,
task)) task);
return;
rpc_call_start(task);
} }
static int nfs4_proc_unlink_done(struct rpc_task *task, struct inode *dir) static int nfs4_proc_unlink_done(struct rpc_task *task, struct inode *dir)
...@@ -2965,12 +2960,10 @@ static void nfs4_proc_rename_setup(struct rpc_message *msg, struct inode *dir) ...@@ -2965,12 +2960,10 @@ static void nfs4_proc_rename_setup(struct rpc_message *msg, struct inode *dir)
static void nfs4_proc_rename_rpc_prepare(struct rpc_task *task, struct nfs_renamedata *data) static void nfs4_proc_rename_rpc_prepare(struct rpc_task *task, struct nfs_renamedata *data)
{ {
if (nfs4_setup_sequence(NFS_SERVER(data->old_dir), nfs4_setup_sequence(NFS_SERVER(data->old_dir),
&data->args.seq_args, &data->args.seq_args,
&data->res.seq_res, &data->res.seq_res,
task)) task);
return;
rpc_call_start(task);
} }
static int nfs4_proc_rename_done(struct rpc_task *task, struct inode *old_dir, static int nfs4_proc_rename_done(struct rpc_task *task, struct inode *old_dir,
...@@ -3459,12 +3452,10 @@ static void nfs4_proc_read_setup(struct nfs_read_data *data, struct rpc_message ...@@ -3459,12 +3452,10 @@ static void nfs4_proc_read_setup(struct nfs_read_data *data, struct rpc_message
static void nfs4_proc_read_rpc_prepare(struct rpc_task *task, struct nfs_read_data *data) static void nfs4_proc_read_rpc_prepare(struct rpc_task *task, struct nfs_read_data *data)
{ {
if (nfs4_setup_sequence(NFS_SERVER(data->header->inode), nfs4_setup_sequence(NFS_SERVER(data->header->inode),
&data->args.seq_args, &data->args.seq_args,
&data->res.seq_res, &data->res.seq_res,
task)) task);
return;
rpc_call_start(task);
} }
static int nfs4_write_done_cb(struct rpc_task *task, struct nfs_write_data *data) static int nfs4_write_done_cb(struct rpc_task *task, struct nfs_write_data *data)
...@@ -3525,22 +3516,18 @@ static void nfs4_proc_write_setup(struct nfs_write_data *data, struct rpc_messag ...@@ -3525,22 +3516,18 @@ static void nfs4_proc_write_setup(struct nfs_write_data *data, struct rpc_messag
static void nfs4_proc_write_rpc_prepare(struct rpc_task *task, struct nfs_write_data *data) static void nfs4_proc_write_rpc_prepare(struct rpc_task *task, struct nfs_write_data *data)
{ {
if (nfs4_setup_sequence(NFS_SERVER(data->header->inode), nfs4_setup_sequence(NFS_SERVER(data->header->inode),
&data->args.seq_args, &data->args.seq_args,
&data->res.seq_res, &data->res.seq_res,
task)) task);
return;
rpc_call_start(task);
} }
static void nfs4_proc_commit_rpc_prepare(struct rpc_task *task, struct nfs_commit_data *data) static void nfs4_proc_commit_rpc_prepare(struct rpc_task *task, struct nfs_commit_data *data)
{ {
if (nfs4_setup_sequence(NFS_SERVER(data->inode), nfs4_setup_sequence(NFS_SERVER(data->inode),
&data->args.seq_args, &data->args.seq_args,
&data->res.seq_res, &data->res.seq_res,
task)) task);
return;
rpc_call_start(task);
} }
static int nfs4_commit_done_cb(struct rpc_task *task, struct nfs_commit_data *data) static int nfs4_commit_done_cb(struct rpc_task *task, struct nfs_commit_data *data)
...@@ -4187,11 +4174,10 @@ static void nfs4_delegreturn_prepare(struct rpc_task *task, void *data) ...@@ -4187,11 +4174,10 @@ static void nfs4_delegreturn_prepare(struct rpc_task *task, void *data)
d_data = (struct nfs4_delegreturndata *)data; d_data = (struct nfs4_delegreturndata *)data;
if (nfs4_setup_sequence(d_data->res.server, nfs4_setup_sequence(d_data->res.server,
&d_data->args.seq_args, &d_data->args.seq_args,
&d_data->res.seq_res, task)) &d_data->res.seq_res,
return; task);
rpc_call_start(task);
} }
#endif /* CONFIG_NFS_V4_1 */ #endif /* CONFIG_NFS_V4_1 */
...@@ -4445,8 +4431,6 @@ static void nfs4_locku_prepare(struct rpc_task *task, void *data) ...@@ -4445,8 +4431,6 @@ static void nfs4_locku_prepare(struct rpc_task *task, void *data)
&calldata->res.seq_res, &calldata->res.seq_res,
task) != 0) task) != 0)
nfs_release_seqid(calldata->arg.seqid); nfs_release_seqid(calldata->arg.seqid);
else
rpc_call_start(task);
} }
static const struct rpc_call_ops nfs4_locku_ops = { static const struct rpc_call_ops nfs4_locku_ops = {
...@@ -4601,10 +4585,8 @@ static void nfs4_lock_prepare(struct rpc_task *task, void *calldata) ...@@ -4601,10 +4585,8 @@ static void nfs4_lock_prepare(struct rpc_task *task, void *calldata)
if (nfs4_setup_sequence(data->server, if (nfs4_setup_sequence(data->server,
&data->arg.seq_args, &data->arg.seq_args,
&data->res.seq_res, &data->res.seq_res,
task) == 0) { task) == 0)
rpc_call_start(task);
return; return;
}
nfs_release_seqid(data->arg.open_seqid); nfs_release_seqid(data->arg.open_seqid);
out_release_lock_seqid: out_release_lock_seqid:
nfs_release_seqid(data->arg.lock_seqid); nfs_release_seqid(data->arg.lock_seqid);
...@@ -5462,7 +5444,6 @@ struct nfs4_get_lease_time_data { ...@@ -5462,7 +5444,6 @@ struct nfs4_get_lease_time_data {
static void nfs4_get_lease_time_prepare(struct rpc_task *task, static void nfs4_get_lease_time_prepare(struct rpc_task *task,
void *calldata) void *calldata)
{ {
int ret;
struct nfs4_get_lease_time_data *data = struct nfs4_get_lease_time_data *data =
(struct nfs4_get_lease_time_data *)calldata; (struct nfs4_get_lease_time_data *)calldata;
...@@ -5470,12 +5451,10 @@ static void nfs4_get_lease_time_prepare(struct rpc_task *task, ...@@ -5470,12 +5451,10 @@ static void nfs4_get_lease_time_prepare(struct rpc_task *task,
rpc_task_set_priority(task, RPC_PRIORITY_PRIVILEGED); rpc_task_set_priority(task, RPC_PRIORITY_PRIVILEGED);
/* just setup sequence, do not trigger session recovery /* just setup sequence, do not trigger session recovery
since we're invoked within one */ since we're invoked within one */
ret = nfs41_setup_sequence(data->clp->cl_session, nfs41_setup_sequence(data->clp->cl_session,
&data->args->la_seq_args, &data->args->la_seq_args,
&data->res->lr_seq_res, task); &data->res->lr_seq_res,
task);
if (ret != -EAGAIN)
rpc_call_start(task);
dprintk("<-- %s\n", __func__); dprintk("<-- %s\n", __func__);
} }
...@@ -5809,9 +5788,7 @@ static void nfs41_sequence_prepare(struct rpc_task *task, void *data) ...@@ -5809,9 +5788,7 @@ static void nfs41_sequence_prepare(struct rpc_task *task, void *data)
args = task->tk_msg.rpc_argp; args = task->tk_msg.rpc_argp;
res = task->tk_msg.rpc_resp; res = task->tk_msg.rpc_resp;
if (nfs41_setup_sequence(clp->cl_session, args, res, task)) nfs41_setup_sequence(clp->cl_session, args, res, task);
return;
rpc_call_start(task);
} }
static void nfs41_sequence_prepare_privileged(struct rpc_task *task, void *data) static void nfs41_sequence_prepare_privileged(struct rpc_task *task, void *data)
...@@ -5914,12 +5891,10 @@ static void nfs4_reclaim_complete_prepare(struct rpc_task *task, void *data) ...@@ -5914,12 +5891,10 @@ static void nfs4_reclaim_complete_prepare(struct rpc_task *task, void *data)
struct nfs4_reclaim_complete_data *calldata = data; struct nfs4_reclaim_complete_data *calldata = data;
rpc_task_set_priority(task, RPC_PRIORITY_PRIVILEGED); rpc_task_set_priority(task, RPC_PRIORITY_PRIVILEGED);
if (nfs41_setup_sequence(calldata->clp->cl_session, nfs41_setup_sequence(calldata->clp->cl_session,
&calldata->arg.seq_args, &calldata->arg.seq_args,
&calldata->res.seq_res, task)) &calldata->res.seq_res,
return; task);
rpc_call_start(task);
} }
static int nfs41_reclaim_complete_handle_errors(struct rpc_task *task, struct nfs_client *clp) static int nfs41_reclaim_complete_handle_errors(struct rpc_task *task, struct nfs_client *clp)
...@@ -6034,9 +6009,7 @@ nfs4_layoutget_prepare(struct rpc_task *task, void *calldata) ...@@ -6034,9 +6009,7 @@ nfs4_layoutget_prepare(struct rpc_task *task, void *calldata)
NFS_I(lgp->args.inode)->layout, NFS_I(lgp->args.inode)->layout,
lgp->args.ctx->state)) { lgp->args.ctx->state)) {
rpc_exit(task, NFS4_OK); rpc_exit(task, NFS4_OK);
return;
} }
rpc_call_start(task);
} }
static void nfs4_layoutget_done(struct rpc_task *task, void *calldata) static void nfs4_layoutget_done(struct rpc_task *task, void *calldata)
...@@ -6200,10 +6173,10 @@ nfs4_layoutreturn_prepare(struct rpc_task *task, void *calldata) ...@@ -6200,10 +6173,10 @@ nfs4_layoutreturn_prepare(struct rpc_task *task, void *calldata)
struct nfs4_layoutreturn *lrp = calldata; struct nfs4_layoutreturn *lrp = calldata;
dprintk("--> %s\n", __func__); dprintk("--> %s\n", __func__);
if (nfs41_setup_sequence(lrp->clp->cl_session, &lrp->args.seq_args, nfs41_setup_sequence(lrp->clp->cl_session,
&lrp->res.seq_res, task)) &lrp->args.seq_args,
return; &lrp->res.seq_res,
rpc_call_start(task); task);
} }
static void nfs4_layoutreturn_done(struct rpc_task *task, void *calldata) static void nfs4_layoutreturn_done(struct rpc_task *task, void *calldata)
...@@ -6364,10 +6337,10 @@ static void nfs4_layoutcommit_prepare(struct rpc_task *task, void *calldata) ...@@ -6364,10 +6337,10 @@ static void nfs4_layoutcommit_prepare(struct rpc_task *task, void *calldata)
struct nfs_server *server = NFS_SERVER(data->args.inode); struct nfs_server *server = NFS_SERVER(data->args.inode);
struct nfs4_session *session = nfs4_get_session(server); struct nfs4_session *session = nfs4_get_session(server);
if (nfs41_setup_sequence(session, &data->args.seq_args, nfs41_setup_sequence(session,
&data->res.seq_res, task)) &data->args.seq_args,
return; &data->res.seq_res,
rpc_call_start(task); task);
} }
static void static void
......
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