linux-unionfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paul Moore <paul@paul-moore.com>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: overlayfs <linux-unionfs@vger.kernel.org>
Subject: Re: [RFC PATCH] ovl: properly release old cache entries in ovl_cache_get()
Date: Tue, 12 Jul 2022 11:26:16 -0400	[thread overview]
Message-ID: <CAHC9VhRnEq1q--n-Xnu251ZhTr5+Nq_nPift55bE-GdXBEc=zQ@mail.gmail.com> (raw)
In-Reply-To: <CAJfpegsAzgOBvBTv48N6e+xjS6h0wFAVjM7z+rFT_FK-va=35w@mail.gmail.com>

On Tue, Jul 12, 2022 at 9:05 AM Miklos Szeredi <miklos@szeredi.hu> wrote:
> On Mon, 11 Jul 2022 at 22:11, Paul Moore <paul@paul-moore.com> wrote:
> > On Fri, Jul 1, 2022 at 10:15 AM Paul Moore <paul@paul-moore.com> wrote:
> > > On Fri, Jul 1, 2022 at 10:11 AM Paul Moore <paul@paul-moore.com> wrote:
> > > >
> > > > If an old readdir cache entry is found during lookup we need to
> > > > ensure that we drop a reference to the old cache entry before
> > > > we remove it from the cache.
> > > >
> > > > Signed-off-by: Paul Moore <paul@paul-moore.com>
> > > > ---
> > > >  fs/overlayfs/readdir.c |   21 +++++++++++----------
> > > >  1 file changed, 11 insertions(+), 10 deletions(-)
> > >
> > > I ran across this a few months ago while working on something related
> > > in overlayfs' readdir cache, unfortunately that work has been shelved
> > > for now, but it seems like this bugfix might still have merit,
> > > although I'll leave that decision up to the overlayfs experts; it's
> > > very possible I've missed an important detail and this isn't actually
> > > a bug.
> > >
> > > I've done some basic manual testing (kernel boots,
> > > mounting/traversal/accesses are all okay), but nothing exhaustive.
> >
> > Based on the lack of a response, should I assume this is not a bug and
> > this patch is not needed?
>
> Hi Paul,
>
> Sorry for the late response.
>
> Yes, the code is okay, though could be better documented.   The logic
> is that only open directories contain counted references to the cache,
> not the directory inode.  The uncounted reference from the inode is
> used to allow sharing the cache in case there are mulitple directory
> readers. Thus the ref from the inode can be dropped without
> decrementing the count, and this reference is reset to NULL when the
> count hits zero.  Locking is provided by i_rwsem.

Great, I'm glad to hear the existing code is working as intended.
Thanks for the explanation too!

-- 
paul-moore.com

      reply	other threads:[~2022-07-12 15:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-01 14:11 [RFC PATCH] ovl: properly release old cache entries in ovl_cache_get() Paul Moore
2022-07-01 14:15 ` Paul Moore
2022-07-11 20:11   ` Paul Moore
2022-07-12 13:04     ` Miklos Szeredi
2022-07-12 15:26       ` Paul Moore [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='CAHC9VhRnEq1q--n-Xnu251ZhTr5+Nq_nPift55bE-GdXBEc=zQ@mail.gmail.com' \
    --to=paul@paul-moore.com \
    --cc=linux-unionfs@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    /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).