[pnfs] [PATCH 5/5] Fix byte order bug in xs_tcp_read_request
iyer at netapp.com
iyer at netapp.com
Tue Apr 17 00:06:53 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 and
not 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 | 14 ++++++++------
1 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 4d073f9..e48280e 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -683,16 +683,18 @@ 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);
- /* XXX Needs a #ifdef for v4.1
- */
- 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);
- /* Ignore callbacks for now */
+ /* We need to create an rpc_rqst for this to read in the
+ * callback request. Ignore the callback for now.
+ */
return;
}
else {
@@ -756,7 +758,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