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: <CAJfpegs-_sFPnMBwEa-2OSiaNriH6ZvEnM73vNZBiwzrSWFraw@mail.gmail.com>
Date: Wed, 19 Feb 2025 16:39:53 +0100
From: Miklos Szeredi <miklos@...redi.hu>
To: Luis Henriques <luis@...lia.com>
Cc: Dave Chinner <david@...morbit.com>, Bernd Schubert <bschubert@....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, Valentin Volkl <valentin.volkl@...n.ch>, 
	Laura Promberger <laura.promberger@...n.ch>
Subject: Re: [PATCH v6 2/2] fuse: add new function to invalidate cache for all inodes

On Wed, 19 Feb 2025 at 12:23, Luis Henriques <luis@...lia.com> wrote:

> +static int fuse_notify_update_epoch(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);
> +       atomic_inc(&fc->epoch);
> +       shrink_dcache_sb(fm->sb);

This is just an optimization and could be racy, kicking out valid
cache (harmlessly of course).  I'd leave it out of the first version.

There could be more than one fuse_mount instance.  Wondering if epoch
should be per-fm not per-fc...

> @@ -204,6 +204,12 @@ static int fuse_dentry_revalidate(struct inode *dir, const struct qstr *name,
>         int ret;
>
>         inode = d_inode_rcu(entry);
> +       if (inode) {
> +               fm = get_fuse_mount(inode);
> +               if (entry->d_time < atomic_read(&fm->fc->epoch))
> +                       goto invalid;
> +       }

Negative dentries need to be invalidated too.

> @@ -446,6 +452,12 @@ static struct dentry *fuse_lookup(struct inode *dir, struct dentry *entry,
>                 goto out_err;
>
>         entry = newent ? newent : entry;
> +       if (inode) {
> +               struct fuse_mount *fm = get_fuse_mount(inode);
> +               entry->d_time = atomic_read(&fm->fc->epoch);
> +       } else {
> +               entry->d_time = 0;
> +       }

Again, should do the same for positive and negative dentries.

Need to read out fc->epoch before sending the request to the server,
otherwise might get a stale dentry with an updated epoch.

This also needs to be done in fuse_create_open(), create_new_entry()
and fuse_direntplus_link().

Thanks,
Miklos

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ