2022-06-01 13:56:22

by Daniil Lunev

[permalink] [raw]
Subject: [PATCH v4 2/2] FUSE: Retire superblock on force unmount

From: Daniil Lunev <[email protected]>

Force unmount of FUSE severes the connection with the user space, even
if there are still open files. Subsequent remount tries to re-use the
superblock held by the open files, which is meaningless in the FUSE case
after disconnect - reused super block doesn't have userspace counterpart
attached to it and is incapable of doing any IO.

Signed-off-by: Daniil Lunev <[email protected]>

Signed-off-by: Daniil Lunev <[email protected]>
---

(no changes since v3)

Changes in v3:
- No changes

Changes in v2:
- Use an exported function instead of directly modifying superblock

fs/fuse/inode.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 8c0665c5dff88..8875361544b2a 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -476,8 +476,11 @@ static void fuse_umount_begin(struct super_block *sb)
{
struct fuse_conn *fc = get_fuse_conn_super(sb);

- if (!fc->no_force_umount)
- fuse_abort_conn(fc);
+ if (fc->no_force_umount)
+ return;
+
+ fuse_abort_conn(fc);
+ retire_super(sb);
}

static void fuse_send_destroy(struct fuse_mount *fm)
--
2.31.0



2022-07-12 22:26:52

by Daniil Lunev

[permalink] [raw]
Subject: Re: [PATCH v4 2/2] FUSE: Retire superblock on force unmount

Hi Miklos,
Can you please take a look at the current patchset and see if you are
ok with it?
Thanks,
Daniil

On Wed, Jun 1, 2022 at 11:11 AM Daniil Lunev <[email protected]> wrote:
>
> From: Daniil Lunev <[email protected]>
>
> Force unmount of FUSE severes the connection with the user space, even
> if there are still open files. Subsequent remount tries to re-use the
> superblock held by the open files, which is meaningless in the FUSE case
> after disconnect - reused super block doesn't have userspace counterpart
> attached to it and is incapable of doing any IO.
>
> Signed-off-by: Daniil Lunev <[email protected]>
>
> Signed-off-by: Daniil Lunev <[email protected]>
> ---
>
> (no changes since v3)
>
> Changes in v3:
> - No changes
>
> Changes in v2:
> - Use an exported function instead of directly modifying superblock
>
> fs/fuse/inode.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
> index 8c0665c5dff88..8875361544b2a 100644
> --- a/fs/fuse/inode.c
> +++ b/fs/fuse/inode.c
> @@ -476,8 +476,11 @@ static void fuse_umount_begin(struct super_block *sb)
> {
> struct fuse_conn *fc = get_fuse_conn_super(sb);
>
> - if (!fc->no_force_umount)
> - fuse_abort_conn(fc);
> + if (fc->no_force_umount)
> + return;
> +
> + fuse_abort_conn(fc);
> + retire_super(sb);
> }
>
> static void fuse_send_destroy(struct fuse_mount *fm)
> --
> 2.31.0
>

2022-07-18 10:06:24

by Miklos Szeredi

[permalink] [raw]
Subject: Re: [PATCH v4 2/2] FUSE: Retire superblock on force unmount

On Wed, 1 Jun 2022 at 03:11, Daniil Lunev <[email protected]> wrote:
>
> From: Daniil Lunev <[email protected]>
>
> Force unmount of FUSE severes the connection with the user space, even
> if there are still open files. Subsequent remount tries to re-use the
> superblock held by the open files, which is meaningless in the FUSE case
> after disconnect - reused super block doesn't have userspace counterpart
> attached to it and is incapable of doing any IO.
>
> Signed-off-by: Daniil Lunev <[email protected]>
>
> Signed-off-by: Daniil Lunev <[email protected]>

Why the double sign-off?

> ---
>
> (no changes since v3)
>
> Changes in v3:
> - No changes
>
> Changes in v2:
> - Use an exported function instead of directly modifying superblock
>
> fs/fuse/inode.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
> index 8c0665c5dff88..8875361544b2a 100644
> --- a/fs/fuse/inode.c
> +++ b/fs/fuse/inode.c
> @@ -476,8 +476,11 @@ static void fuse_umount_begin(struct super_block *sb)
> {
> struct fuse_conn *fc = get_fuse_conn_super(sb);
>
> - if (!fc->no_force_umount)
> - fuse_abort_conn(fc);
> + if (fc->no_force_umount)
> + return;
> +
> + fuse_abort_conn(fc);
> + retire_super(sb);

And this is called for both block and non-block supers. Which means
that the bdi will be unregistered, yet the sb could still be reused
(see fuse_test_super()).

Thanks,
Miklos

2022-07-22 00:57:46

by Daniil Lunev

[permalink] [raw]
Subject: Re: [PATCH v4 2/2] FUSE: Retire superblock on force unmount

Hi Miklos,
Thanks for your response and apologies for my delayed reply.

> Why the double sign-off?
Some misconfiguration on my side. I will remove the extra line in the
next patch version

> And this is called for both block and non-block supers. Which means
> that the bdi will be unregistered, yet the sb could still be reused
> (see fuse_test_super()).

Just to confirm my understanding, fuse_test_super needs to have the
same check as the super.c test_* function, correct?
--Daniil

2022-07-26 08:13:45

by Miklos Szeredi

[permalink] [raw]
Subject: Re: [PATCH v4 2/2] FUSE: Retire superblock on force unmount

On Fri, 22 Jul 2022 at 02:50, Daniil Lunev <[email protected]> wrote:
>
> Hi Miklos,
> Thanks for your response and apologies for my delayed reply.
>
> > Why the double sign-off?
> Some misconfiguration on my side. I will remove the extra line in the
> next patch version
>
> > And this is called for both block and non-block supers. Which means
> > that the bdi will be unregistered, yet the sb could still be reused
> > (see fuse_test_super()).
>
> Just to confirm my understanding, fuse_test_super needs to have the
> same check as the super.c test_* function, correct?

Or make calling retire_super() conditional on sb->s_bdev != NULL.

Please only enable this for non-bdev fuse (which is the vast majority
of cases) if it's justified. Otherwise it will just be a source of
bugs.

Thanks,
Miklos