Re: [RFC PATCH v5 2/2] fuse: new work queue to invalidate dentries from old epochs

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

 



On Thu, Sep 04 2025, Miklos Szeredi wrote:

> On Thu, 28 Aug 2025 at 18:30, Luis Henriques <luis@xxxxxxxxxx> wrote:
>>
>> With the infrastructure introduced to periodically invalidate expired
>> dentries, it is now possible to add an extra work queue to invalidate
>> dentries when an epoch is incremented.  This work queue will only be
>> triggered when the 'inval_wq' parameter is set.
>>
>> Signed-off-by: Luis Henriques <luis@xxxxxxxxxx>
>> ---
>>  fs/fuse/dev.c    |  7 ++++---
>>  fs/fuse/dir.c    | 34 ++++++++++++++++++++++++++++++++++
>>  fs/fuse/fuse_i.h |  4 ++++
>>  fs/fuse/inode.c  | 41 ++++++++++++++++++++++-------------------
>>  4 files changed, 64 insertions(+), 22 deletions(-)
>>
>> diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
>> index e80cd8f2c049..48c5c01c3e5b 100644
>> --- a/fs/fuse/dev.c
>> +++ b/fs/fuse/dev.c
>> @@ -2033,13 +2033,14 @@ static int fuse_notify_resend(struct fuse_conn *fc)
>>
>>  /*
>>   * Increments the fuse connection epoch.  This will result of dentries from
>> - * previous epochs to be invalidated.
>> - *
>> - * XXX optimization: add call to shrink_dcache_sb()?
>
> I guess it wouldn't hurt.   Definitely simpler, so I'd opt for this.

So, your suggesting to have the work queue simply calling this instead of
walking through the dentries?  (Or even *not* having a work queue at all?)

>>  void fuse_conn_put(struct fuse_conn *fc)
>>  {
>> -       if (refcount_dec_and_test(&fc->count)) {
>> -               struct fuse_iqueue *fiq = &fc->iq;
>> -               struct fuse_sync_bucket *bucket;
>> -
>> -               if (IS_ENABLED(CONFIG_FUSE_DAX))
>> -                       fuse_dax_conn_free(fc);
>> -               if (fc->timeout.req_timeout)
>> -                       cancel_delayed_work_sync(&fc->timeout.work);
>> -               if (fiq->ops->release)
>> -                       fiq->ops->release(fiq);
>> -               put_pid_ns(fc->pid_ns);
>> -               bucket = rcu_dereference_protected(fc->curr_bucket, 1);
>> -               if (bucket) {
>> -                       WARN_ON(atomic_read(&bucket->count) != 1);
>> -                       kfree(bucket);
>> -               }
>> -               if (IS_ENABLED(CONFIG_FUSE_PASSTHROUGH))
>> -                       fuse_backing_files_free(fc);
>> -               call_rcu(&fc->rcu, delayed_release);
>> +       struct fuse_iqueue *fiq = &fc->iq;
>> +       struct fuse_sync_bucket *bucket;
>> +
>> +       if (!refcount_dec_and_test(&fc->count))
>> +               return;
>
> Please don't do this.  It's difficult to see what actually changed this way.

Right, that didn't occur to me.  Sorry.  I'll probably add a separate
patch to re-indent this function, which makes it easier to read in my
opinion.  Not sure that's acceptable, so feel free to drop it silently :-)

Cheers,
-- 
Luís





[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux