[pnfs] [PATCH 09/10] nfs41: New xs_tcp_read_data()
Benny Halevy
bhalevy at panasas.com
Thu Jan 3 09:10:52 EST 2008
On Jan. 03, 2008, 2:01 +0200, Ricardo Labiaga <ricardo.labiaga at netapp.com> wrote:
<snip>
> +static inline int xs_tcp_read_callback(struct rpc_xprt *xprt,
> + struct xdr_skb_reader *desc)
> +{
> + struct sock_xprt *transport =
> + container_of(xprt, struct sock_xprt, xprt);
> + struct rpc_rqst *req;
> +
> + req = xprt_alloc_bc_request(xprt);
> + req->rq_xid = transport->tcp_xid;
> + dprintk("RPC: read callback XID %08x\n", ntohl(req->rq_xid));
two lines above dereference req before checking it's not NULL.
should probably be moved after the check below.
> + if (req == NULL) {
> + /*
> + * Drop the callback.
> + * The caller may choose to retransmit by first dropping the
> + * connection if using NFSv4.1.
> + */
> + dprintk("RPC: Couldn't get rpc_rqst for the callback! Dropping callback...\n");
> + return -1;
> + }
<snip>
> +static void xs_tcp_read_data(struct rpc_xprt *xprt,
> + struct xdr_skb_reader *desc)
> +{
> + struct sock_xprt *transport =
> + container_of(xprt, struct sock_xprt, xprt);
> + int status;
> +
> + status = (ntohl(transport->tcp_calldir) == RPC_REPLY) ?
> + xs_tcp_read_reply(xprt, desc) :
> + xs_tcp_read_callback(xprt, desc);
> +
> + if (status == 0)
> + xs_tcp_check_fraghdr(transport);
> + else {
> + /*
> + * The transport_lock protects the request handling.
> + * There's no need to hold it to update the tcp_flags.
> + */
> + transport->tcp_flags &= ~TCP_RCV_COPY_DATA;
> + }
> +
> + return;
no need for a return statement in this void function actually...
> }
>
More information about the pNFS
mailing list