diff mbox series

[v11,17/18] fuse: prevent disabling io-uring on active connections

Message ID 20250123-fuse-uring-for-6-10-rfc4-v11-17-11e9cecf4cfb@ddn.com (mailing list archive)
State New
Headers show
Series fuse: fuse-over-io-uring | expand

Commit Message

Bernd Schubert Jan. 23, 2025, 2:51 p.m. UTC
The enable_uring module parameter allows administrators to enable/disable
io-uring support for FUSE at runtime. However, disabling io-uring while
connections already have it enabled can lead to an inconsistent state.

Fix this by keeping io-uring enabled on connections that were already using
it, even if the module parameter is later disabled. This ensures active
FUSE mounts continue to function correctly.

Signed-off-by: Bernd Schubert <bschubert@ddn.com>
---
 fs/fuse/dev_uring.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/fs/fuse/dev_uring.c b/fs/fuse/dev_uring.c
index 5a44de5d647ee7259ed9a750d0184deebca1de19..b67bde903c126fcd1426771b4a96071fc37fffba 100644
--- a/fs/fuse/dev_uring.c
+++ b/fs/fuse/dev_uring.c
@@ -1092,11 +1092,6 @@  int __maybe_unused fuse_uring_cmd(struct io_uring_cmd *cmd,
 	u32 cmd_op = cmd->cmd_op;
 	int err;
 
-	if (!enable_uring) {
-		pr_info_ratelimited("fuse-io-uring is disabled\n");
-		return -EOPNOTSUPP;
-	}
-
 	if ((unlikely(issue_flags & IO_URING_F_CANCEL))) {
 		fuse_uring_cancel(cmd, issue_flags);
 		return 0;
@@ -1113,6 +1108,12 @@  int __maybe_unused fuse_uring_cmd(struct io_uring_cmd *cmd,
 	}
 	fc = fud->fc;
 
+	/* Once a connection has io-uring enabled on it, it can't be disabled */
+	if (!enable_uring && !fc->io_uring) {
+		pr_info_ratelimited("fuse-io-uring is disabled\n");
+		return -EOPNOTSUPP;
+	}
+
 	if (fc->aborted)
 		return -ECONNABORTED;
 	if (!fc->connected)