All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton@kernel.org>
To: Steve Dickson <steved@redhat.com>, Chuck Lever <cel@kernel.org>,
	 NeilBrown <neil@brown.name>,
	Olga Kornievskaia <okorniev@redhat.com>,
	 Dai Ngo <Dai.Ngo@oracle.com>, Tom Talpey <tom@talpey.com>,
	 Trond Myklebust <trondmy@kernel.org>,
	Anna Schumaker <anna@kernel.org>,
	 Mike Snitzer <snitzer@kernel.org>
Cc: linux-nfs@vger.kernel.org, Jeff Layton <jlayton@kernel.org>
Subject: [PATCH nfs-utils v2 1/4] exportfs/mountd/exportd: track the svc_export policy highest attribute
Date: Thu, 29 Oct 2026 08:10:08 -0400	[thread overview]
Message-ID: <20261029-master-v2-1-32bfc6ac16da@kernel.org> (raw)
In-Reply-To: <20261029-master-v2-0-32bfc6ac16da@kernel.org>

Record max_attr, the highest attribute in the kernel svc_export netlink
policy, in struct nfsd_export_policy. Follow-on work needs it to avoid
sending attributes that an older kernel would reject the whole entry
over.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 support/export/export_policy.c | 7 ++++++-
 support/include/exportfs.h     | 2 ++
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/support/export/export_policy.c b/support/export/export_policy.c
index 9c0a099fb0c2..a0170cb87f91 100644
--- a/support/export/export_policy.c
+++ b/support/export/export_policy.c
@@ -40,6 +40,7 @@ struct export_policy_dump {
 	int		done;
 	int		do_idx;		/* the op's own policy */
 	/* per policy: */
+	int		max_attr[NL_POLICY_SLOTS];
 	int		reqs_idx[NL_POLICY_SLOTS];	/* REQUESTS nests this */
 	uint64_t	flags_mask[NL_POLICY_SLOTS];	/* mask of FLAGS */
 };
@@ -106,6 +107,8 @@ static void nl_policy_attrs(struct export_policy_dump *d, struct nlattr *attr)
 		nla_for_each_nested(a, pol, arem) {
 			int type = nla_type(a);
 
+			if (d->max_attr[idx] < type)
+				d->max_attr[idx] = type;
 			nla_for_each_nested(p, a, rem)
 				nl_policy_type_attr(d, idx, type, p);
 		}
@@ -219,8 +222,10 @@ int nfsd_export_policy_query(struct nfsd_export_policy *pol)
 	 * every kernel with the netlink export interface.
 	 */
 	cached.secinfo_flags = NFSEXP_SECINFO_FLAGS;
+	cached.max_attr = d.max_attr[svc];
 	have_cached = true;
-	xlog(D_NETLINK, "svc_export policy: flags 0x%x", cached.flags);
+	xlog(D_NETLINK, "svc_export policy: max attribute %d, flags 0x%x",
+	     cached.max_attr, cached.flags);
 	*pol = cached;
 	ret = 0;
 out:
diff --git a/support/include/exportfs.h b/support/include/exportfs.h
index d762e4533560..a7c145543075 100644
--- a/support/include/exportfs.h
+++ b/support/include/exportfs.h
@@ -170,6 +170,8 @@ struct nfskey *			key_lookup(char *hname);
 struct nfsd_export_policy {
 	unsigned int	flags;		/* export flags it knows */
 	unsigned int	secinfo_flags;	/* flags that may vary per flavor */
+	int		max_attr;	/* highest svc_export netlink attribute,
+					 * 0 if it did not say */
 };
 
 struct nfsd_export_policy *get_export_features(void);

-- 
2.56.0


  reply	other threads:[~2026-10-29 12:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-29 12:10 [PATCH nfs-utils v2 0/4] exports: add support for new read_io= and write_io= export options Jeff Layton
2026-10-29 12:10 ` Jeff Layton [this message]
2026-10-29 12:10 ` [PATCH nfs-utils v2 2/4] exports: Add " Jeff Layton
2026-10-29 12:10 ` [PATCH nfs-utils v2 3/4] exportfs: Display and document read_io= and write_io= Jeff Layton
2026-10-29 12:10 ` [PATCH nfs-utils v2 4/4] nfsd-iomode-advisor: recommend read_io= and write_io= for an export 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=20261029-master-v2-1-32bfc6ac16da@kernel.org \
    --to=jlayton@kernel.org \
    --cc=Dai.Ngo@oracle.com \
    --cc=anna@kernel.org \
    --cc=cel@kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=neil@brown.name \
    --cc=okorniev@redhat.com \
    --cc=snitzer@kernel.org \
    --cc=steved@redhat.com \
    --cc=tom@talpey.com \
    --cc=trondmy@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.