linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tom Tucker <tom@opengridcomputing.com>
To: Jeff Layton <jlayton@redhat.com>, bfields@fieldses.org
Cc: linux-nfs@vger.kernel.org, swise@opengridcomputing.com,
	Tom Talpey <tmtalpey@gmail.com>
Subject: Re: [PATCH] svcrdma: fix offset calculation for non-page aligned sge entries
Date: Wed, 12 Mar 2014 15:43:10 -0500	[thread overview]
Message-ID: <5320C6DE.4090807@opengridcomputing.com> (raw)
In-Reply-To: <1394635867-19089-1-git-send-email-jlayton@redhat.com>

Hi Jeff,


On 3/12/14 9:51 AM, Jeff Layton wrote:
> The xdr_off value in dma_map_xdr gets passed to ib_dma_map_page as the
> offset into the page to be mapped. For the case of the pages array, the
> existing calculation always seems to end up at 0, which causes data
> corruption when a non-page-aligned READ request comes in. The server ends
> up doing the RDMA_WRITE from the wrong part of the page.
>
> Override the xdr_off value with the page_base in that situation to fix
> the issue. Obviously, this method can't contend with a page_base that is
> larger than PAGE_SIZE.
I think we saw page base > PAGE_SIZE when inter-operating with Sun, but 
maybe someone else on the list has a clearer recollection.

I am curious, however, why xdr_off was always zero if in fact, page_base 
was not page aligned.

Thanks,
Tom
> I'm not sure if that's ever the case, but add a
> WARN_ON in the event that that ever happens.
>
> Cc: Tom Tucker <tom@opengridcomputing.com>
> Signed-off-by: Jeff Layton <jlayton@redhat.com>
> ---
>   net/sunrpc/xprtrdma/svc_rdma_sendto.c | 7 +++++--
>   1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/net/sunrpc/xprtrdma/svc_rdma_sendto.c b/net/sunrpc/xprtrdma/svc_rdma_sendto.c
> index c1d124dc772b..76e524b428d0 100644
> --- a/net/sunrpc/xprtrdma/svc_rdma_sendto.c
> +++ b/net/sunrpc/xprtrdma/svc_rdma_sendto.c
> @@ -265,8 +265,11 @@ static dma_addr_t dma_map_xdr(struct svcxprt_rdma *xprt,
>   		xdr_off -= xdr->head[0].iov_len;
>   		if (xdr_off < xdr->page_len) {
>   			/* This offset is in the page list */
> -			page = xdr->pages[xdr_off >> PAGE_SHIFT];
> -			xdr_off &= ~PAGE_MASK;
> +			int pgnum = xdr_off >> PAGE_SHIFT;
> +
> +			page = xdr->pages[pgnum];
> +			WARN_ON(xdr->page_base > PAGE_SIZE);
> +			xdr_off = pgnum ? 0 : xdr->page_base;
>   		} else {
>   			/* This offset is in the tail */
>   			xdr_off -= xdr->page_len;


  reply	other threads:[~2014-03-12 20:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-12 14:51 [PATCH] svcrdma: fix offset calculation for non-page aligned sge entries Jeff Layton
2014-03-12 20:43 ` Tom Tucker [this message]
2014-03-12 21:18   ` Jeff Layton
2014-03-15 13:30     ` Jeff Layton
2014-03-17 17:17     ` Jeff Layton
2014-04-03  9:43     ` Boaz Harrosh
2014-04-03 11:20       ` Jeff Layton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5320C6DE.4090807@opengridcomputing.com \
    --to=tom@opengridcomputing.com \
    --cc=bfields@fieldses.org \
    --cc=jlayton@redhat.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=swise@opengridcomputing.com \
    --cc=tmtalpey@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).