aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/svc_xprt.c
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/sunrpc/svc_xprt.c
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/sunrpc/svc_xprt.c')
-rw-r--r--net/sunrpc/svc_xprt.c31
1 files changed, 21 insertions, 10 deletions
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