All of lore.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, linux-kernel@vger.kernel.org,
	 kernel-dev@igalia.com
Subject: Re: [RFC PATCH v2] fuse: add optional workqueue to periodically invalidate expired dentries
Date: Tue, 13 May 2025 13:34:47 +0100	[thread overview]
Message-ID: <87tt5o7kpk.fsf@igalia.com> (raw)
In-Reply-To: <CAJfpeguD6jR7AQ=BWs-nKyT4ZV4d35KLM9UPZNzMd-SkcngmzQ@mail.gmail.com> (Miklos Szeredi's message of "Tue, 13 May 2025 11:56:02 +0200")

Hi Miklos,

On Tue, May 13 2025, Miklos Szeredi wrote:

> On Tue, 15 Apr 2025 at 15:38, Luis Henriques <luis@igalia.com> wrote:
>
>> +inval_wq=N
>> +  Enable a workqueue that will periodically invalidate dentries that
>> +  have expired.  'N' is a value in seconds and has to be bigger than
>> +  5 seconds.
>> +
>
> I don't think a mount option is needed.  Perhaps a module option knob
> instead is sufficient?

Sure, that should do the trick.  It'll still be set to zero by default
(i.e. no periodic invalidation), and it won't be possible to tune it per
mount.  Which is probably the right thing to do.

>> +static void fuse_dentry_tree_add_node(struct dentry *dentry)
>> +{
>> +       struct fuse_conn *fc = get_fuse_conn_super(dentry->d_sb);
>> +       struct dentry_node *dn, *cur;
>> +       struct rb_node **p, *parent = NULL;
>> +       bool start_work = false;
>> +
>> +       if (!fc->inval_wq)
>> +               return;
>> +
>> +       dn = kmalloc(sizeof(*dn), GFP_KERNEL);
>> +       if (!dn)
>> +               return;
>> +       dn->dentry = dget(dentry);
>
> A dentry ref without a vfsmount ref is generally bad idea.
>
> Instead of acquiring a ref, the lifetime of dn should be tied to that
> of the dentry (hook into ->d_prune).
>
> So just put the rb_node in fuse_dentry and get rid of the "#if
> BITS_PER_LONG >= 64" optimization.

OK, this probably makes more sense.  I'll have a closer look at the
details, but it seems to be a better option.  Thanks a lot for the
suggestion.  I'll work on that for v3.

Cheers,
-- 
Luís

      reply	other threads:[~2025-05-13 12:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-15 13:38 [RFC PATCH v2] fuse: add optional workqueue to periodically invalidate expired dentries Luis Henriques
2025-04-16 15:55 ` Bernd Schubert
2025-05-05 12:35 ` Luis Henriques
2025-05-13  9:56 ` Miklos Szeredi
2025-05-13 12:34   ` Luis Henriques [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=87tt5o7kpk.fsf@igalia.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.