From: Jeff Layton <jlayton@kernel.org>
To: "Steve Dickson" <steved@redhat.com>,
"Mantas Mikulėnas" <grawity@gmail.com>
Cc: Chuck Lever <cel@kernel.org>,
linux-nfs@vger.kernel.org, Jeff Layton <jlayton@kernel.org>
Subject: [PATCH nfs-utils v3 09/11] mountd: drop a deferred fsid lookup once it has been answered
Date: Mon, 14 Sep 2026 09:14:18 -0400 [thread overview]
Message-ID: <20260914-nl-crossmnt-v3-9-a984a6c94829@kernel.org> (raw)
In-Reply-To: <20260914-nl-crossmnt-v3-0-a984a6c94829@kernel.org>
Building an expkey batch can defer an entry, and a later failure of that
batch sends the same entries through nl_expkey_singly(). An entry that
resolves the second time is answered, but its record stays on
delayed_expkey, so nl_retry_expkey() answers it again within RETRY_SEC.
Take it off the queue instead, as nl_export_singly() already does for
delayed_export. The tuple test nl_delay_expkey() dedups on moves into
delayed_expkey_matches() so both users agree on it.
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Assisted-by: LLM
---
support/export/cache.c | 39 +++++++++++++++++++++++++++++++++++----
1 file changed, 35 insertions(+), 4 deletions(-)
diff --git a/support/export/cache.c b/support/export/cache.c
index 290ce09bb66e..6c887cd50327 100644
--- a/support/export/cache.c
+++ b/support/export/cache.c
@@ -2399,15 +2399,39 @@ static void delayed_expkey_flush(void)
}
}
+/* Does @d hold the deferred form of @req? */
+static bool delayed_expkey_matches(struct delayed_expkey *d,
+ struct expkey_req *req)
+{
+ return d->fsidtype == req->fsidtype &&
+ d->fsidlen == req->fsidlen &&
+ !strcmp(d->client, req->client) &&
+ !memcmp(d->fsid, req->fsid, req->fsidlen);
+}
+
+/* Forget any deferred form of @req; it has been answered */
+static void delayed_expkey_remove(struct expkey_req *req)
+{
+ struct delayed_expkey **dp = &delayed_expkey;
+
+ while (*dp) {
+ struct delayed_expkey *d = *dp;
+
+ if (delayed_expkey_matches(d, req)) {
+ *dp = d->next;
+ delayed_expkey_free(d);
+ return;
+ }
+ dp = &d->next;
+ }
+}
+
static void nl_delay_expkey(struct expkey_req *req)
{
struct delayed_expkey *d;
for (d = delayed_expkey; d; d = d->next)
- if (d->fsidtype == req->fsidtype &&
- d->fsidlen == req->fsidlen &&
- !strcmp(d->client, req->client) &&
- !memcmp(d->fsid, req->fsid, req->fsidlen))
+ if (delayed_expkey_matches(d, req))
return;
d = calloc(1, sizeof(*d));
@@ -2511,6 +2535,11 @@ static enum expkey_result nl_expkey_one(struct expkey_req *req)
return res;
}
+/*
+ * Answer [@start, @end) one at a time. Building the batch may already have
+ * deferred some of these, so an entry that resolves this time has to come back
+ * off the retry queue, or it gets answered a second time.
+ */
static void nl_expkey_singly(struct expkey_req *reqs, int start, int end)
{
int i;
@@ -2518,6 +2547,8 @@ static void nl_expkey_singly(struct expkey_req *reqs, int start, int end)
for (i = start; i < end; i++)
if (nl_expkey_one(&reqs[i]) == EXPKEY_RETRY)
nl_delay_expkey(&reqs[i]);
+ else
+ delayed_expkey_remove(&reqs[i]);
}
/*
--
2.55.0
next prev parent reply other threads:[~2026-09-14 13:14 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-14 13:14 [PATCH nfs-utils v3 00/11] mountd: bugfixes for up/downcall interfaces Jeff Layton
2026-09-14 13:14 ` [PATCH nfs-utils v3 01/11] mountd: factor out the per-path export attribute computation Jeff Layton
2026-09-14 13:14 ` [PATCH nfs-utils v3 02/11] mountd: handle unmountable paths and junctions in the netlink downcall Jeff Layton
2026-09-14 13:14 ` [PATCH nfs-utils v3 03/11] mountd: answer requests the kernel rejects on " Jeff Layton
2026-09-14 13:14 ` [PATCH nfs-utils v3 04/11] mountd: don't leak the parent export's fsid onto crossmnt submounts Jeff Layton
2026-09-14 13:14 ` [PATCH nfs-utils v3 05/11] mountd: retry unresolvable fsid lookups on the netlink downcall Jeff Layton
2026-09-14 13:14 ` [PATCH nfs-utils v3 06/11] mountd: bound the junction path before copying it into e_path Jeff Layton
2026-09-14 13:14 ` [PATCH nfs-utils v3 07/11] mountd: give each worker its own netlink command socket Jeff Layton
2026-09-14 13:14 ` [PATCH nfs-utils v3 08/11] mountd: retry export attributes that fail to resolve for a passing reason Jeff Layton
2026-09-14 13:14 ` Jeff Layton [this message]
2026-09-14 13:14 ` [PATCH nfs-utils v3 10/11] mountd: bound the retry queues Jeff Layton
2026-09-14 13:14 ` [PATCH nfs-utils v3 11/11] mountd: don't warn about pipefs submounts nobody asked to export Jeff Layton
2026-09-15 9:24 ` [PATCH nfs-utils v3 00/11] mountd: bugfixes for up/downcall interfaces Mantas Mikulėnas
2026-09-17 7:21 ` Steve Dickson
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=20260914-nl-crossmnt-v3-9-a984a6c94829@kernel.org \
--to=jlayton@kernel.org \
--cc=cel@kernel.org \
--cc=grawity@gmail.com \
--cc=linux-nfs@vger.kernel.org \
--cc=steved@redhat.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