Skip to content

Commit c1c9f3e

Browse files
jtlaytonchucklever
authored andcommitted
nfsd: track the main opcode for callbacks
Keep track of the "main" opcode for the callback, and display it in the tracepoint. This makes it simpler to discern what's happening when there is more than one callback in flight. The one special case is the CB_NULL RPC. That's not a CB_COMPOUND opcode, so designate the value 0 for that. Signed-off-by: Jeff Layton <[email protected]> Signed-off-by: Chuck Lever <[email protected]>
1 parent e8581a9 commit c1c9f3e

File tree

5 files changed

+27
-5
lines changed

5 files changed

+27
-5
lines changed

fs/nfsd/nfs4layouts.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -740,6 +740,7 @@ static const struct nfsd4_callback_ops nfsd4_cb_layout_ops = {
740740
.prepare = nfsd4_cb_layout_prepare,
741741
.done = nfsd4_cb_layout_done,
742742
.release = nfsd4_cb_layout_release,
743+
.opcode = OP_CB_LAYOUTRECALL,
743744
};
744745

745746
static bool

fs/nfsd/nfs4proc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1622,7 +1622,8 @@ static int nfsd4_cb_offload_done(struct nfsd4_callback *cb,
16221622

16231623
static const struct nfsd4_callback_ops nfsd4_cb_offload_ops = {
16241624
.release = nfsd4_cb_offload_release,
1625-
.done = nfsd4_cb_offload_done
1625+
.done = nfsd4_cb_offload_done,
1626+
.opcode = OP_CB_OFFLOAD,
16261627
};
16271628

16281629
static void nfsd4_init_copy_res(struct nfsd4_copy *copy, bool sync)

fs/nfsd/nfs4state.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,7 @@ static const struct nfsd4_callback_ops nfsd4_cb_notify_lock_ops = {
400400
.prepare = nfsd4_cb_notify_lock_prepare,
401401
.done = nfsd4_cb_notify_lock_done,
402402
.release = nfsd4_cb_notify_lock_release,
403+
.opcode = OP_CB_NOTIFY_LOCK,
403404
};
404405

405406
/*
@@ -3083,11 +3084,13 @@ nfsd4_cb_getattr_release(struct nfsd4_callback *cb)
30833084
static const struct nfsd4_callback_ops nfsd4_cb_recall_any_ops = {
30843085
.done = nfsd4_cb_recall_any_done,
30853086
.release = nfsd4_cb_recall_any_release,
3087+
.opcode = OP_CB_RECALL_ANY,
30863088
};
30873089

30883090
static const struct nfsd4_callback_ops nfsd4_cb_getattr_ops = {
30893091
.done = nfsd4_cb_getattr_done,
30903092
.release = nfsd4_cb_getattr_release,
3093+
.opcode = OP_CB_GETATTR,
30913094
};
30923095

30933096
static void nfs4_cb_getattr(struct nfs4_cb_fattr *ncf)
@@ -5215,6 +5218,7 @@ static const struct nfsd4_callback_ops nfsd4_cb_recall_ops = {
52155218
.prepare = nfsd4_cb_recall_prepare,
52165219
.done = nfsd4_cb_recall_done,
52175220
.release = nfsd4_cb_recall_release,
5221+
.opcode = OP_CB_RECALL,
52185222
};
52195223

52205224
static void nfsd_break_one_deleg(struct nfs4_delegation *dp)

fs/nfsd/state.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ struct nfsd4_callback_ops {
7979
void (*prepare)(struct nfsd4_callback *);
8080
int (*done)(struct nfsd4_callback *, struct rpc_task *);
8181
void (*release)(struct nfsd4_callback *);
82+
uint32_t opcode;
8283
};
8384

8485
/*

fs/nfsd/trace.h

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1553,6 +1553,19 @@ TRACE_EVENT(nfsd_cb_setup_err,
15531553
__entry->error)
15541554
);
15551555

1556+
/* Not a real opcode, but there is no 0 operation. */
1557+
#define _CB_NULL 0
1558+
1559+
#define show_nfsd_cb_opcode(val) \
1560+
__print_symbolic(val, \
1561+
{ _CB_NULL, "CB_NULL" }, \
1562+
{ OP_CB_GETATTR, "CB_GETATTR" }, \
1563+
{ OP_CB_RECALL, "CB_RECALL" }, \
1564+
{ OP_CB_LAYOUTRECALL, "CB_LAYOUTRECALL" }, \
1565+
{ OP_CB_RECALL_ANY, "CB_RECALL_ANY" }, \
1566+
{ OP_CB_NOTIFY_LOCK, "CB_NOTIFY_LOCK" }, \
1567+
{ OP_CB_OFFLOAD, "CB_OFFLOAD" })
1568+
15561569
DECLARE_EVENT_CLASS(nfsd_cb_lifetime_class,
15571570
TP_PROTO(
15581571
const struct nfs4_client *clp,
@@ -1563,21 +1576,23 @@ DECLARE_EVENT_CLASS(nfsd_cb_lifetime_class,
15631576
__field(u32, cl_boot)
15641577
__field(u32, cl_id)
15651578
__field(const void *, cb)
1579+
__field(unsigned long, opcode)
15661580
__field(bool, need_restart)
15671581
__sockaddr(addr, clp->cl_cb_conn.cb_addrlen)
15681582
),
15691583
TP_fast_assign(
15701584
__entry->cl_boot = clp->cl_clientid.cl_boot;
15711585
__entry->cl_id = clp->cl_clientid.cl_id;
15721586
__entry->cb = cb;
1587+
__entry->opcode = cb->cb_ops ? cb->cb_ops->opcode : _CB_NULL;
15731588
__entry->need_restart = cb->cb_need_restart;
15741589
__assign_sockaddr(addr, &clp->cl_cb_conn.cb_addr,
15751590
clp->cl_cb_conn.cb_addrlen)
15761591
),
1577-
TP_printk("addr=%pISpc client %08x:%08x cb=%p%s",
1578-
__get_sockaddr(addr), __entry->cl_boot, __entry->cl_id,
1579-
__entry->cb, __entry->need_restart ?
1580-
" (need restart)" : " (first try)"
1592+
TP_printk("addr=%pISpc client %08x:%08x cb=%p%s opcode=%s",
1593+
__get_sockaddr(addr), __entry->cl_boot, __entry->cl_id, __entry->cb,
1594+
__entry->need_restart ? " (need restart)" : " (first try)",
1595+
show_nfsd_cb_opcode(__entry->opcode)
15811596
)
15821597
);
15831598

0 commit comments

Comments
 (0)