Skip to content

Commit

Permalink
NFS: Avoid RCU usage in tracepoints
Browse files Browse the repository at this point in the history
There isn't an obvious way to acquire and release the RCU lock during a
tracepoint, so we can't use the rpc_peeraddr2str() function here.
Instead, rely on the client's cl_hostname, which should have similar
enough information without needing an rcu_dereference().

Reported-by: Dave Jones <[email protected]>
Cc: [email protected] # v3.12
Signed-off-by: Anna Schumaker <[email protected]>
  • Loading branch information
amschuma-ntap committed Nov 17, 2017
1 parent 62b56a6 commit 3944369
Showing 1 changed file with 6 additions and 18 deletions.
24 changes: 6 additions & 18 deletions fs/nfs/nfs4trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,17 +201,13 @@ DECLARE_EVENT_CLASS(nfs4_clientid_event,
TP_ARGS(clp, error),

TP_STRUCT__entry(
__string(dstaddr,
rpc_peeraddr2str(clp->cl_rpcclient,
RPC_DISPLAY_ADDR))
__string(dstaddr, clp->cl_hostname)
__field(int, error)
),

TP_fast_assign(
__entry->error = error;
__assign_str(dstaddr,
rpc_peeraddr2str(clp->cl_rpcclient,
RPC_DISPLAY_ADDR));
__assign_str(dstaddr, clp->cl_hostname);
),

TP_printk(
Expand Down Expand Up @@ -1132,9 +1128,7 @@ DECLARE_EVENT_CLASS(nfs4_inode_callback_event,
__field(dev_t, dev)
__field(u32, fhandle)
__field(u64, fileid)
__string(dstaddr, clp ?
rpc_peeraddr2str(clp->cl_rpcclient,
RPC_DISPLAY_ADDR) : "unknown")
__string(dstaddr, clp ? clp->cl_hostname : "unknown")
),

TP_fast_assign(
Expand All @@ -1147,9 +1141,7 @@ DECLARE_EVENT_CLASS(nfs4_inode_callback_event,
__entry->fileid = 0;
__entry->dev = 0;
}
__assign_str(dstaddr, clp ?
rpc_peeraddr2str(clp->cl_rpcclient,
RPC_DISPLAY_ADDR) : "unknown")
__assign_str(dstaddr, clp ? clp->cl_hostname : "unknown")
),

TP_printk(
Expand Down Expand Up @@ -1191,9 +1183,7 @@ DECLARE_EVENT_CLASS(nfs4_inode_stateid_callback_event,
__field(dev_t, dev)
__field(u32, fhandle)
__field(u64, fileid)
__string(dstaddr, clp ?
rpc_peeraddr2str(clp->cl_rpcclient,
RPC_DISPLAY_ADDR) : "unknown")
__string(dstaddr, clp ? clp->cl_hostname : "unknown")
__field(int, stateid_seq)
__field(u32, stateid_hash)
),
Expand All @@ -1208,9 +1198,7 @@ DECLARE_EVENT_CLASS(nfs4_inode_stateid_callback_event,
__entry->fileid = 0;
__entry->dev = 0;
}
__assign_str(dstaddr, clp ?
rpc_peeraddr2str(clp->cl_rpcclient,
RPC_DISPLAY_ADDR) : "unknown")
__assign_str(dstaddr, clp ? clp->cl_hostname : "unknown")
__entry->stateid_seq =
be32_to_cpu(stateid->seqid);
__entry->stateid_hash =
Expand Down

0 comments on commit 3944369

Please sign in to comment.