From: Trond Myklebust <trondmy@gmail.com>
To: Chengen Du <chengen.du@canonical.com>, trond.myklebust@hammerspace.com
Cc: anna@kernel.org, linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] NFS: Judge the file access cache's timestamp in rcu path
Date: Wed, 11 Jan 2023 21:48:13 -0500 [thread overview]
Message-ID: <dc5d464d14d45f7df932c1b53d95c84b4f5bbcc3.camel@gmail.com> (raw)
In-Reply-To: <CAPza5qc03KLCWJ5u=yFZ3wtKBDHBNvSM44xOTt2AGd9PoRs0Ow@mail.gmail.com>
On Thu, 2023-01-12 at 09:26 +0800, Chengen Du wrote:
> Hi,
>
> The patch follows the commit 0eb43812c027 but handles the stale cache
> in rcu path.
> The stale cache will remain in the list's tail if no other users
> operate on that inode.
> May I ask if this patch has any other concerns or drawbacks that need
> to be considered?
>
> Best regards,
> Chengen Du
No complaints. The patch has already been merged into 6.2-rc3.
Thanks!
Trond
>
> On Fri, Dec 30, 2022 at 11:05 AM Chengen Du
> <chengen.du@canonical.com> wrote:
> >
> > If the user's login time is newer than the cache's timestamp,
> > we expect the cache may be stale and need to clear.
> > The stale cache will remain in the list's tail if no other
> > users operate on that inode.
> > Once the user accesses the inode, the stale cache will be
> > returned in rcu path.
> >
> > Signed-off-by: Chengen Du <chengen.du@canonical.com>
> > ---
> > fs/nfs/dir.c | 3 +++
> > 1 file changed, 3 insertions(+)
> >
> > diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
> > index ea1ceffa1d3a..d490d64a9ebd 100644
> > --- a/fs/nfs/dir.c
> > +++ b/fs/nfs/dir.c
> > @@ -3023,6 +3023,7 @@ static int nfs_access_get_cached_rcu(struct
> > inode *inode, const struct cred *cre
> > * but do it without locking.
> > */
> > struct nfs_inode *nfsi = NFS_I(inode);
> > + u64 login_time = nfs_access_login_time(current, cred);
> > struct nfs_access_entry *cache;
> > int err = -ECHILD;
> > struct list_head *lh;
> > @@ -3037,6 +3038,8 @@ static int nfs_access_get_cached_rcu(struct
> > inode *inode, const struct cred *cre
> > cache = NULL;
> > if (cache == NULL)
> > goto out;
> > + if ((s64)(login_time - cache->timestamp) > 0)
> > + goto out;
> > if (nfs_check_cache_invalid(inode, NFS_INO_INVALID_ACCESS))
> > goto out;
> > *mask = cache->mask;
> > --
> > 2.37.2
> >
--
Trond Myklebust
Linux NFS client maintainer, Hammerspace
trond.myklebust@hammerspace.com
prev parent reply other threads:[~2023-01-12 2:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-30 3:04 [PATCH] NFS: Judge the file access cache's timestamp in rcu path Chengen Du
2023-01-12 1:26 ` Chengen Du
2023-01-12 2:48 ` Trond Myklebust [this message]
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=dc5d464d14d45f7df932c1b53d95c84b4f5bbcc3.camel@gmail.com \
--to=trondmy@gmail.com \
--cc=anna@kernel.org \
--cc=chengen.du@canonical.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=trond.myklebust@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