aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJeff Layton <jlayton@primarydata.com>2014-10-28 14:24:12 -0400
committerTrond Myklebust <trond.myklebust@primarydata.com>2014-11-24 12:53:34 -0500
commit860a0d9e511f278bedab62d555a457c18e0841d5 (patch)
tree4e5348dd4d2e9abf81dea3c9715fe887a4f3fedc /net
parent878ffa9f855e84d35d950f1abeb5a37b8435baea (diff)
sunrpc: add some tracepoints in svc_rqst handling functions
...just around svc_send, svc_recv and svc_process for now. Signed-off-by: Jeff Layton <jlayton@primarydata.com> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'net')
-rw-r--r--net/sunrpc/svc.c21
-rw-r--r--net/sunrpc/svc_xprt.c31
2 files changed, 33 insertions, 19 deletions
diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
index ca8a7958f4e6..371a8bbb43d6 100644
--- a/net/sunrpc/svc.c
+++ b/net/sunrpc/svc.c
@@ -28,6 +28,8 @@
28#include <linux/sunrpc/clnt.h> 28#include <linux/sunrpc/clnt.h>
29#include <linux/sunrpc/bc_xprt.h> 29#include <linux/sunrpc/bc_xprt.h>
30 30
31#include <trace/events/sunrpc.h>
32
31#define RPCDBG_FACILITY RPCDBG_SVCDSP 33#define RPCDBG_FACILITY RPCDBG_SVCDSP
32 34
33static void svc_unregister(const struct svc_serv *serv, struct net *net); 35static void svc_unregister(const struct svc_serv *serv, struct net *net);
@@ -1314,24 +1316,25 @@ svc_process(struct svc_rqst *rqstp)
1314 rqstp->rq_res.tail[0].iov_base = NULL; 1316 rqstp->rq_res.tail[0].iov_base = NULL;
1315 rqstp->rq_res.tail[0].iov_len = 0; 1317 rqstp->rq_res.tail[0].iov_len = 0;
1316 1318
1317 rqstp->rq_xid = svc_getu32(argv);
1318
1319 dir = svc_getnl(argv); 1319 dir = svc_getnl(argv);
1320 if (dir != 0) { 1320 if (dir != 0) {
1321 /* direction != CALL */ 1321 /* direction != CALL */
1322 svc_printk(rqstp, "bad direction %d, dropping request\n", dir); 1322 svc_printk(rqstp, "bad direction %d, dropping request\n", dir);
1323 serv->sv_stats->rpcbadfmt++; 1323 serv->sv_stats->rpcbadfmt++;
1324 svc_drop(rqstp); 1324 goto out_drop;
1325 return 0;
1326 } 1325 }
1327 1326
1328 /* Returns 1 for send, 0 for drop */ 1327 /* Returns 1 for send, 0 for drop */
1329 if (svc_process_common(rqstp, argv, resv)) 1328 if (likely(svc_process_common(rqstp, argv, resv))) {
1330 return svc_send(rqstp); 1329 int ret = svc_send(rqstp);
1331 else { 1330
1332 svc_drop(rqstp); 1331 trace_svc_process(rqstp, ret);
1333 return 0; 1332 return ret;
1334 } 1333 }
1334out_drop:
1335 trace_svc_process(rqstp, 0);
1336 svc_drop(rqstp);
1337 return 0;
1335} 1338}
1336 1339
1337#if defined(CONFIG_SUNRPC_BACKCHANNEL) 1340#if defined(CONFIG_SUNRPC_BACKCHANNEL)
diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c
index c179ca2a5aa4..bbb3b044b877 100644
--- a/net/sunrpc/svc_xprt.c
+++ b/net/sunrpc/svc_xprt.c
@@ -15,6 +15,7 @@
15#include <linux/sunrpc/svcsock.h> 15#include <linux/sunrpc/svcsock.h>
16#include <linux/sunrpc/xprt.h> 16#include <linux/sunrpc/xprt.h>
17#include <linux/module.h> 17#include <linux/module.h>
18#include <trace/events/sunrpc.h>
18 19
19#define RPCDBG_FACILITY RPCDBG_SVCXPRT 20#define RPCDBG_FACILITY RPCDBG_SVCXPRT
20 21
@@ -773,35 +774,43 @@ int svc_recv(struct svc_rqst *rqstp, long timeout)
773 774
774 err = svc_alloc_arg(rqstp); 775 err = svc_alloc_arg(rqstp);
775 if (err) 776 if (err)
776 return err; 777 goto out;
777 778
778 try_to_freeze(); 779 try_to_freeze();
779 cond_resched(); 780 cond_resched();
781 err = -EINTR;
780 if (signalled() || kthread_should_stop()) 782 if (signalled() || kthread_should_stop())
781 return -EINTR; 783 goto out;
782 784
783 xprt = svc_get_next_xprt(rqstp, timeout); 785 xprt = svc_get_next_xprt(rqstp, timeout);
784 if (IS_ERR(xprt)) 786 if (IS_ERR(xprt)) {
785 return PTR_ERR(xprt); 787 err = PTR_ERR(xprt);
788 goto out;
789 }
786 790
787 len = svc_handle_xprt(rqstp, xprt); 791 len = svc_handle_xprt(rqstp, xprt);
788 792
789 /* No data, incomplete (TCP) read, or accept() */ 793 /* No data, incomplete (TCP) read, or accept() */
794 err = -EAGAIN;
790 if (len <= 0) 795 if (len <= 0)
791 goto out; 796 goto out_release;
792 797
793 clear_bit(XPT_OLD, &xprt->xpt_flags); 798 clear_bit(XPT_OLD, &xprt->xpt_flags);
794 799
795 rqstp->rq_secure = xprt->xpt_ops->xpo_secure_port(rqstp); 800 rqstp->rq_secure = xprt->xpt_ops->xpo_secure_port(rqstp);
796 rqstp->rq_chandle.defer = svc_defer; 801 rqstp->rq_chandle.defer = svc_defer;
802 rqstp->rq_xid = svc_getu32(&rqstp->rq_arg.head[0]);
797 803
798 if (serv->sv_stats) 804 if (serv->sv_stats)
799 serv->sv_stats->netcnt++; 805 serv->sv_stats->netcnt++;
806 trace_svc_recv(rqstp, len);
800 return len; 807 return len;
801out: 808out_release:
802 rqstp->rq_res.len = 0; 809 rqstp->rq_res.len = 0;
803 svc_xprt_release(rqstp); 810 svc_xprt_release(rqstp);
804 return -EAGAIN; 811out:
812 trace_svc_recv(rqstp, err);
813 return err;
805} 814}
806EXPORT_SYMBOL_GPL(svc_recv); 815EXPORT_SYMBOL_GPL(svc_recv);
807 816
@@ -821,12 +830,12 @@ EXPORT_SYMBOL_GPL(svc_drop);
821int svc_send(struct svc_rqst *rqstp) 830int svc_send(struct svc_rqst *rqstp)
822{ 831{
823 struct svc_xprt *xprt; 832 struct svc_xprt *xprt;
824 int len; 833 int len = -EFAULT;
825 struct xdr_buf *xb; 834 struct xdr_buf *xb;
826 835
827 xprt = rqstp->rq_xprt; 836 xprt = rqstp->rq_xprt;
828 if (!xprt) 837 if (!xprt)
829 return -EFAULT; 838 goto out;
830 839
831 /* release the receive skb before sending the reply */ 840 /* release the receive skb before sending the reply */
832 rqstp->rq_xprt->xpt_ops->xpo_release_rqst(rqstp); 841 rqstp->rq_xprt->xpt_ops->xpo_release_rqst(rqstp);
@@ -849,7 +858,9 @@ int svc_send(struct svc_rqst *rqstp)
849 svc_xprt_release(rqstp); 858 svc_xprt_release(rqstp);
850 859
851 if (len == -ECONNREFUSED || len == -ENOTCONN || len == -EAGAIN) 860 if (len == -ECONNREFUSED || len == -ENOTCONN || len == -EAGAIN)
852 return 0; 861 len = 0;
862out:
863 trace_svc_send(rqstp, len);
853 return len; 864 return len;
854} 865}
855 866