Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1448673rwd; Wed, 31 May 2023 14:14:40 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5twIPJe4hH2uUfBxQpez51i4xOb1ffA7WtvRQ5lEiq0Ggc74sFVq1FIdoSduzJpTMiSBOn X-Received: by 2002:a92:c90e:0:b0:33c:792a:af50 with SMTP id t14-20020a92c90e000000b0033c792aaf50mr1911128ilp.4.1685567680379; Wed, 31 May 2023 14:14:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685567680; cv=none; d=google.com; s=arc-20160816; b=DFzRtOy+RwJS/MJnpj2k+ceEvooGdPNBHcpdGS6kqEYtipYGRTltrCnm1mD9I4hMZq LfKEnGkTeS0hQRV9/Sso66Wcft+6gGpvP+Zxfnwd30mYto3whQShsiDty3KZ+pzGyHJQ 8u3HUNhjzzfkIp7XxiBV8lNtJloqVVuvU4VFb/yXcZuXROEtVLxV+QhZT6vpjvXqYuXg 3U1y1AnqRonilI9MEh7blXOW0wz7pzJHjq9UVnaMxYd/tIAB099nptZll2lsKL/LvKVX zsfQBHIuoFAhyVMShShY7I7A7Zxnrp5vtCubB+fPTYbm5NgEhZ4YQ1QMGO/rpA/rrnPh PiPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=fn8E1HqEguWazlHUwVMoe1iG0FoHoRcTILz8HVUgJwk=; b=chm0jpIduktx8KzNZddrdYAEtvOGM65RE3DSBPNeV64SyKdvkWVkY1ooI8bhEjKZvn dN2Tm0hvaLxtL4UD3PybtG6h9dx7WEv/1SzObDp1hDlHiHIIHcHBVpwg0lWNm824n1ca swh+BaU6yWiyjBnf9cTJSeaUF8y1p+X3nUbTc+Apb1CTispqUjdCDwZ/r2wY8UEQMA0y TkwL2PzAdHEiO5lafEKZ64EQDLz239gEQW745gOAjPqrnmkBh/gTewIaUep0IOx6Zmg9 Mp9rMAh0yhCq74pEFwJR6XlUa11OrftODQcuQNlmDfdqJy8hgQ0P3Q60f2l2rUzQQjPf 8FGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=aJBbaAfy; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a21-20020a63e855000000b0053fb78a9abesi1752512pgk.411.2023.05.31.14.13.43; Wed, 31 May 2023 14:14:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=aJBbaAfy; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229498AbjEaVEa (ORCPT + 99 others); Wed, 31 May 2023 17:04:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229473AbjEaVE3 (ORCPT ); Wed, 31 May 2023 17:04:29 -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 1E9F212C for ; Wed, 31 May 2023 14:04:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A756363EF0 for ; Wed, 31 May 2023 21:04:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BFF2EC4339B; Wed, 31 May 2023 21:04:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1685567067; bh=mLobkdxWduNl033ol7EE4rRt6HDCpV3ARhe0HobECpE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aJBbaAfyd5YStKbH8CTZe6C94w/L6+glKZAvQ8OvmIG4qmYsj3OjY0GIP5IgVdVWQ fZqnaIgg65+TM+Feq/ngS5OZbmQ9Kxmg0Nwu1LVWnnJo4g05l1o9kL3SZOhmb80iPY UnAmpTDY81Sl+qaJ1agC0jg+L28pKBlAG/M5pLNgz98nU/D1tSqPBAgFJNTQETnLlT Ky2n77ALKcH0CcaI9dzKW67kFan1xk2IBj5W4HaEujSHd7dTUPlnsdI/fc0uvIVLKe sTYehMh1JEjMJm45HPlzbBIsElg4wROQMwKvlx0J1M+cSK4VNHe6/WUiLxd1UcsWCp 02uT51cwNQw+A== From: Anna Schumaker To: linux-nfs@vger.kernel.org, trond.myklebust@hammerspace.com Cc: anna@kernel.org Subject: [PATCH 2/2] NFSv4.2: Fix READ_PLUS size calculations Date: Wed, 31 May 2023 17:04:24 -0400 Message-Id: <20230531210424.360948-2-anna@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230531210424.360948-1-anna@kernel.org> References: <20230531210424.360948-1-anna@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Anna Schumaker I bump the decode_read_plus_maxsz to account for hole segments, but I need to subtract out this increase when calling rpc_prepare_reply_pages() so the common case of single data segment replies can be directly placed into the xdr pages without needing to be shifted around. Reported-by: Chuck Lever Fixes: d3b00a802c845 ("NFS: Replace the READ_PLUS decoding code") Signed-off-by: Anna Schumaker --- fs/nfs/nfs42xdr.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/fs/nfs/nfs42xdr.c b/fs/nfs/nfs42xdr.c index ef3b150970ff..75765382cc0e 100644 --- a/fs/nfs/nfs42xdr.c +++ b/fs/nfs/nfs42xdr.c @@ -51,10 +51,16 @@ (1 /* data_content4 */ + \ 2 /* data_info4.di_offset */ + \ 1 /* data_info4.di_length */) +#define NFS42_READ_PLUS_HOLE_SEGMENT_SIZE \ + (1 /* data_content4 */ + \ + 2 /* data_info4.di_offset */ + \ + 2 /* data_info4.di_length */) +#define READ_PLUS_SEGMENT_SIZE_DIFF (NFS42_READ_PLUS_HOLE_SEGMENT_SIZE - \ + NFS42_READ_PLUS_DATA_SEGMENT_SIZE) #define decode_read_plus_maxsz (op_decode_hdr_maxsz + \ 1 /* rpr_eof */ + \ 1 /* rpr_contents count */ + \ - NFS42_READ_PLUS_DATA_SEGMENT_SIZE) + NFS42_READ_PLUS_HOLE_SEGMENT_SIZE) #define encode_seek_maxsz (op_encode_hdr_maxsz + \ encode_stateid_maxsz + \ 2 /* offset */ + \ @@ -781,8 +787,8 @@ static void nfs4_xdr_enc_read_plus(struct rpc_rqst *req, encode_putfh(xdr, args->fh, &hdr); encode_read_plus(xdr, args, &hdr); - rpc_prepare_reply_pages(req, args->pages, args->pgbase, - args->count, hdr.replen); + rpc_prepare_reply_pages(req, args->pages, args->pgbase, args->count, + hdr.replen - READ_PLUS_SEGMENT_SIZE_DIFF); encode_nops(&hdr); } -- 2.40.1