[<prev] [next>] [day] [month] [year] [list]
Message-ID: <2cd2a86e-587e-41f8-a3a7-883dd02ac5fe@gmail.com>
Date: Sat, 22 Feb 2025 16:28:38 -0600
From: Moinak Bhattacharyya <moinakb001@...il.com>
To: Miklos Szeredi <miklos@...redi.hu>, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org, io-uring@...r.kernel.org,
Amir Goldstein <amir73il@...il.com>, Bernd Schubert <bernd@...ernd.com>
Subject: [PATCH] fuse: return -EOPNOTSUPP directly from backing_open and
backing_close when PASSTHROUGH not supported
Instead of having individual early returns in the ioctl functions,
create static inline functions that return -EOPNOTSUPP when passthrough
is not enabled. This will help potentially adding uring_cmd support to
opening backing files.
---
fs/fuse/dev.c | 6 ------
fs/fuse/fuse_i.h | 13 +++++++++++--
2 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index 5b5f789b37eb..da1f4e8ed3ea 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -2435,9 +2435,6 @@ static long fuse_dev_ioctl_backing_open(struct
file *file,
if (!fud)
return -EPERM;
- if (!IS_ENABLED(CONFIG_FUSE_PASSTHROUGH))
- return -EOPNOTSUPP;
-
if (copy_from_user(&map, argp, sizeof(map)))
return -EFAULT;
@@ -2452,9 +2449,6 @@ static long fuse_dev_ioctl_backing_close(struct
file *file, __u32 __user *argp)
if (!fud)
return -EPERM;
- if (!IS_ENABLED(CONFIG_FUSE_PASSTHROUGH))
- return -EOPNOTSUPP;
-
if (get_user(backing_id, argp))
return -EFAULT;
diff --git a/fs/fuse/fuse_i.h b/fs/fuse/fuse_i.h
index fee96fe7887b..5cb7ab17ad17 100644
--- a/fs/fuse/fuse_i.h
+++ b/fs/fuse/fuse_i.h
@@ -1485,6 +1485,8 @@ static inline struct fuse_backing
*fuse_inode_backing_set(struct fuse_inode *fi,
#ifdef CONFIG_FUSE_PASSTHROUGH
struct fuse_backing *fuse_backing_get(struct fuse_backing *fb);
void fuse_backing_put(struct fuse_backing *fb);
+int fuse_backing_open(struct fuse_conn *fc, struct fuse_backing_map *map);
+int fuse_backing_close(struct fuse_conn *fc, int backing_id);
#else
static inline struct fuse_backing *fuse_backing_get(struct
fuse_backing *fb)
@@ -1495,12 +1497,19 @@ static inline struct fuse_backing
*fuse_backing_get(struct fuse_backing *fb)
static inline void fuse_backing_put(struct fuse_backing *fb)
{
}
+
+static inline int fuse_backing_open(struct fuse_conn *fc, struct
fuse_backing_map *map)
+{
+ return -EOPNOTSUPP;
+}
+static inline int fuse_backing_close(struct fuse_conn *fc, int backing_id)
+{
+ return -EOPNOTSUPP;
+}
#endif
void fuse_backing_files_init(struct fuse_conn *fc);
void fuse_backing_files_free(struct fuse_conn *fc);
-int fuse_backing_open(struct fuse_conn *fc, struct fuse_backing_map *map);
-int fuse_backing_close(struct fuse_conn *fc, int backing_id);
struct fuse_backing *fuse_passthrough_open(struct file *file,
struct inode *inode,
--
2.39.5 (Apple Git-154)
Powered by blists - more mailing lists