Skip to contentSkip to conversation

fuse: fix link error with CONFIG_FUSE_PASSTHROUGH=n

PATCH New Sasha Levin 1 participant 1 message Oct 26 FUSE filesystem core

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fuse: fix link error with CONFIG_FUSE_PASSTHROUGH=n

Commit 2f19d54c055d ("fuse: support 64 bit, server allocated backing ID") moved the CONFIG_FUSE_PASSTHROUGH check out of the backing ioctl handlers and into fuse_get_conn_for_passthrough(). The calls from the handlers into backing.c, which is only built with CONFIG_FUSE_PASSTHROUGH, are now only removed if the compiler inlines that helper. It does not have to, and with gcc 11 and CONFIG_CC_OPTIMIZE_FOR_SIZE it doesn't:

dev.c:(.text+0x355c): undefined reference to `fuse_backing_open'
nios2-linux-ld: dev.c:(.text+0x3594): undefined reference to `fuse_backing_open_64'
nios2-linux-ld: dev.c:(.text+0x35d0): undefined reference to `fuse_backing_close'

Check CONFIG_FUSE_PASSTHROUGH in each handler again, as fuse_notify_backing_remove() does. The check still comes after the fuse_get_dev() and -ENOTCONN checks, so the errors userspace sees do not change.

---
 fs/fuse/dev.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
fs/fuse/dev.c +9 -3
index 1a40b60afb986..3641abb90d6bb 100644
@@ -2334,9 +2334,6 @@ static struct fuse_conn *fuse_get_conn_for_passthrough(struct file *file)
 	if (!smp_load_acquire(&fud->chan->initialized))
 		return ERR_PTR(-ENOTCONN);
 
-	if (!IS_ENABLED(CONFIG_FUSE_PASSTHROUGH))
-		return ERR_PTR(-EOPNOTSUPP);
-
 	return fud->chan->conn;
 }
 
@@ -2349,6 +2346,9 @@ static long fuse_dev_ioctl_backing_open(struct file *file,
 	if (IS_ERR(fc))
 		return PTR_ERR(fc);
 
+	if (!IS_ENABLED(CONFIG_FUSE_PASSTHROUGH))
+		return -EOPNOTSUPP;
+
 	if (copy_from_user(&map, argp, sizeof(map)))
 		return -EFAULT;
 
@@ -2364,6 +2364,9 @@ static long fuse_dev_ioctl_backing_create(struct file *file,
 	if (IS_ERR(fc))
 		return PTR_ERR(fc);
 
+	if (!IS_ENABLED(CONFIG_FUSE_PASSTHROUGH))
+		return -EOPNOTSUPP;
+
 	if (copy_from_user(&map, argp, sizeof(map)))
 		return -EFAULT;
 
@@ -2378,6 +2381,9 @@ static long fuse_dev_ioctl_backing_close(struct file *file, __u32 __user *argp)
 	if (IS_ERR(fc))
 		return PTR_ERR(fc);
 
+	if (!IS_ENABLED(CONFIG_FUSE_PASSTHROUGH))
+		return -EOPNOTSUPP;
+
 	if (get_user(backing_id, argp))
 		return -EFAULT;
 

base-commit: 9b1da7b4a4e197072e630c3b85d4100a399752ff

Signature · 1 line
2.53.0