Re: [RFC PATCH] ovl: properly release old cache entries in ovl_cache_get()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jul 12, 2022 at 9:05 AM Miklos Szeredi <miklos@xxxxxxxxxx> wrote:
> On Mon, 11 Jul 2022 at 22:11, Paul Moore <paul@xxxxxxxxxxxxxx> wrote:
> > On Fri, Jul 1, 2022 at 10:15 AM Paul Moore <paul@xxxxxxxxxxxxxx> wrote:
> > > On Fri, Jul 1, 2022 at 10:11 AM Paul Moore <paul@xxxxxxxxxxxxxx> 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@xxxxxxxxxxxxxx>
> > > > ---
> > > >  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



[Index of Archives]     [Linux Filesystems Devel]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux