From patchwork Mon Aug 28 13:23:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chuck Lever X-Patchwork-Id: 13367983 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F14B7C83F11 for ; Mon, 28 Aug 2023 13:24:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230241AbjH1NXh (ORCPT ); Mon, 28 Aug 2023 09:23:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229535AbjH1NXF (ORCPT ); Mon, 28 Aug 2023 09:23:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D3E3811D for ; Mon, 28 Aug 2023 06:23:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6998A6478C for ; Mon, 28 Aug 2023 13:23:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 84440C433C7; Mon, 28 Aug 2023 13:23:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1693228981; bh=eolfdfM7FdyFU8xHf3A0VLjuxhC9mhLGLjxf66QRh0U=; h=Subject:From:To:Cc:Date:From; b=gWGVondqBNPEaNrXLe9p2Ph0TR0gA6+jOyo+Oimwk/PrZCmqYd7udY1J5dTb71Dto M/N3E+zllWEru2/5RA2R5fwOGchkXepjwMyNdXVaZna2mdwR85/rAe/9WHDvCBRxu2 kUlnDZ7Fnm5DGpkkyJ7D6bkkDkOS3tl7adwSmpQckFgry5y7L9EzLb2C1hXzzwSpv1 K43ThhkDrIsRJRYKw6e/8Rxmon237EGXmyW+Cee+cuvly4d3PRTQafbtzvfcmbDRYF /0ipzeGEW3puVj3vNBEKcFzYZqDiD0O1VB6xa/tN1N+/Pu3OSP6BX2DoLa2+Hl9kCU 71dhC8YTFRDLQ== Subject: [PATCH v2] SUNRPC: Fix the recent bv_offset fix From: Chuck Lever To: linux-nfs@vger.kernel.org Cc: Maxim Levitsky , Maxim Levitsky , Chuck Lever Date: Mon, 28 Aug 2023 09:23:00 -0400 Message-ID: <169322894408.11188.14223137341540815863.stgit@bazille.1015granger.net> User-Agent: StGit/1.5 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Chuck Lever Jeff confirmed his original fix addressed his pynfs test failure, but this same bug also impacted qemu: accessing qcow2 virtual disks using direct I/O was failing. Jeff's fix missed that you have to shorten the bio_vec element by the same amount as you increased the page offset. Reported-by: Maxim Levitsky Fixes: c96e2a695e00 ("sunrpc: set the bv_offset of first bvec in svc_tcp_sendmsg") Tested-by: Maxim Levitsky Signed-off-by: Chuck Lever Reviewed-by: Jeff Layton --- net/sunrpc/svcsock.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) v2: - Correct Maxim's email addresses. diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c index 2eb8df44f894..589020ed909d 100644 --- a/net/sunrpc/svcsock.c +++ b/net/sunrpc/svcsock.c @@ -1244,8 +1244,10 @@ static int svc_tcp_sendmsg(struct socket *sock, struct xdr_buf *xdr, if (ret != head->iov_len) goto out; - if (xdr_buf_pagecount(xdr)) + if (xdr_buf_pagecount(xdr)) { xdr->bvec[0].bv_offset = offset_in_page(xdr->page_base); + xdr->bvec[0].bv_len -= offset_in_page(xdr->page_base); + } msg.msg_flags = MSG_SPLICE_PAGES; iov_iter_bvec(&msg.msg_iter, ITER_SOURCE, xdr->bvec,