[pnfs] [PATCH 8/8] Added check for call/reply flag to xs_tcp_read_request()

Benny Halevy bhalevy at panasas.com
Sun Apr 15 01:35:02 EDT 2007


iyer at netapp.com wrote:
> From: Rahul Iyer <iyer at netapp.com>
> 
> Added a check for the call/reply header to xs_tcp_read_request(). This check
> will eventually be used to deal with callbacks coming in on the connection.
> 
> Signed-off-by: Rahul Iyer <iyer at netapp.com>
> ---
>  net/sunrpc/xprtsock.c |   20 ++++++++++++++------
>  1 files changed, 14 insertions(+), 6 deletions(-)
> 
> diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
> index 61cf741..a2083dc 100644
> --- a/net/sunrpc/xprtsock.c
> +++ b/net/sunrpc/xprtsock.c
> @@ -686,15 +686,23 @@ static inline void xs_tcp_read_request(struct rpc_xprt *xprt, skb_reader_t *desc
>  
>  	/* Find and lock the request corresponding to this xid */
>  	spin_lock(&xprt->transport_lock);
> -	req = xprt_lookup_rqst(xprt, xprt->tcp_xid);
> -	if (!req) {
> -		xprt->tcp_flags &= ~XPRT_COPY_DATA;
> -		dprintk("RPC:      XID %08x request not found!\n",
> -				ntohl(xprt->tcp_xid));
> +	if (xprt->tcp_calldir == RPC_CALL) {
> +		dprintk("Callback received on backchannel!\n");
>  		spin_unlock(&xprt->transport_lock);
> +
> +		/* Ignore callbacks for now */
>  		return;
>  	}
> -
> +	else {

no need for else as the if {} above returns
(this will also reduce this patch to the required minimum :)

> +		req = xprt_lookup_rqst(xprt, xprt->tcp_xid);
> +		if (!req) {
> +			xprt->tcp_flags &= ~XPRT_COPY_DATA;
> +			dprintk("RPC:      XID %08x request not found!\n",
> +					ntohl(xprt->tcp_xid));
> +			spin_unlock(&xprt->transport_lock);
> +			return;
> +		}
> +	}
>  	rcvbuf = &req->rq_private_buf;
>  	len = desc->count;
>  	if (len > xprt->tcp_reclen - xprt->tcp_offset) {



More information about the pNFS mailing list