diff options
author | J. Bruce Fields <bfields@redhat.com> | 2014-12-09 11:12:26 -0500 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2014-12-09 11:12:26 -0500 |
commit | 2941b0e91ba68b1f77140e556307e00616a5bb46 (patch) | |
tree | 01950b6ed12d06ebe4c39d1a2122050a9a570e93 /net/sunrpc/svc_xprt.c | |
parent | 818f2f57f20d0e9a9294180f304f34cd4e8f6066 (diff) | |
parent | 388f0c776781fe64ce951701bfe712b2182a31f2 (diff) |
Merge tag 'nfs-for-3.19-1' into nfsd for-3.19 branch
Mainly what I need is 860a0d9e511f "sunrpc: add some tracepoints in
svc_rqst handling functions", which subsequent server rpc patches from
jlayton depend on. I'm merging this later tag on the assumption that's
more likely to be a tested and stable point.
Diffstat (limited to 'net/sunrpc/svc_xprt.c')
-rw-r--r-- | net/sunrpc/svc_xprt.c | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c index 97a75c17142b..5c71ccb9659d 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; |
801 | out: | 808 | out_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; | 811 | out: |
812 | trace_svc_recv(rqstp, err); | ||
813 | return err; | ||
805 | } | 814 | } |
806 | EXPORT_SYMBOL_GPL(svc_recv); | 815 | EXPORT_SYMBOL_GPL(svc_recv); |
807 | 816 | ||
@@ -821,12 +830,12 @@ EXPORT_SYMBOL_GPL(svc_drop); | |||
821 | int svc_send(struct svc_rqst *rqstp) | 830 | int 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; |
862 | out: | ||
863 | trace_svc_send(rqstp, len); | ||
853 | return len; | 864 | return len; |
854 | } | 865 | } |
855 | 866 | ||