[CRIU] [RFC PATCH 4/9] fuse: handle stale inode connection in fuse_queue_forget

Bernd Schubert bernd.schubert at fastmail.fm
Fri Mar 3 21:47:26 MSK 2023



On 2/20/23 20:37, Alexander Mikhalitsyn wrote:
> We don't want to send FUSE_FORGET request to the new
> fuse daemon if inode was lookuped by the old fuse daemon
> because it can confuse and break userspace (libfuse).
> 
> For now, just add a new argument to fuse_queue_forget and
> handle it. Adjust all callers to match the old behaviour.
> 
> Cc: Miklos Szeredi <mszeredi at redhat.com>
> Cc: Al Viro <viro at zeniv.linux.org.uk>
> Cc: Amir Goldstein <amir73il at gmail.com>
> Cc: Stéphane Graber <stgraber at ubuntu.com>
> Cc: Seth Forshee <sforshee at kernel.org>
> Cc: Christian Brauner <brauner at kernel.org>
> Cc: Andrei Vagin <avagin at gmail.com>
> Cc: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
> Cc: linux-fsdevel at vger.kernel.org
> Cc: linux-kernel at vger.kernel.org
> Cc: criu at openvz.org
> Signed-off-by: Alexander Mikhalitsyn <aleksandr.mikhalitsyn at canonical.com>
> ---
>   fs/fuse/dev.c    | 4 ++--
>   fs/fuse/dir.c    | 8 ++++----
>   fs/fuse/fuse_i.h | 2 +-
>   fs/fuse/inode.c  | 2 +-
>   4 files changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
> index eb4f88e3dc97..85f69629f34d 100644
> --- a/fs/fuse/dev.c
> +++ b/fs/fuse/dev.c
> @@ -234,7 +234,7 @@ __releases(fiq->lock)
>   }
>   
>   void fuse_queue_forget(struct fuse_conn *fc, struct fuse_forget_link *forget,
> -		       u64 nodeid, u64 nlookup)
> +		       u64 nodeid, u64 nlookup, bool stale_inode_conn)
>   {
>   	struct fuse_iqueue *fiq = &fc->iq;
>   
> @@ -242,7 +242,7 @@ void fuse_queue_forget(struct fuse_conn *fc, struct fuse_forget_link *forget,
>   	forget->forget_one.nlookup = nlookup;
>   
>   	spin_lock(&fiq->lock);
> -	if (fiq->connected) {
> +	if (fiq->connected && !stale_inode_conn) {
>   		fiq->forget_list_tail->next = forget;
>   		fiq->forget_list_tail = forget;
>   		fiq->ops->wake_forget_and_unlock(fiq);

I'm not sure about kernel coding rules here - for me that is unlikely 
rare event - I would have added unlikely() here.


More information about the CRIU mailing list