[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220727164328.v5.2.Ia8e6b14cb01caf13a4290236e37b04dff5626bc7@changeid>
Date: Wed, 27 Jul 2022 16:44:25 +1000
From: Daniil Lunev <dlunev@...omium.org>
To: Miklos Szeredi <miklos@...redi.hu>,
Alexander Viro <viro@...iv.linux.org.uk>
Cc: linux-fsdevel@...r.kernel.org, fuse-devel@...ts.sourceforge.net,
Christoph Hellwig <hch@....de>, linux-kernel@...r.kernel.org,
Daniil Lunev <dlunev@...omium.org>
Subject: [PATCH v5 2/2] FUSE: Retire block-device-based superblock on force unmount
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 <dlunev@...omium.org>
---
Changes in v5:
- Restrict retire_super call in FUSE to be issued for fuseblk only.
- Commit message
Changes in v2:
- Use an exported function instead of directly modifying superblock
fs/fuse/inode.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c
index 8c0665c5dff88..9e931f53794bb 100644
--- a/fs/fuse/inode.c
+++ b/fs/fuse/inode.c
@@ -476,8 +476,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)
--
2.31.0
Powered by blists - more mailing lists