From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.221.53 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796181393; b=R3NGEDM52lcUQPS8FKTLhgC3me90TUgRsOOjVkv04AfaWqMumvYx7kX4DssUnA1ASbzy Qg54DEk+ofVM0Ca1knNTAQOkZUhqSs4Qja0/W3abjUWY9ClWdwRi/vZ9eSt/a2orjIPDa xQDZtos6fAfNR5y3BPbLxaYcFJvMhhCDBeSLgEQI1nVKFDvlCVGfYJhv+QAPe7cWHyQRl 7+HCvv4zkPChJSg4201kIEwEP5AkW4wgVvG9rhxKcbIZQWuo+RQxbnX1S3mKT3Pa39nhv ab+yi05OtPU6fRwRpBMfJYEpMompTvNJlUPJWd0au9VSXkkMDxKYoY3j79n2gKU0vIw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796181393; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:To:Cc:Subject: Date:Message-ID:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding; bh=MFnhCBnacDUaOYriqRMjzR/uB+jr1W46x1yRvdeo74A=; b=u5W7VNSVu5mecViTqPSlZFY7QYycK2LeygU4R6E+ciS07IThBS+aXvHvxggnEOLLqd8U jSeN4wXe8/48S9wu3+uPNXH4AYruGTavpSBmAMqGbZt2LsFBYnqdgIbczp16kl7z0zCsk XfKaZDbtqx0PVzzwonbx+L00C5ixzdRh9L6dvQaH4APeuEj6d4o0OvioSTmSgwXjH1u1t E0FVIsCrzoGSkKfOC9I2D2GXmWZUhz3Ktb+lxauySxMdjEBWzbtJytf059EK80cNd/jT9 iecyDuOYeUpFvdykDBtczT/3nd4cMH1m3lghUIzB0t4GpihbH4eVwALD+JzOEbJXMKA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=Xk4UaZ8I; arc=none smtp.remote-ip=209.85.221.53 Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 818F8606A6B7 for ; Wed, 2 Dec 2026 03:16:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 818F8606A6B7 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=Xk4UaZ8I Received: by mail-wr1-f53.google.com with SMTP id ffacd0b85a97d-48e47347279so7643985f8f.1 for ; Tue, 01 Dec 2026 19:16:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796181392; x=1796786192; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=MFnhCBnacDUaOYriqRMjzR/uB+jr1W46x1yRvdeo74A=; b=Xk4UaZ8IQY9tMl9dlKstv094UFwCatWswyYb6/pgNM40ciiKPEla+sX+XpCQt1oXSY Z9YUTvpCqOhQ975CrZ9SMxB5/mNasz89F9Go11Zgu1BbBt9dpGGZZL/89VN62eqpn0sg 5ENGsgRzzYrPHJCmG0nQWiCutkbVWIfAGpoZe1IoBVmnFh0pbWDJe2VuuZ/7D1iiMJ5/ t9ly9HD9r1wieVQxdsIMJRhpN4xDZ2TedxZ+q+wxDLSLrfc+Q/5W3MlO7CcdDakQSfkY GqQcoG4GkMD/j/LZUgbvPauDmokxMjMrxcutoZOLskr4nR8KJ56L6leEarAvYYm+OCt4 GIZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796181392; x=1796786192; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=MFnhCBnacDUaOYriqRMjzR/uB+jr1W46x1yRvdeo74A=; b=XEDx+NMvJMJPQLGAh1XWct1crE/Y3wVVyiLSXeAOsRrE12Wqehpb7cCodvAICg0TU9 k9CmmgvbtN78y/LtCvPZh8/MR2J2UwBXvMZ4y9yiNjUvnvwcZDSOcbvHJ7WEJsWWoC+c XDNkAmRnI7xn/2doSnLl6tkJl/C8zTzVh0TKJpQNDNvWWGxYCrkX7dBHkA+QBpeACumo DI1/rf6dqfHxDid8EyF9x1I2QmgpkkoWDXaJprxMDD/gc/MrFM+2v1E2rqzucQu2yXcY +jT8LBCr91ziXDVI6YQ8WPpiyQbstIUfg49kGLyZcQcKE2FD6uVfSCoDrG17BvZtGKaf eUJw== X-Gm-Message-State: APuU4Z8d6CfdhQWAeq9QpOJVUlFzfTPOHeVfrTt/ZyYy21Oc8dJNZ26j sSzV0Y7BG7I9A00yPByoxJnkCkvfC1ui25r+xkyojTID4iUAxoqHpuDsVgpnwlmdJlCFd09s X-Gm-Gg: AZFdTZdlTTf0KLhggnvjx0wpPL0ZOReVN4jWA1eBxJr51hGYzOqcm3VCKvD+eHmz94V BSwsU+rnRlG2VwQRbKTR9sbyJ/Sb09lsvv7Zrnzm3IuNWKH5XBrvgOMdhivmsEmOrpiaPnwqrQK 9DTpvTcyRweWLnB9tc78RWVMVzLk8o0L5vuz5YqWPotcz7e5dob0PIUbR+rNAQyypVCPpEqq3GS zdNA8SRTA8sg/wZW9qFhyBKs4E4H+4lQM6GeNhLU7rlHS19GMv0Bjw7kr5+KVRYz8VfEysC3ECc U3ZZPGwS1QxvCPLlg+Nt5pMNiraUj5YwnzvGNFcz9eyDCP+h052HyGLKC2gArbKYU6EHzUYxK+y 9y9WZBKY3zrn+jWn8hw5haaTiP/ofMACt2rE0rCH4JwOqaVx5tHHOAOIKDZbUSPywFh8QbhKpZp 9RlYWdl9DymlUqA4LG/9dlpmisMrCeLJA610s/5QZx5GH4HcB6iNz6fUTLiManBnM6K9bqEADtA DGft8oAcYkymCwRM6dltMzXS0Z+fUvNaNFb655Jxbba3aH97uDSUxuOsuvmS2FasuAxq0wmfhWM 9eiAX+eI4WXx1dYc5fdeP9fiQKp87Y4TPG/UtYsarCNd48N5qODld/+RQwQ= X-Received: by 2002:a05:6000:4809:b0:4aa:842f:5f78 with SMTP id ffacd0b85a97d-4abb759e947mr71952728f8f.46.1796181391818; Tue, 01 Dec 2026 19:16:31 -0800 (PST) Received: from NULL.Home.net ([2001:8a0:7280:4000:12d:c3b9:cecc:8966]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4ab65cb4341sm73334766f8f.4.2026.12.01.19.16.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Dec 2026 19:16:31 -0800 (PST) From: Eric Curtin To: linux-kernel@vger.kernel.org Cc: Ryan Roberts , Trond Myklebust , Anna Schumaker , linux-nfs@vger.kernel.org Subject: [RFC PATCH v2 20/22] NFSv4: Use PAGE_SIZE_MIN to size ACL and xattr page arrays Date: Wed, 2 Dec 2026 03:15:23 +0000 Message-ID: <20261202031533.1665444-21-ericcurtin17@gmail.com> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261202031533.1665444-1-ericcurtin17@gmail.com> References: <20261202031533.1665444-1-ericcurtin17@gmail.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Ryan Roberts With boot-time page size selection PAGE_SIZE is not a compile-time constant, but NFS4ACL_MAXPAGES and NFS4XATTR_MAXPAGES are used to size on-stack page pointer arrays. Compute both from PAGE_SIZE_MIN, which gives the largest possible page count. Likewise, make the BUILD_BUG_ON() in nfs4_xattr_alloc_entry() compare against PAGE_SIZE_MIN; if it holds for the smallest page size it holds for all of them. No functional change for compile-time page sizes. Signed-off-by: Ryan Roberts Signed-off-by: Eric Curtin --- fs/nfs/nfs42proc.c | 2 +- fs/nfs/nfs42xattr.c | 2 +- fs/nfs/nfs4proc.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/nfs/nfs42proc.c b/fs/nfs/nfs42proc.c index 09b4a6ecad88..c22b76034c9b 100644 --- a/fs/nfs/nfs42proc.c +++ b/fs/nfs/nfs42proc.c @@ -1388,7 +1388,7 @@ int nfs42_proc_clone(struct file *src_f, struct file *dst_f, return err; } -#define NFS4XATTR_MAXPAGES DIV_ROUND_UP(XATTR_SIZE_MAX, PAGE_SIZE) +#define NFS4XATTR_MAXPAGES DIV_ROUND_UP(XATTR_SIZE_MAX, PAGE_SIZE_MIN) static int _nfs42_proc_removexattr(struct inode *inode, const char *name) { diff --git a/fs/nfs/nfs42xattr.c b/fs/nfs/nfs42xattr.c index 37d79400e5f4..4eb6870dd618 100644 --- a/fs/nfs/nfs42xattr.c +++ b/fs/nfs/nfs42xattr.c @@ -183,7 +183,7 @@ nfs4_xattr_alloc_entry(const char *name, const void *value, uint32_t flags; BUILD_BUG_ON(sizeof(struct nfs4_xattr_entry) + - XATTR_NAME_MAX + 1 > PAGE_SIZE); + XATTR_NAME_MAX + 1 > PAGE_SIZE_MIN); alloclen = sizeof(struct nfs4_xattr_entry); if (name != NULL) { diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 6759fa61b9b4..5cc547a1d9b9 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -6003,7 +6003,7 @@ static bool nfs4_server_supports_acls(const struct nfs_server *server, * it's OK to put sizeof(void) * (XATTR_SIZE_MAX/PAGE_SIZE) bytes on * the stack. */ -#define NFS4ACL_MAXPAGES DIV_ROUND_UP(XATTR_SIZE_MAX, PAGE_SIZE) +#define NFS4ACL_MAXPAGES DIV_ROUND_UP(XATTR_SIZE_MAX, PAGE_SIZE_MIN) int nfs4_buf_to_pages_noslab(const void *buf, size_t buflen, struct page **pages)