>From 88b5fb066cdeddb7e0057a43ed44635eb4e31745 Mon Sep 17 00:00:00 2001
From: Jeff Becker <Jeffrey.C.Becker@nasa.gov>
Date: Wed, 9 Nov 2011 14:16:19 -0800
Subject: [PATCH] NFSRDMA: A few more patches for 2.6.35
 Signed-off-by: Jeff Becker <Jeffrey.C.Becker@nasa.gov>

---
 ...-the-test-for-XPRT_CONNECTING-into-xprt_c.patch |   49 ++++++++++++++++
 ...entralise-most-calls-to-svc_xprt_received.patch |   61 ++++++++++++++++++++
 2 files changed, 110 insertions(+), 0 deletions(-)
 create mode 100644 kernel_patches/backport/2.6.35/nfsrdma-0004-SUNRPC-Move-the-test-for-XPRT_CONNECTING-into-xprt_c.patch
 create mode 100644 kernel_patches/backport/2.6.35/nfsrdma-sunrpc-centralise-most-calls-to-svc_xprt_received.patch

diff --git a/kernel_patches/backport/2.6.35/nfsrdma-0004-SUNRPC-Move-the-test-for-XPRT_CONNECTING-into-xprt_c.patch b/kernel_patches/backport/2.6.35/nfsrdma-0004-SUNRPC-Move-the-test-for-XPRT_CONNECTING-into-xprt_c.patch
new file mode 100644
index 0000000..5a1d1ea
--- /dev/null
+++ b/kernel_patches/backport/2.6.35/nfsrdma-0004-SUNRPC-Move-the-test-for-XPRT_CONNECTING-into-xprt_c.patch
@@ -0,0 +1,49 @@
+From 0b9e79431377df452348e78262dd5a3dc359eeef Mon Sep 17 00:00:00 2001
+From: Trond Myklebust <Trond.Myklebust@netapp.com>
+Date: Fri, 16 Apr 2010 16:41:57 -0400
+Subject: [PATCH] SUNRPC: Move the test for XPRT_CONNECTING into xprt_connect()
+
+This fixes a bug with setting xprt->stat.connect_start.
+
+Reviewed-by: Chuck Lever <chuck.lever@oracle.com>
+Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
+---
+diff --git a/net/sunrpc/xprtrdma/transport.c b/net/sunrpc/xprtrdma/transport.c
+index 187257b..0607b9a 100644
+--- a/net/sunrpc/xprtrdma/transport.c
++++ b/net/sunrpc/xprtrdma/transport.c
+@@ -449,21 +449,19 @@ xprt_rdma_connect(struct rpc_task *task)
+ 	struct rpc_xprt *xprt = (struct rpc_xprt *)task->tk_xprt;
+ 	struct rpcrdma_xprt *r_xprt = rpcx_to_rdmax(xprt);
+ 
+-	if (!xprt_test_and_set_connecting(xprt)) {
+-		if (r_xprt->rx_ep.rep_connected != 0) {
+-			/* Reconnect */
+-			schedule_delayed_work(&r_xprt->rdma_connect,
+-				xprt->reestablish_timeout);
+-			xprt->reestablish_timeout <<= 1;
+-			if (xprt->reestablish_timeout > (30 * HZ))
+-				xprt->reestablish_timeout = (30 * HZ);
+-			else if (xprt->reestablish_timeout < (5 * HZ))
+-				xprt->reestablish_timeout = (5 * HZ);
+-		} else {
+-			schedule_delayed_work(&r_xprt->rdma_connect, 0);
+-			if (!RPC_IS_ASYNC(task))
+-				flush_scheduled_work();
+-		}
++	if (r_xprt->rx_ep.rep_connected != 0) {
++		/* Reconnect */
++		schedule_delayed_work(&r_xprt->rdma_connect,
++			xprt->reestablish_timeout);
++		xprt->reestablish_timeout <<= 1;
++		if (xprt->reestablish_timeout > (30 * HZ))
++			xprt->reestablish_timeout = (30 * HZ);
++		else if (xprt->reestablish_timeout < (5 * HZ))
++			xprt->reestablish_timeout = (5 * HZ);
++	} else {
++		schedule_delayed_work(&r_xprt->rdma_connect, 0);
++		if (!RPC_IS_ASYNC(task))
++			flush_scheduled_work();
+ 	}
+ }
+ 
diff --git a/kernel_patches/backport/2.6.35/nfsrdma-sunrpc-centralise-most-calls-to-svc_xprt_received.patch b/kernel_patches/backport/2.6.35/nfsrdma-sunrpc-centralise-most-calls-to-svc_xprt_received.patch
new file mode 100644
index 0000000..dea25f7
--- /dev/null
+++ b/kernel_patches/backport/2.6.35/nfsrdma-sunrpc-centralise-most-calls-to-svc_xprt_received.patch
@@ -0,0 +1,61 @@
+From b48fa6b99100dc7772af3cd276035fcec9719ceb Mon Sep 17 00:00:00 2001
+From: Neil Brown <neilb@suse.de>
+Date: Mon, 1 Mar 2010 16:51:14 +1100
+Subject: [PATCH] sunrpc: centralise most calls to svc_xprt_received
+
+svc_xprt_received must be called when ->xpo_recvfrom has finished
+receiving a message, so that the XPT_BUSY flag will be cleared and
+if necessary, requeued for further work.
+
+This call is currently made in each ->xpo_recvfrom function, often
+from multiple different points.  In each case it is the earliest point
+on a particular path where it is known that the protection provided by
+XPT_BUSY is no longer needed.
+
+However there are (still) some error paths which do not call
+svc_xprt_received, and requiring each ->xpo_recvfrom to make the call
+does not encourage robustness.
+
+So: move the svc_xprt_received call to be made just after the
+call to ->xpo_recvfrom(), and move it of the various ->xpo_recvfrom
+methods.
+
+This means that it may not be called at the earliest possible instant,
+but this is unlikely to be a measurable performance issue.
+
+Note that there are still other calls to svc_xprt_received as it is
+also needed when an xprt is newly created.
+
+Signed-off-by: NeilBrown <neilb@suse.de>
+Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
+---
+diff --git a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c
+index f92e37e..0194de8 100644
+--- a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c
++++ b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c
+@@ -566,7 +566,6 @@ static int rdma_read_complete(struct svc_rqst *rqstp,
+ 		ret, rqstp->rq_arg.len,	rqstp->rq_arg.head[0].iov_base,
+ 		rqstp->rq_arg.head[0].iov_len);
+ 
+-	svc_xprt_received(rqstp->rq_xprt);
+ 	return ret;
+ }
+ 
+@@ -665,7 +664,6 @@ int svc_rdma_recvfrom(struct svc_rqst *rqstp)
+ 		rqstp->rq_arg.head[0].iov_len);
+ 	rqstp->rq_prot = IPPROTO_MAX;
+ 	svc_xprt_copy_addrs(rqstp, xprt);
+-	svc_xprt_received(xprt);
+ 	return ret;
+ 
+  close_out:
+@@ -678,6 +676,5 @@ int svc_rdma_recvfrom(struct svc_rqst *rqstp)
+ 	 */
+ 	set_bit(XPT_CLOSE, &xprt->xpt_flags);
+ defer:
+-	svc_xprt_received(xprt);
+ 	return 0;
+ }
+-- 
+1.7.3.4
+
-- 
1.7.3.4

