From: Steve French <smfrench@gmail.com>
To: Shyam Prasad N <nspmangalore@gmail.com>
Cc: "Aurélien Aptel" <aaptel@suse.com>,
CIFS <linux-cifs@vger.kernel.org>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>,
Stable <stable@vger.kernel.org>
Subject: Re: [PATCH v4] cifs: report error instead of invalid when revalidating a dentry fails
Date: Fri, 5 Feb 2021 13:22:31 -0600 [thread overview]
Message-ID: <CAH2r5mvzQa4B2c-=F5f5x=XMxXTius4J=oyHXBGbMAnsxCr2mQ@mail.gmail.com> (raw)
In-Reply-To: <CANT5p=p7Ah_yFsmpj7VCzuoszpf6WiU+G8jws24njXgM_gv_mQ@mail.gmail.com>
On Fri, Feb 5, 2021 at 8:52 AM Shyam Prasad N <nspmangalore@gmail.com> wrote:
>
> Looks good to me.
We do need to find out how a single client test could generate ESTALE
though (perhaps we forgot to drop a dentry on delete or rmdir).
The test is doing fsstress, so should be easy enough to shorten it
and repro and find out exactly why the ESTALE is coming.
> Maybe change the FYI in the cifs_dbg line above to VFS?
Probably safer to put a dynamic trace point there in case EACCES or other rc
becomes too common in some scenario.
> On Fri, Feb 5, 2021 at 6:42 AM Aurélien Aptel <aaptel@suse.com> wrote:
> >
> > From: Aurelien Aptel <aaptel@suse.com>
> >
> > Assuming
> > - //HOST/a is mounted on /mnt
> > - //HOST/b is mounted on /mnt/b
> >
> > On a slow connection, running 'df' and killing it while it's
> > processing /mnt/b can make cifs_get_inode_info() returns -ERESTARTSYS.
> >
> > This triggers the following chain of events:
> > => the dentry revalidation fail
> > => dentry is put and released
> > => superblock associated with the dentry is put
> > => /mnt/b is unmounted
> >
> > This patch makes cifs_d_revalidate() return the error instead of 0
> > (invalid) when cifs_revalidate_dentry() fails, except for ENOENT (file
> > deleted) and ESTALE (file recreated).
> >
> > Signed-off-by: Aurelien Aptel <aaptel@suse.com>
> > Suggested-by: Shyam Prasad N <nspmangalore@gmail.com>
> > CC: stable@vger.kernel.org
> >
> > ---
> > fs/cifs/dir.c | 22 ++++++++++++++++++++--
> > 1 file changed, 20 insertions(+), 2 deletions(-)
> >
> > diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
> > index 68900f1629bff..97ac363b5df16 100644
> > --- a/fs/cifs/dir.c
> > +++ b/fs/cifs/dir.c
> > @@ -737,6 +737,7 @@ static int
> > cifs_d_revalidate(struct dentry *direntry, unsigned int flags)
> > {
> > struct inode *inode;
> > + int rc;
> >
> > if (flags & LOOKUP_RCU)
> > return -ECHILD;
> > @@ -746,8 +747,25 @@ cifs_d_revalidate(struct dentry *direntry, unsigned int flags)
> > if ((flags & LOOKUP_REVAL) && !CIFS_CACHE_READ(CIFS_I(inode)))
> > CIFS_I(inode)->time = 0; /* force reval */
> >
> > - if (cifs_revalidate_dentry(direntry))
> > - return 0;
> > + rc = cifs_revalidate_dentry(direntry);
> > + if (rc) {
> > + cifs_dbg(FYI, "cifs_revalidate_dentry failed with rc=%d", rc);
> > + switch (rc) {
> > + case -ENOENT:
> > + case -ESTALE:
> > + /*
> > + * Those errors mean the dentry is invalid
> > + * (file was deleted or recreated)
> > + */
> > + return 0;
> > + default:
> > + /*
> > + * Otherwise some unexpected error happened
> > + * report it as-is to VFS layer
> > + */
> > + return rc;
> > + }
> > + }
> > else {
> > /*
> > * If the inode wasn't known to be a dfs entry when
> > --
> > 2.29.2
> >
>
>
> --
> Regards,
> Shyam
--
Thanks,
Steve
next prev parent reply other threads:[~2021-02-05 19:26 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-29 17:13 [PATCH v1] cifs: make nested cifs mount point dentries always valid to deal with signaled 'df' Aurélien Aptel
2021-01-31 9:28 ` Shyam Prasad N
2021-02-01 10:31 ` Aurélien Aptel
2021-02-01 16:51 ` Shyam Prasad N
2021-02-02 11:00 ` Aurélien Aptel
2021-02-02 11:16 ` [PATCH v2] cifs: report error instead of invalid when revalidating a dentry fails Aurélien Aptel
2021-02-02 17:09 ` Shyam Prasad N
2021-02-02 17:34 ` Aurélien Aptel
2021-02-02 17:42 ` [PATCH v3] " Aurélien Aptel
2021-02-02 18:26 ` Shyam Prasad N
2021-02-02 18:34 ` Aurélien Aptel
2021-02-03 4:24 ` Shyam Prasad N
2021-02-05 13:32 ` Shyam Prasad N
2021-02-05 14:42 ` [PATCH v4] " Aurélien Aptel
2021-02-05 14:52 ` Shyam Prasad N
2021-02-05 19:22 ` Steve French [this message]
2021-02-05 22:31 ` Steve French
2021-02-03 4:11 ` [PATCH v3] " Steve French
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='CAH2r5mvzQa4B2c-=F5f5x=XMxXTius4J=oyHXBGbMAnsxCr2mQ@mail.gmail.com' \
--to=smfrench@gmail.com \
--cc=aaptel@suse.com \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=nspmangalore@gmail.com \
--cc=stable@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).