From: Jeff Layton <jlayton@kernel.org>
To: Trond Myklebust <trondmy@hammerspace.com>,
"linux-nfs@vger.kernel.org" <linux-nfs@vger.kernel.org>,
"sagi@grimberg.me" <sagi@grimberg.me>
Cc: "hch@lst.de" <hch@lst.de>,
"dan.aloni@vastdata.com" <dan.aloni@vastdata.com>,
"chuck.lever@oracle.com" <chuck.lever@oracle.com>
Subject: Re: [PATCH rfc] nfs: propagate readlink errors in nfs_symlink_filler
Date: Wed, 22 May 2024 17:20:07 -0400 [thread overview]
Message-ID: <52ca3fe0ef0e70b9ca2b4badb5f4b0d1082e2918.camel@kernel.org> (raw)
In-Reply-To: <e4e181e4a7b2db4b27b6ce3e6bb26b23e514cdb1.camel@hammerspace.com>
On Wed, 2024-05-22 at 21:04 +0000, Trond Myklebust wrote:
> On Wed, 2024-05-22 at 22:40 +0300, Sagi Grimberg wrote:
> > Hey Trond,
> >
> > > > filehandle is stale? There will have been an unlink() on the
> > > > symlink at
> > > > some point in the recent past.
> > > >
> > >
> > > No reason that I can see. However given that this was observed in
> > > the
> > > wild, and essentially
> > > a common pattern with symlinks (overwrite a config file for
> > > example),
> > > I think its reasonable
> > > to have the vfs at least do a single retry, by simply returning
> > > ESTALE.
> > > However NFS cannot distinguish between first and second retries
> > > afaict... Perhaps the
> > > vfs can help with a ESTALE->ENOENT conversion?
> >
> > So what do you suggest we do here? IMO at a minimum NFS should retry
> > once similar
> > to nfs4_file_open (it would probably address 99.9% of the use-cases
> > where symlinks are
> > not overwritten in a high enough frequency for the client to see 2
> > consecutive stale readlink
> > rpc rplies).
> >
> > I can send a patch paired with a vfs ESTALE conversion patch?
> > alternatively retry locally in NFS...
> > I would like to understand your position here.
> >
>
> Looking more closely at nfs_get_link(), it is obvious that it can
> already return ESTALE (thanks to the call to nfs_revalidate_mapping())
> and looking at do_readlinkat(), it has already been plumbed through
> with a call to retry_estale().
>
> So I think we can take your patch as is, since it doesn't add any error
> cases that callers of readlink() don't have to handle already.
>
> We might still want to think about cleaning up the output of the VFS in
> all these cases, so that we don't return ESTALE when it isn't allowed
> by POSIX, but that would be a separate task.
>
I think we can effectively turn ESTALE into ENOENT in most (all?)
syscalls that take a pathname, since you can argue that it would have
been an ENOENT had we gotten in there just a little later.
To fix this the right way, I think you'd have to plumb this translation
into most path-based syscall handlers at a fairly high level. Maybe we
need some sort of generic sanitize_errno() handler that we call from
these sorts of calls?
In any case, I think that's a somewhat larger project. :)
--
Jeff Layton <jlayton@kernel.org>
next prev parent reply other threads:[~2024-05-22 21:20 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-21 12:58 [PATCH rfc] nfs: propagate readlink errors in nfs_symlink_filler Sagi Grimberg
2024-05-21 13:22 ` Jeff Layton
2024-05-21 14:36 ` Dan Aloni
2024-05-21 15:05 ` Sagi Grimberg
2024-05-21 15:13 ` Trond Myklebust
2024-05-21 15:24 ` Chuck Lever III
2024-05-22 4:41 ` Dan Aloni
2024-05-22 12:11 ` Trond Myklebust
2024-05-21 16:09 ` Sagi Grimberg
2024-05-22 19:40 ` Sagi Grimberg
2024-05-22 21:04 ` Trond Myklebust
2024-05-22 21:19 ` Sagi Grimberg
2024-05-30 18:08 ` Sagi Grimberg
2024-05-30 18:21 ` Trond Myklebust
2024-05-31 4:24 ` Sagi Grimberg
2024-05-22 21:20 ` Jeff Layton [this message]
2024-05-21 14:02 ` Chuck Lever
2024-05-21 14:59 ` Sagi Grimberg
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=52ca3fe0ef0e70b9ca2b4badb5f4b0d1082e2918.camel@kernel.org \
--to=jlayton@kernel.org \
--cc=chuck.lever@oracle.com \
--cc=dan.aloni@vastdata.com \
--cc=hch@lst.de \
--cc=linux-nfs@vger.kernel.org \
--cc=sagi@grimberg.me \
--cc=trondmy@hammerspace.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