]> Git Repo - linux.git/commitdiff
fuse: retire block-device-based superblock on force unmount
authorDaniil Lunev <[email protected]>
Wed, 27 Jul 2022 06:44:25 +0000 (16:44 +1000)
committerMiklos Szeredi <[email protected]>
Wed, 27 Jul 2022 09:30:31 +0000 (11:30 +0200)
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.

This patch adds the functionality only for the block-device-based supers,
since the primary use case of the feature is to gracefully handle force
unmount of external devices, mounted with FUSE.  This can be further
extended to cover all superblocks, if the need arises.

Signed-off-by: Daniil Lunev <[email protected]>
Signed-off-by: Miklos Szeredi <[email protected]>
fs/fuse/inode.c

index 7c290089e693ec508a92d3eeaeff35d71195938b..6b3beda16c1ba0a4394d30db7671edd73f2cc034 100644 (file)
@@ -482,8 +482,14 @@ 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);
+
+       // Only retire block-device-based superblocks.
+       if (sb->s_bdev != NULL)
+               retire_super(sb);
 }
 
 static void fuse_send_destroy(struct fuse_mount *fm)
This page took 0.058168 seconds and 4 git commands to generate.