lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJfpegtJTUBa7zhY7S-vPCDc+QaJPCg+pH4NR4vN_GgwSAROGA@mail.gmail.com>
Date: Tue, 18 Feb 2025 10:07:00 +0100
From: Miklos Szeredi <miklos@...redi.hu>
To: Luis Henriques <luis@...lia.com>
Cc: Bernd Schubert <bschubert@....com>, Dave Chinner <david@...morbit.com>, 
	Alexander Viro <viro@...iv.linux.org.uk>, Christian Brauner <brauner@...nel.org>, Jan Kara <jack@...e.cz>, 
	Matt Harvey <mharvey@...ptrading.com>, linux-fsdevel@...r.kernel.org, 
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v6 2/2] fuse: add new function to invalidate cache for all inodes

On Mon, 17 Feb 2025 at 14:32, Luis Henriques <luis@...lia.com> wrote:
>
> Currently userspace is able to notify the kernel to invalidate the cache
> for an inode.  This means that, if all the inodes in a filesystem need to
> be invalidated, then userspace needs to iterate through all of them and do
> this kernel notification separately.
>
> This patch adds a new option that allows userspace to invalidate all the
> inodes with a single notification operation.  In addition to invalidate
> all the inodes, it also shrinks the sb dcache.

What is your use case for dropping all inodes?

There's a reason for doing cache shrinking that I know of, and that's
about resources held by the fuse server (e.g. open files) for each
cached inode.  In that case what's really needed is something that
tells the fuse client (the kernel or in case of virtiofs, the guest
kernel) to get rid of the N least recently used inodes.


> Signed-off-by: Luis Henriques <luis@...lia.com>
> ---
>  fs/fuse/inode.c           | 34 ++++++++++++++++++++++++++++++++++
>  include/uapi/linux/fuse.h |  3 +++
>  2 files changed, 37 insertions(+)
>
> diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
> index e9db2cb8c150..64fa0806e97d 100644
> --- a/fs/fuse/inode.c
> +++ b/fs/fuse/inode.c
> @@ -547,6 +547,37 @@ struct inode *fuse_ilookup(struct fuse_conn *fc, u64 nodeid,
>         return NULL;
>  }
>
> +static int fuse_reverse_inval_all(struct fuse_conn *fc)
> +{
> +       struct fuse_mount *fm;
> +       struct inode *inode;
> +
> +       inode = fuse_ilookup(fc, FUSE_ROOT_ID, &fm);
> +       if (!inode || !fm)
> +               return -ENOENT;
> +       iput(inode);
> +
> +       /* Remove all possible active references to cached inodes */
> +       shrink_dcache_sb(fm->sb);
> +
> +       /* Remove all unreferenced inodes from cache */
> +       invalidate_inodes(fm->sb);

After a dcache shrink, this is unnecessary.  See " .drop_inode =
generic_delete_inode," in fs/fuse/inode.c

Thanks,
Miklos

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ