OSDN Git Service

NFSD: Add an nfsd_cb_lm_notify tracepoint
authorChuck Lever <chuck.lever@oracle.com>
Fri, 14 May 2021 19:57:08 +0000 (15:57 -0400)
committerJ. Bruce Fields <bfields@redhat.com>
Tue, 18 May 2021 17:44:04 +0000 (13:44 -0400)
When the server kicks off a CB_LM_NOTIFY callback, record its
arguments so we can better observe asynchronous locking behavior.
For example:

            nfsd-998   [002]  1471.705873: nfsd_cb_notify_lock:  addr=192.168.2.51:0 client 6092a47c:35a43fc1 fh_hash=0x8950b23a

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Cc: Jeff Layton <jlayton@redhat.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
fs/nfsd/nfs4state.c
fs/nfsd/trace.h

index 377ec4a..d4eee8a 100644 (file)
@@ -6451,8 +6451,10 @@ nfsd4_lm_notify(struct file_lock *fl)
        }
        spin_unlock(&nn->blocked_locks_lock);
 
-       if (queue)
+       if (queue) {
+               trace_nfsd_cb_notify_lock(lo, nbl);
                nfsd4_run_cb(&nbl->nbl_cb);
+       }
 }
 
 static const struct lock_manager_operations nfsd_posix_mng_ops  = {
index fc80879..921323f 100644 (file)
@@ -1027,6 +1027,32 @@ TRACE_EVENT(nfsd_cb_done,
                __entry->status)
 );
 
+TRACE_EVENT(nfsd_cb_notify_lock,
+       TP_PROTO(
+               const struct nfs4_lockowner *lo,
+               const struct nfsd4_blocked_lock *nbl
+       ),
+       TP_ARGS(lo, nbl),
+       TP_STRUCT__entry(
+               __field(u32, cl_boot)
+               __field(u32, cl_id)
+               __field(u32, fh_hash)
+               __array(unsigned char, addr, sizeof(struct sockaddr_in6))
+       ),
+       TP_fast_assign(
+               const struct nfs4_client *clp = lo->lo_owner.so_client;
+
+               __entry->cl_boot = clp->cl_clientid.cl_boot;
+               __entry->cl_id = clp->cl_clientid.cl_id;
+               __entry->fh_hash = knfsd_fh_hash(&nbl->nbl_fh);
+               memcpy(__entry->addr, &clp->cl_cb_conn.cb_addr,
+                       sizeof(struct sockaddr_in6));
+       ),
+       TP_printk("addr=%pISpc client %08x:%08x fh_hash=0x%08x",
+               __entry->addr, __entry->cl_boot, __entry->cl_id,
+               __entry->fh_hash)
+);
+
 #endif /* _NFSD_TRACE_H */
 
 #undef TRACE_INCLUDE_PATH