NFSD: Trace delegation revocations
[ Upstream commit a1c74569bbde91299f24535abf711be5c84df9de ] Delegation revocation is an exceptional event that is not otherwise visible externally (eg, no network traffic is emitted). Generate a trace record when it occurs so that revocation can be observed or other activity can be triggered. Example: nfsd-1104 [005] 1912.002544: nfsd_stid_revoke: client 633c9343:4e82788d stateid 00000003:00000001 ref=2 type=DELEG Trace infrastructure is provided for subsequent additional tracing related to nfs4_stid activity. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Tested-by: Jeff Layton <jlayton@kernel.org> Reviewed-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
1f3a273889
commit
a311157fbd
2 changed files with 57 additions and 0 deletions
|
@ -1366,6 +1366,8 @@ static void revoke_delegation(struct nfs4_delegation *dp)
|
||||||
|
|
||||||
WARN_ON(!list_empty(&dp->dl_recall_lru));
|
WARN_ON(!list_empty(&dp->dl_recall_lru));
|
||||||
|
|
||||||
|
trace_nfsd_stid_revoke(&dp->dl_stid);
|
||||||
|
|
||||||
if (clp->cl_minorversion) {
|
if (clp->cl_minorversion) {
|
||||||
spin_lock(&clp->cl_lock);
|
spin_lock(&clp->cl_lock);
|
||||||
dp->dl_stid.sc_type = NFS4_REVOKED_DELEG_STID;
|
dp->dl_stid.sc_type = NFS4_REVOKED_DELEG_STID;
|
||||||
|
|
|
@ -550,6 +550,61 @@ DEFINE_EVENT(nfsd_stateseqid_class, nfsd_##name, \
|
||||||
DEFINE_STATESEQID_EVENT(preprocess);
|
DEFINE_STATESEQID_EVENT(preprocess);
|
||||||
DEFINE_STATESEQID_EVENT(open_confirm);
|
DEFINE_STATESEQID_EVENT(open_confirm);
|
||||||
|
|
||||||
|
TRACE_DEFINE_ENUM(NFS4_OPEN_STID);
|
||||||
|
TRACE_DEFINE_ENUM(NFS4_LOCK_STID);
|
||||||
|
TRACE_DEFINE_ENUM(NFS4_DELEG_STID);
|
||||||
|
TRACE_DEFINE_ENUM(NFS4_CLOSED_STID);
|
||||||
|
TRACE_DEFINE_ENUM(NFS4_REVOKED_DELEG_STID);
|
||||||
|
TRACE_DEFINE_ENUM(NFS4_CLOSED_DELEG_STID);
|
||||||
|
TRACE_DEFINE_ENUM(NFS4_LAYOUT_STID);
|
||||||
|
|
||||||
|
#define show_stid_type(x) \
|
||||||
|
__print_flags(x, "|", \
|
||||||
|
{ NFS4_OPEN_STID, "OPEN" }, \
|
||||||
|
{ NFS4_LOCK_STID, "LOCK" }, \
|
||||||
|
{ NFS4_DELEG_STID, "DELEG" }, \
|
||||||
|
{ NFS4_CLOSED_STID, "CLOSED" }, \
|
||||||
|
{ NFS4_REVOKED_DELEG_STID, "REVOKED" }, \
|
||||||
|
{ NFS4_CLOSED_DELEG_STID, "CLOSED_DELEG" }, \
|
||||||
|
{ NFS4_LAYOUT_STID, "LAYOUT" })
|
||||||
|
|
||||||
|
DECLARE_EVENT_CLASS(nfsd_stid_class,
|
||||||
|
TP_PROTO(
|
||||||
|
const struct nfs4_stid *stid
|
||||||
|
),
|
||||||
|
TP_ARGS(stid),
|
||||||
|
TP_STRUCT__entry(
|
||||||
|
__field(unsigned long, sc_type)
|
||||||
|
__field(int, sc_count)
|
||||||
|
__field(u32, cl_boot)
|
||||||
|
__field(u32, cl_id)
|
||||||
|
__field(u32, si_id)
|
||||||
|
__field(u32, si_generation)
|
||||||
|
),
|
||||||
|
TP_fast_assign(
|
||||||
|
const stateid_t *stp = &stid->sc_stateid;
|
||||||
|
|
||||||
|
__entry->sc_type = stid->sc_type;
|
||||||
|
__entry->sc_count = refcount_read(&stid->sc_count);
|
||||||
|
__entry->cl_boot = stp->si_opaque.so_clid.cl_boot;
|
||||||
|
__entry->cl_id = stp->si_opaque.so_clid.cl_id;
|
||||||
|
__entry->si_id = stp->si_opaque.so_id;
|
||||||
|
__entry->si_generation = stp->si_generation;
|
||||||
|
),
|
||||||
|
TP_printk("client %08x:%08x stateid %08x:%08x ref=%d type=%s",
|
||||||
|
__entry->cl_boot, __entry->cl_id,
|
||||||
|
__entry->si_id, __entry->si_generation,
|
||||||
|
__entry->sc_count, show_stid_type(__entry->sc_type)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
#define DEFINE_STID_EVENT(name) \
|
||||||
|
DEFINE_EVENT(nfsd_stid_class, nfsd_stid_##name, \
|
||||||
|
TP_PROTO(const struct nfs4_stid *stid), \
|
||||||
|
TP_ARGS(stid))
|
||||||
|
|
||||||
|
DEFINE_STID_EVENT(revoke);
|
||||||
|
|
||||||
DECLARE_EVENT_CLASS(nfsd_clientid_class,
|
DECLARE_EVENT_CLASS(nfsd_clientid_class,
|
||||||
TP_PROTO(const clientid_t *clid),
|
TP_PROTO(const clientid_t *clid),
|
||||||
TP_ARGS(clid),
|
TP_ARGS(clid),
|
||||||
|
|
Loading…
Add table
Reference in a new issue