[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJfpeguD6jR7AQ=BWs-nKyT4ZV4d35KLM9UPZNzMd-SkcngmzQ@mail.gmail.com>
Date: Tue, 13 May 2025 11:56:02 +0200
From: Miklos Szeredi <miklos@...redi.hu>
To: Luis Henriques <luis@...lia.com>
Cc: Bernd Schubert <bernd@...ernd.com>, Laura Promberger <laura.promberger@...n.ch>,
Dave Chinner <david@...morbit.com>, Matt Harvey <mharvey@...ptrading.com>,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
kernel-dev@...lia.com
Subject: Re: [RFC PATCH v2] fuse: add optional workqueue to periodically
invalidate expired dentries
On Tue, 15 Apr 2025 at 15:38, Luis Henriques <luis@...lia.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?
> +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.
Thanks,
Miklos
Powered by blists - more mailing lists