[pnfs] [PATCH 2/2] Fix byte order bug in xs_tcp_read_request

iyer at netapp.com iyer at netapp.com
Tue Apr 17 23:35:46 EDT 2007


From: Rahul Iyer <iyer at netapp.com>

Fixed a bug in xs_tcp_read_request. The call/reply flag is in network order
andnot in host order. It needs to be converted to host order before comparisons
are made. The reason the earlier code worked is because the comparison was
against RPC_CALL which is defined as 0 (ntohl(0) == 0)

Signed-off-by: Rahul Iyer <iyer at netapp.com>
---
 net/sunrpc/xprtsock.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 72cde3a..50e000e 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -683,10 +683,12 @@ static inline void xs_tcp_read_request(struct rpc_xprt *xprt, skb_reader_t *desc
 	struct xdr_buf *rcvbuf;
 	size_t len;
 	ssize_t r;
+	u32 calldir;
 
 	/* Find and lock the request corresponding to this xid */
 	spin_lock(&xprt->transport_lock);
-	if (xprt->tcp_calldir == RPC_CALL) {
+	calldir = ntohl(xprt->tcp_calldir);
+	if (calldir == RPC_CALL) {
 		dprintk("Callback received on backchannel!\n");
 		spin_unlock(&xprt->transport_lock);
 
@@ -754,7 +756,7 @@ static inline void xs_tcp_read_request(struct rpc_xprt *xprt, skb_reader_t *desc
 	}
 
 out:
-	if (!(xprt->tcp_flags & XPRT_COPY_DATA))
+	if (!(xprt->tcp_flags & XPRT_COPY_DATA) && (calldir == RPC_REPLY))
 		xprt_complete_rqst(req->rq_task, xprt->tcp_copied);
 	spin_unlock(&xprt->transport_lock);
 	xs_tcp_check_recm(xprt);
-- 
1.5.0.2


More information about the pNFS mailing list