In many cases, tracepoints already report these errors. In others, the dprintks were mainly useful when this code was less mature.
Unified · Split
| @@ -1269,6 +1269,41 @@ TRACE_EVENT(xs_stream_read_request, · 1268 unmodified lines | ||
| 1269 | 1269 | __entry->copied, __entry->reclen, __entry->offset) |
| 1270 | 1270 | ); |
| 1271 | 1271 | |
| 1272 | +TRACE_EVENT(rpcb_getport, | |
| 1273 | + TP_PROTO( | |
| 1274 | + const struct rpc_clnt *clnt, | |
| 1275 | + const struct rpc_task *task, | |
| 1276 | + unsigned int bind_version | |
| 1277 | + ), | |
| 1278 | + | |
| 1279 | + TP_ARGS(clnt, task, bind_version), | |
| 1280 | + | |
| 1281 | + TP_STRUCT__entry( | |
| 1282 | + __field(unsigned int, task_id) | |
| 1283 | + __field(unsigned int, client_id) | |
| 1284 | + __field(unsigned int, program) | |
| 1285 | + __field(unsigned int, version) | |
| 1286 | + __field(int, protocol) | |
| 1287 | + __field(unsigned int, bind_version) | |
| 1288 | + __string(servername, task->tk_xprt->servername) | |
| 1289 | + ), | |
| 1290 | + | |
| 1291 | + TP_fast_assign( | |
| 1292 | + __entry->task_id = task->tk_pid; | |
| 1293 | + __entry->client_id = clnt->cl_clid; | |
| 1294 | + __entry->program = clnt->cl_prog; | |
| 1295 | + __entry->version = clnt->cl_vers; | |
| 1296 | + __entry->protocol = task->tk_xprt->prot; | |
| 1297 | + __entry->bind_version = bind_version; | |
| 1298 | + __assign_str(servername, task->tk_xprt->servername); | |
| 1299 | + ), | |
| 1300 | + | |
| 1301 | + TP_printk("task:%u@%u server=%s program=%u version=%u protocol=%d bind_version=%u", | |
| 1302 | + __entry->task_id, __entry->client_id, __get_str(servername), | |
| 1303 | + __entry->program, __entry->version, __entry->protocol, | |
| 1304 | + __entry->bind_version | |
| 1305 | + ) | |
| 1306 | +); | |
| 1272 | 1307 | |
| 1273 | 1308 | DECLARE_EVENT_CLASS(svc_xdr_buf_class, |
| 1274 | 1309 | TP_PROTO( |
| @@ -31,6 +31,8 @@ · 30 unmodified lines | ||
| 31 | 31 | #include <linux/sunrpc/sched.h> |
| 32 | 32 | #include <linux/sunrpc/xprtsock.h> |
| 33 | 33 | |
| 34 | +#include <trace/events/sunrpc.h> | |
| 35 | + | |
| 34 | 36 | #include "netns.h" |
| 35 | 37 | |
| 36 | 38 | #if IS_ENABLED(CONFIG_SUNRPC_DEBUG) |
| @@ -693,18 +695,12 @@ void rpcb_getport_async(struct rpc_task *task) · 656 unmodified lines | ||
| 693 | 695 | rcu_read_unlock(); |
| 694 | 696 | xprt = xprt_get(task->tk_xprt); |
| 695 | 697 | |
| 696 | − dprintk("RPC: %5u %s(%s, %u, %u, %d)\n", | |
| 697 | − task->tk_pid, __func__, | |
| 698 | − xprt->servername, clnt->cl_prog, clnt->cl_vers, xprt->prot); | |
| 699 | − | |
| 700 | 698 | /* Put self on the wait queue to ensure we get notified if |
| 701 | 699 | * some other task is already attempting to bind the port */ |
| 702 | 700 | rpc_sleep_on_timeout(&xprt->binding, task, |
| 703 | 701 | NULL, jiffies + xprt->bind_timeout); |
| 704 | 702 | |
| 705 | 703 | if (xprt_test_and_set_binding(xprt)) { |
| 706 | − dprintk("RPC: %5u %s: waiting for another binder\n", | |
| 707 | − task->tk_pid, __func__); | |
| 708 | 704 | xprt_put(xprt); |
| 709 | 705 | return; |
| 710 | 706 | } |
| @@ -712,8 +708,6 @@ void rpcb_getport_async(struct rpc_task *task) · 1 unmodified line | ||
| 712 | 708 | /* Someone else may have bound if we slept */ |
| 713 | 709 | if (xprt_bound(xprt)) { |
| 714 | 710 | status = 0; |
| 715 | − dprintk("RPC: %5u %s: already bound\n", | |
| 716 | − task->tk_pid, __func__); | |
| 717 | 711 | goto bailout_nofree; |
| 718 | 712 | } |
| 719 | 713 | |
| @@ -732,20 +726,15 @@ void rpcb_getport_async(struct rpc_task *task) · 12 unmodified lines | ||
| 732 | 726 | break; |
| 733 | 727 | default: |
| 734 | 728 | status = -EAFNOSUPPORT; |
| 735 | − dprintk("RPC: %5u %s: bad address family\n", | |
| 736 | − task->tk_pid, __func__); | |
| 737 | 729 | goto bailout_nofree; |
| 738 | 730 | } |
| 739 | 731 | if (proc == NULL) { |
| 740 | 732 | xprt->bind_index = 0; |
| 741 | 733 | status = -EPFNOSUPPORT; |
| 742 | − dprintk("RPC: %5u %s: no more getport versions available\n", | |
| 743 | − task->tk_pid, __func__); | |
| 744 | 734 | goto bailout_nofree; |
| 745 | 735 | } |
| 746 | 736 | |
| 747 | − dprintk("RPC: %5u %s: trying rpcbind version %u\n", | |
| 748 | − task->tk_pid, __func__, bind_version); | |
| 737 | + trace_rpcb_getport(clnt, task, bind_version); | |
| 749 | 738 | |
| 750 | 739 | rpcb_clnt = rpcb_create(xprt->xprt_net, |
| 751 | 740 | clnt->cl_nodename, |
| @@ -754,16 +743,12 @@ void rpcb_getport_async(struct rpc_task *task) · 2 unmodified lines | ||
| 754 | 743 | clnt->cl_cred); |
| 755 | 744 | if (IS_ERR(rpcb_clnt)) { |
| 756 | 745 | status = PTR_ERR(rpcb_clnt); |
| 757 | − dprintk("RPC: %5u %s: rpcb_create failed, error %ld\n", | |
| 758 | − task->tk_pid, __func__, PTR_ERR(rpcb_clnt)); | |
| 759 | 746 | goto bailout_nofree; |
| 760 | 747 | } |
| 761 | 748 | |
| 762 | 749 | map = kzalloc(sizeof(struct rpcbind_args), GFP_NOFS); |
| 763 | 750 | if (!map) { |
| 764 | 751 | status = -ENOMEM; |
| 765 | − dprintk("RPC: %5u %s: no memory available\n", | |
| 766 | − task->tk_pid, __func__); | |
| 767 | 752 | goto bailout_release_client; |
| 768 | 753 | } |
| 769 | 754 | map->r_prog = clnt->cl_prog; |
| @@ -780,8 +765,6 @@ void rpcb_getport_async(struct rpc_task *task) · 10 unmodified lines | ||
| 780 | 765 | map->r_addr = rpc_sockaddr2uaddr(sap, GFP_NOFS); |
| 781 | 766 | if (!map->r_addr) { |
| 782 | 767 | status = -ENOMEM; |
| 783 | − dprintk("RPC: %5u %s: no memory available\n", | |
| 784 | − task->tk_pid, __func__); | |
| 785 | 768 | goto bailout_free_args; |
| 786 | 769 | } |
| 787 | 770 | map->r_owner = ""; |