mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-30 07:34:12 +08:00
NFSD: Capture every CB state transition
We were missing one. As a clean-up, add a helper that sets the new CB state and fires a tracepoint. The tracepoint fires only when the state changes, to help reduce trace log noise. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
This commit is contained in:
parent
1736aec82a
commit
8476c69a7f
@ -945,20 +945,26 @@ static int setup_callback_client(struct nfs4_client *clp, struct nfs4_cb_conn *c
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void nfsd4_mark_cb_state(struct nfs4_client *clp, int newstate)
|
||||||
|
{
|
||||||
|
if (clp->cl_cb_state != newstate) {
|
||||||
|
clp->cl_cb_state = newstate;
|
||||||
|
trace_nfsd_cb_state(clp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void nfsd4_mark_cb_down(struct nfs4_client *clp, int reason)
|
static void nfsd4_mark_cb_down(struct nfs4_client *clp, int reason)
|
||||||
{
|
{
|
||||||
if (test_bit(NFSD4_CLIENT_CB_UPDATE, &clp->cl_flags))
|
if (test_bit(NFSD4_CLIENT_CB_UPDATE, &clp->cl_flags))
|
||||||
return;
|
return;
|
||||||
clp->cl_cb_state = NFSD4_CB_DOWN;
|
nfsd4_mark_cb_state(clp, NFSD4_CB_DOWN);
|
||||||
trace_nfsd_cb_state(clp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void nfsd4_mark_cb_fault(struct nfs4_client *clp, int reason)
|
static void nfsd4_mark_cb_fault(struct nfs4_client *clp, int reason)
|
||||||
{
|
{
|
||||||
if (test_bit(NFSD4_CLIENT_CB_UPDATE, &clp->cl_flags))
|
if (test_bit(NFSD4_CLIENT_CB_UPDATE, &clp->cl_flags))
|
||||||
return;
|
return;
|
||||||
clp->cl_cb_state = NFSD4_CB_FAULT;
|
nfsd4_mark_cb_state(clp, NFSD4_CB_FAULT);
|
||||||
trace_nfsd_cb_state(clp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void nfsd4_cb_probe_done(struct rpc_task *task, void *calldata)
|
static void nfsd4_cb_probe_done(struct rpc_task *task, void *calldata)
|
||||||
@ -968,10 +974,8 @@ static void nfsd4_cb_probe_done(struct rpc_task *task, void *calldata)
|
|||||||
trace_nfsd_cb_done(clp, task->tk_status);
|
trace_nfsd_cb_done(clp, task->tk_status);
|
||||||
if (task->tk_status)
|
if (task->tk_status)
|
||||||
nfsd4_mark_cb_down(clp, task->tk_status);
|
nfsd4_mark_cb_down(clp, task->tk_status);
|
||||||
else {
|
else
|
||||||
clp->cl_cb_state = NFSD4_CB_UP;
|
nfsd4_mark_cb_state(clp, NFSD4_CB_UP);
|
||||||
trace_nfsd_cb_state(clp);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void nfsd4_cb_probe_release(void *calldata)
|
static void nfsd4_cb_probe_release(void *calldata)
|
||||||
@ -995,8 +999,7 @@ static const struct rpc_call_ops nfsd4_cb_probe_ops = {
|
|||||||
*/
|
*/
|
||||||
void nfsd4_probe_callback(struct nfs4_client *clp)
|
void nfsd4_probe_callback(struct nfs4_client *clp)
|
||||||
{
|
{
|
||||||
clp->cl_cb_state = NFSD4_CB_UNKNOWN;
|
nfsd4_mark_cb_state(clp, NFSD4_CB_UNKNOWN);
|
||||||
trace_nfsd_cb_state(clp);
|
|
||||||
set_bit(NFSD4_CLIENT_CB_UPDATE, &clp->cl_flags);
|
set_bit(NFSD4_CLIENT_CB_UPDATE, &clp->cl_flags);
|
||||||
nfsd4_run_cb(&clp->cl_cb_null);
|
nfsd4_run_cb(&clp->cl_cb_null);
|
||||||
}
|
}
|
||||||
@ -1009,11 +1012,10 @@ void nfsd4_probe_callback_sync(struct nfs4_client *clp)
|
|||||||
|
|
||||||
void nfsd4_change_callback(struct nfs4_client *clp, struct nfs4_cb_conn *conn)
|
void nfsd4_change_callback(struct nfs4_client *clp, struct nfs4_cb_conn *conn)
|
||||||
{
|
{
|
||||||
clp->cl_cb_state = NFSD4_CB_UNKNOWN;
|
nfsd4_mark_cb_state(clp, NFSD4_CB_UNKNOWN);
|
||||||
spin_lock(&clp->cl_lock);
|
spin_lock(&clp->cl_lock);
|
||||||
memcpy(&clp->cl_cb_conn, conn, sizeof(struct nfs4_cb_conn));
|
memcpy(&clp->cl_cb_conn, conn, sizeof(struct nfs4_cb_conn));
|
||||||
spin_unlock(&clp->cl_lock);
|
spin_unlock(&clp->cl_lock);
|
||||||
trace_nfsd_cb_state(clp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1345,7 +1347,7 @@ nfsd4_run_cb_work(struct work_struct *work)
|
|||||||
* Don't send probe messages for 4.1 or later.
|
* Don't send probe messages for 4.1 or later.
|
||||||
*/
|
*/
|
||||||
if (!cb->cb_ops && clp->cl_minorversion) {
|
if (!cb->cb_ops && clp->cl_minorversion) {
|
||||||
clp->cl_cb_state = NFSD4_CB_UP;
|
nfsd4_mark_cb_state(clp, NFSD4_CB_UP);
|
||||||
nfsd41_destroy_cb(cb);
|
nfsd41_destroy_cb(cb);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user