From: bfields@fieldses.org (J. Bruce Fields)
To: trondmy@kernel.org
Cc: Steve Dickson <SteveD@redhat.com>, linux-nfs@vger.kernel.org
Subject: Re: [PATCH 6/7] mountd: Ignore transient and non-fatal filesystem errors in nfsd_fh()
Date: Mon, 27 Apr 2020 14:38:44 -0400 [thread overview]
Message-ID: <20200427183844.GE31277@fieldses.org> (raw)
In-Reply-To: <20200416221252.82102-7-trondmy@kernel.org>
On Thu, Apr 16, 2020 at 06:12:51PM -0400, trondmy@kernel.org wrote:
> From: Trond Myklebust <trond.myklebust@hammerspace.com>
>
> In nfsd_fh(), if the error returned by the downcall is transient,
> then we should ignore it. Only reject the export if the filesystem
> path is truly not exportable.
> This fixes a case where we can see spurious NFSERR_STALE errors
> being returned by knfsd.
>
> Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
> ---
> utils/mountd/cache.c | 25 +++++++++++++------------
> 1 file changed, 13 insertions(+), 12 deletions(-)
>
> diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c
> index 0f323226b12a..79d3ee085a90 100644
> --- a/utils/mountd/cache.c
> +++ b/utils/mountd/cache.c
> @@ -843,8 +843,14 @@ static void nfsd_fh(int f)
> }
> }
> }
> - if (found &&
> - found->e_mountpoint &&
> +
> + if (!found) {
> + /* The missing dev could be what we want, so just be
> + * quiet rather than returning stale yet
> + */
> + if (dev_missing)
> + goto out;
> + } else if (found->e_mountpoint &&
> !is_mountpoint(found->e_mountpoint[0]?
> found->e_mountpoint:
> found->e_path)) {
> @@ -855,17 +861,12 @@ static void nfsd_fh(int f)
> */
> /* FIXME we need to make sure we re-visit this later */
> goto out;
> + } else if (cache_export_ent(buf, sizeof(buf), dom, found, found_path) < 0) {
> + if (!path_lookup_error(errno))
> + goto out;
> + /* The kernel is saying the path is unexportable */
> + found = NULL;
> }
> - if (!found && dev_missing) {
> - /* The missing dev could be what we want, so just be
> - * quite rather than returning stale yet
> - */
> - goto out;
> - }
> -
> - if (found)
> - if (cache_export_ent(buf, sizeof(buf), dom, found, found_path) < 0)
> - found = 0;
>
> bp = buf; blen = sizeof(buf);
> qword_add(&bp, &blen, dom);
Is everybody else better at reading this kind of patch? Between the
code reshuffling and the conditionals, it's almost totally opaque to me.
I'd have split it up something like the below.--b.
commit b0b623281017
Author: Trond Myklebust <trond.myklebust@hammerspace.com>
Date: Thu Apr 16 18:12:51 2020 -0400
mountd: Ignore transient and non-fatal filesystem errors in nfsd_fh()
In nfsd_fh(), if the error returned by the downcall is transient,
then we should ignore it. Only reject the export if the filesystem
path is truly not exportable.
This fixes a case where we can see spurious NFSERR_STALE errors
being returned by knfsd.
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c
index bcd4b3ce5bb2..0426b171f040 100644
--- a/utils/mountd/cache.c
+++ b/utils/mountd/cache.c
@@ -826,8 +826,12 @@ static void nfsd_fh(int f)
*/
/* FIXME we need to make sure we re-visit this later */
goto out;
- } else if (cache_export_ent(buf, sizeof(buf), dom, found, found_path) < 0)
- found = 0;
+ } else if (cache_export_ent(buf, sizeof(buf), dom, found, found_path) < 0) {
+ if (!path_lookup_error(errno))
+ goto out;
+ /* The kernel is saying the path is unexportable */
+ found = NULL;
+ }
bp = buf; blen = sizeof(buf);
qword_add(&bp, &blen, dom);
commit 931a2e77f954
Author: J. Bruce Fields <bfields@redhat.com>
Date: Mon Apr 27 13:22:30 2020 -0400
rearrange logic; no change in behavior
diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c
index 8f54e37b7936..bcd4b3ce5bb2 100644
--- a/utils/mountd/cache.c
+++ b/utils/mountd/cache.c
@@ -808,8 +808,14 @@ static void nfsd_fh(int f)
}
}
}
- if (found &&
- found->e_mountpoint &&
+
+ if (!found) {
+ /* The missing dev could be what we want, so just be
+ * quiet rather than returning stale yet
+ */
+ if (dev_missing)
+ goto out;
+ } else if (found->e_mountpoint &&
!is_mountpoint(found->e_mountpoint[0]?
found->e_mountpoint:
found->e_path)) {
@@ -820,16 +826,7 @@ static void nfsd_fh(int f)
*/
/* FIXME we need to make sure we re-visit this later */
goto out;
- }
- if (!found && dev_missing) {
- /* The missing dev could be what we want, so just be
- * quite rather than returning stale yet
- */
- goto out;
- }
-
- if (found)
- if (cache_export_ent(buf, sizeof(buf), dom, found, found_path) < 0)
+ } else if (cache_export_ent(buf, sizeof(buf), dom, found, found_path) < 0)
found = 0;
bp = buf; blen = sizeof(buf);
next prev parent reply other threads:[~2020-04-27 18:38 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-16 22:12 [PATCH 0/7] nfs-utils fixes trondmy
2020-04-16 22:12 ` [PATCH 1/7] mountd: Add a helper nfsd_path_statfs64() for uuid_by_path() trondmy
2020-04-16 22:12 ` [PATCH 2/7] nfsd: Support running nfsd_name_to_handle_at() in the root jail trondmy
2020-04-16 22:12 ` [PATCH 3/7] mountd: Fix up path checking helper same_path() trondmy
2020-04-16 22:12 ` [PATCH 4/7] Fix autoconf probe for 'struct nfs_filehandle' trondmy
2020-04-16 22:12 ` [PATCH 5/7] mountd: Ensure dump_to_cache() sets errno appropriately trondmy
2020-04-16 22:12 ` [PATCH 6/7] mountd: Ignore transient and non-fatal filesystem errors in nfsd_fh() trondmy
2020-04-16 22:12 ` [PATCH 7/7] mountd: Check the stat() return values in match_fsid() trondmy
2020-04-27 18:38 ` J. Bruce Fields [this message]
2020-04-27 18:39 ` [PATCH 6/7] mountd: Ignore transient and non-fatal filesystem errors in nfsd_fh() J. Bruce Fields
2020-05-08 14:13 ` [PATCH 0/7] nfs-utils fixes 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=20200427183844.GE31277@fieldses.org \
--to=bfields@fieldses.org \
--cc=SteveD@redhat.com \
--cc=linux-nfs@vger.kernel.org \
--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.