[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <175798160511.389044.5108322625829000877.stgit@frogsfrogsfrogs>
Date: Mon, 15 Sep 2025 17:50:07 -0700
From: "Darrick J. Wong" <djwong@...nel.org>
To: tytso@....edu
Cc: linux-ext4@...r.kernel.org
Subject: [PATCH 2/4] fuse2fs: wrap the fuse_set_feature_flag helper for older
libfuse
From: Darrick J. Wong <djwong@...nel.org>
Create a compatibility wrapper for fuse_set_feature_flag if the libfuse
version is older than the one where that function was introduced (3.17).
Signed-off-by: "Darrick J. Wong" <djwong@...nel.org>
---
misc/fuse2fs.c | 32 +++++++++++++++++++++++++++++---
1 file changed, 29 insertions(+), 3 deletions(-)
diff --git a/misc/fuse2fs.c b/misc/fuse2fs.c
index 101f0fa03c397d..aa51b8f55b0f50 100644
--- a/misc/fuse2fs.c
+++ b/misc/fuse2fs.c
@@ -1298,6 +1298,19 @@ static int fuse2fs_read_bitmaps(struct fuse2fs *ff)
return 0;
}
+#if FUSE_VERSION < FUSE_MAKE_VERSION(3, 17)
+static inline int fuse_set_feature_flag(struct fuse_conn_info *conn,
+ uint64_t flag)
+{
+ if (conn->capable & flag) {
+ conn->want |= flag;
+ return 1;
+ }
+
+ return 0;
+}
+#endif
+
static void *op_init(struct fuse_conn_info *conn
#if FUSE_VERSION >= FUSE_MAKE_VERSION(3, 0)
, struct fuse_config *cfg EXT2FS_ATTR((unused))
@@ -1322,14 +1335,14 @@ static void *op_init(struct fuse_conn_info *conn
fs = ff->fs;
dbg_printf(ff, "%s: dev=%s\n", __func__, fs->device_name);
#ifdef FUSE_CAP_IOCTL_DIR
- conn->want |= FUSE_CAP_IOCTL_DIR;
+ fuse_set_feature_flag(conn, FUSE_CAP_IOCTL_DIR);
#endif
#ifdef FUSE_CAP_POSIX_ACL
if (ff->acl)
- conn->want |= FUSE_CAP_POSIX_ACL;
+ fuse_set_feature_flag(conn, FUSE_CAP_POSIX_ACL);
#endif
#ifdef FUSE_CAP_CACHE_SYMLINKS
- conn->want |= FUSE_CAP_CACHE_SYMLINKS;
+ fuse_set_feature_flag(conn, FUSE_CAP_CACHE_SYMLINKS);
#endif
#if FUSE_VERSION >= FUSE_MAKE_VERSION(3, 0)
conn->time_gran = 1;
@@ -1349,6 +1362,19 @@ static void *op_init(struct fuse_conn_info *conn
if (ff->opstate == F2OP_WRITABLE)
fuse2fs_read_bitmaps(ff);
+#if FUSE_VERSION >= FUSE_MAKE_VERSION(3, 17)
+ /*
+ * THIS MUST GO LAST!
+ *
+ * fuse_set_feature_flag in 3.17.0 has a strange bug: it sets feature
+ * flags in conn->want_ext, but not conn->want. Upon return to
+ * libfuse, the lower level library observes that want and want_ext
+ * have gotten out of sync, and refuses to mount. Therefore,
+ * synchronize the two. This bug went away in 3.17.3, but we're stuck
+ * with this forever because Debian trixie released with 3.17.2.
+ */
+ conn->want = conn->want_ext & 0xFFFFFFFF;
+#endif
return ff;
}
Powered by blists - more mailing lists