public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Luis Henriques <luis@igalia.com>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: Bernd Schubert <bernd@bsbernd.com>,
	 Laura Promberger <laura.promberger@cern.ch>,
	 Dave Chinner <david@fromorbit.com>,
	 Matt Harvey <mharvey@jumptrading.com>,
	 linux-fsdevel@vger.kernel.org, kernel-dev@igalia.com,
	 linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH v5 1/2] fuse: new work queue to periodically invalidate expired dentries
Date: Thu, 04 Sep 2025 16:30:44 +0100	[thread overview]
Message-ID: <87ldmukzff.fsf@wotan.olymp> (raw)
In-Reply-To: <CAJfpeguPytg1b4k3jRuCHzXMUbwh6AT3Q4rptnVoRrHOA0PHMA@mail.gmail.com> (Miklos Szeredi's message of "Thu, 4 Sep 2025 17:12:21 +0200")

On Thu, Sep 04 2025, Miklos Szeredi wrote:

> On Thu, 4 Sept 2025 at 16:00, Luis Henriques <luis@igalia.com> wrote:
>>
>> Hi Miklos,
>>
>> On Thu, Sep 04 2025, Miklos Szeredi wrote:
>>
>> > On Thu, 28 Aug 2025 at 18:30, Luis Henriques <luis@igalia.com> wrote:
>
>> >> +       if (!inval_wq && RB_EMPTY_NODE(&fd->node))
>> >> +               return;
>> >
>> > inval_wq can change to zero, which shouldn't prevent removing from the rbtree.
>>
>> Maybe I didn't understood your comment, but isn't that what's happening
>> here?  If the 'fd' is in a tree, it will be removed, independently of the
>> 'inval_wq' value.
>
> I somehow thought it was || not &&.
>
> But I still don't see the point.  The only caller already checked
> RB_EMPTY_NODE, so that is false. No race possible since it's called
> form the destruction of the dentry, and so this expression is
> guaranteed to evaluate to false.

Fair enough.  I'll drop that code.

>> (By the way, I considered using mutexes here instead.  Do you have any
>> thoughts on this?)
>
> Use mutex where protected code might sleep, spin lock otherwise.
>
>>
>> What I don't understand in your comment is where you suggest these helpers
>> could be in a higher level.  Could you elaborate on what exactly you have
>> in mind?
>
> E.g.
>
> void d_dispose_if_unused(struct dentry *dentry, struct list_head *dispose)
> {
>         spin_lock(&dentry->d_lock);
>         if (!dentry->d_lockref.count)
>                 to_shrink_list(dentry, dispose);
>         spin_unlock(&dentry->d_lock);
> }
>
> Which is in fact taken from d_prune_aliases(), which could be modified
> to use this helper.

Oh! OK, got it.  Thanks, I'll start working on v6 and try to include all
your suggestions.

Cheers,
-- 
Luís

  reply	other threads:[~2025-09-04 15:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-28 16:29 [RFC PATCH v5 0/2] fuse: work queues to invalided dentries Luis Henriques
2025-08-28 16:29 ` [RFC PATCH v5 1/2] fuse: new work queue to periodically invalidate expired dentries Luis Henriques
2025-09-04 10:20   ` Miklos Szeredi
2025-09-04 14:00     ` Luis Henriques
2025-09-04 15:12       ` Miklos Szeredi
2025-09-04 15:30         ` Luis Henriques [this message]
2025-08-28 16:29 ` [RFC PATCH v5 2/2] fuse: new work queue to invalidate dentries from old epochs Luis Henriques
2025-09-04 10:35   ` Miklos Szeredi
2025-09-04 14:11     ` Luis Henriques
2025-09-04 14:38       ` Miklos Szeredi
2025-09-04 15:21         ` Luis Henriques

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=87ldmukzff.fsf@wotan.olymp \
    --to=luis@igalia.com \
    --cc=bernd@bsbernd.com \
    --cc=david@fromorbit.com \
    --cc=kernel-dev@igalia.com \
    --cc=laura.promberger@cern.ch \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mharvey@jumptrading.com \
    --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