[pnfs] [PATCH 5/5] Fix byte order bug in xs_tcp_read_request
Benny Halevy
bhalevy at panasas.com
Tue Apr 17 09:43:11 EDT 2007
iyer at netapp.com wrote:
> 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
1. extra space character before "/*"
2. I think that according to the kernel coding style, the text in multi-line comments
should begin on the second line, not on the first, e.g.:
/*
* line 1
* ...
* line N
*/
> + * 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);
More information about the pNFS
mailing list