* [PATCH] fuse: return -EOPNOTSUPP directly from backing_open and backing_close when PASSTHROUGH not supported
@ 2025-02-22 22:28 Moinak Bhattacharyya
0 siblings, 0 replies; only message in thread
From: Moinak Bhattacharyya @ 2025-02-22 22:28 UTC (permalink / raw)
To: Miklos Szeredi, linux-fsdevel, linux-kernel, io-uring,
Amir Goldstein, Bernd Schubert
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)
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2025-02-22 22:28 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-22 22:28 [PATCH] fuse: return -EOPNOTSUPP directly from backing_open and backing_close when PASSTHROUGH not supported Moinak Bhattacharyya
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.