public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/7] fix up issues from djwong/fuse4fs-fork
@ 2026-05-04 23:32 Theodore Ts'o
  2026-05-04 23:32 ` [PATCH 1/7] libsupport: drop xbitops.h and define fls() if necessary Theodore Ts'o
                   ` (7 more replies)
  0 siblings, 8 replies; 19+ messages in thread
From: Theodore Ts'o @ 2026-05-04 23:32 UTC (permalink / raw)
  To: Ext4 Developers List; +Cc: Darrick J. Wong, Theodore Ts'o

These are the patches that I've applied to the next branch to clean up
found when trying to compile e2fsprogs on MacOS and via the github's
continuous integration testing.

Note: See .github/workflows/ci.yaml; it's a good reason to get a
github account if you are doing a lot of e2fsprogs development.
If you fork my e2fsprogs repository and push your changes to your github
repo, you can get reports like the ones found here:
      https://github.com/tytso/e2fsprogs/actions


Anyway, with these patches, e2fsprogs builds on MacOS (both using the
github CI and on locally on my Macbook).  Unfortunately fuse2fs has
regressed in that non-root accesses are getting denied with a permission
denied on MacOS, and this worked with e2fsprogs v1.47.4.  Here's a
lightly edited transcript from my Macbook Air:

% uname -a
Darwin macsyma.local 25.4.0 Darwin Kernel Version 25.4.0: Thu Mar 19 19:33:09 PDT 2026; root:xnu-12377.101.15~1/RELEASE_ARM64_T8112 arm64 arm Darwin
% ./mke2fs -Fq -t ext4 -d . /tmp/foo.img  1G
% ./fuse2fs -o allow_other /tmp/foo.img /Users/tytso/mnt
FUSE2FS (foo.img): Warning: fuse2fs does not support using the journal.
There may be file system corruption or data loss if
the file system is not gracefully unmounted.
% stat /Users/tytso/mnt/revoke.o
stat: cannot stat '/Users/tytso/mnt/revoke.o': Permission denied
% sudo stat /Users/tytso/mnt/revoke.o
  File: /Users/tytso/mnt/revoke.o
  Size: 29728     	Blocks: 64         IO Block: 16384  regular file
Device: 55,270	Inode: 91          Links: 1
Access: (0644/-rw-r--r--)  Uid: (15806/   tytso)   Gid: (   20/   staff)
Access: 2026-05-05 00:21:50.000000000 +0200
Modify: 2026-05-05 00:21:50.000000000 +0200
Change: 2026-05-05 00:21:50.000000000 +0200
 Birth: -
% stat revoke.o
  File: revoke.o
  Size: 29728     	Blocks: 64         IO Block: 4096   regular file
Device: 1,18	Inode: 851374      Links: 1
Access: (0644/-rw-r--r--)  Uid: (15806/   tytso)   Gid: (   20/   staff)
Access: 2026-05-05 00:21:50.903084819 +0200
Modify: 2026-05-05 00:21:50.346338295 +0200
Change: 2026-05-05 00:21:50.346580544 +0200
 Birth: 2026-05-05 00:21:50.293229053 +0200
% sum revoke.o
45116    30 revoke.o
% sum /Users/tytso/mnt/revoke.o
sum: /Users/tytso/mnt/revoke.o: Permission denied

So fuse2fs is broken on MacOS, but it's not *totally* broken, since you
can still use it as root.  I'll want to fix this before updating the
master branch, but this is good enough for the next branch.



Theodore Ts'o (7):
  libsupport: drop xbitops.h and define fls() if necessary
  configure.ac: fix disable fuse2fs/fuse4fs by default path
  libsupport: don't use bzero in cache.c
  fuse[24]fs: suppress clang warnings which were breaking the github CI
  libsupport: remove the LIST_HEAD macro from list.h
  libsupport: fix gcc -Wall warnings
  fuse2fs: fix uninitialized variable warnings

 configure               |   8 +++
 configure.ac            |   3 +
 fuse4fs/Makefile.in     |  18 +++---
 fuse4fs/fuse4fs.c       |  29 +++++++--
 lib/config.h.in         |   3 +
 lib/support/Makefile.in |   2 +-
 lib/support/cache.c     |  49 ++++++++++++---
 lib/support/cache.h     |   2 +-
 lib/support/list.h      |  17 ++++--
 lib/support/xbitops.h   | 128 ----------------------------------------
 misc/fuse2fs.c          |  21 +++++++
 11 files changed, 125 insertions(+), 155 deletions(-)
 delete mode 100644 lib/support/xbitops.h

-- 
2.53.0


^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH 1/7] libsupport: drop xbitops.h and define fls() if necessary
  2026-05-04 23:32 [PATCH 0/7] fix up issues from djwong/fuse4fs-fork Theodore Ts'o
@ 2026-05-04 23:32 ` Theodore Ts'o
  2026-05-05  0:11   ` Darrick J. Wong
  2026-05-04 23:32 ` [PATCH 2/7] configure.ac: fix disable fuse2fs/fuse4fs by default path Theodore Ts'o
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 19+ messages in thread
From: Theodore Ts'o @ 2026-05-04 23:32 UTC (permalink / raw)
  To: Ext4 Developers List; +Cc: Darrick J. Wong, Theodore Ts'o

The new cache.c file doesn't actually need most of the functions in
xbitops.h.  It only needs fls(), and on some systems, like MacOS and
*BSD systems, fls() is defined already.  The other functions in
xbitops.h are massively non-portable and break on non-Linux systems,
especially MacOS.

So define fls() if it's needed (on Linux), and drop xbitops.h.

Fixes: 30b3c80ed6bc ("libsupport: add a cache")
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
 configure               |   6 ++
 configure.ac            |   1 +
 fuse4fs/Makefile.in     |  18 +++---
 lib/config.h.in         |   3 +
 lib/support/Makefile.in |   2 +-
 lib/support/cache.c     |  33 ++++++++++-
 lib/support/xbitops.h   | 128 ----------------------------------------
 7 files changed, 51 insertions(+), 140 deletions(-)
 delete mode 100644 lib/support/xbitops.h

diff --git a/configure b/configure
index a97794121..a1a270e63 100755
--- a/configure
+++ b/configure
@@ -13677,6 +13677,12 @@ if test "x$ac_cv_func_fdatasync" = xyes
 then :
   printf "%s\n" "#define HAVE_FDATASYNC 1" >>confdefs.h
 
+fi
+ac_fn_c_check_func "$LINENO" "fls" "ac_cv_func_fls"
+if test "x$ac_cv_func_fls" = xyes
+then :
+  printf "%s\n" "#define HAVE_FLS 1" >>confdefs.h
+
 fi
 ac_fn_c_check_func "$LINENO" "fstat64" "ac_cv_func_fstat64"
 if test "x$ac_cv_func_fstat64" = xyes
diff --git a/configure.ac b/configure.ac
index b62553e3d..abce79594 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1233,6 +1233,7 @@ AC_CHECK_FUNCS(m4_flatten([
 	fchown
 	fcntl
 	fdatasync
+	fls
 	fstat64
 	fsync
 	ftruncate64
diff --git a/fuse4fs/Makefile.in b/fuse4fs/Makefile.in
index 9f3547c27..cecee2b25 100644
--- a/fuse4fs/Makefile.in
+++ b/fuse4fs/Makefile.in
@@ -134,7 +134,7 @@ distclean: clean
 	$(RM) -f .depend Makefile $(srcdir)/TAGS $(srcdir)/Makefile.in.old
 
 # +++ Dependency line eater +++
-#
+# 
 # Makefile dependencies follow.  This must be the last section in
 # the Makefile.in file
 #
@@ -145,9 +145,10 @@ fuse4fs.o: $(srcdir)/fuse4fs.c $(top_builddir)/lib/config.h \
  $(top_srcdir)/lib/ext2fs/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h \
  $(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/hashmap.h \
  $(top_srcdir)/lib/ext2fs/bitops.h $(top_srcdir)/lib/ext2fs/ext2fsP.h \
- $(top_srcdir)/lib/ext2fs/ext2fs.h $(top_srcdir)/version.h \
- $(top_srcdir)/lib/e2p/e2p.h $(top_srcdir)/lib/support/cache.h \
- $(top_srcdir)/lib/support/list.h $(top_srcdir)/lib/support/xbitops.h
+ $(top_srcdir)/lib/ext2fs/ext2fs.h $(top_srcdir)/lib/support/bthread.h \
+ $(top_srcdir)/lib/support/thread.h $(top_srcdir)/lib/support/list.h \
+ $(top_srcdir)/lib/support/cache.h $(top_srcdir)/version.h \
+ $(top_srcdir)/lib/e2p/e2p.h
 journal.o: $(srcdir)/../debugfs/journal.c $(top_builddir)/lib/config.h \
  $(top_builddir)/lib/dirpaths.h $(srcdir)/../debugfs/journal.h \
  $(top_srcdir)/e2fsck/jfs_user.h $(top_srcdir)/e2fsck/e2fsck.h \
@@ -161,8 +162,7 @@ journal.o: $(srcdir)/../debugfs/journal.c $(top_builddir)/lib/config.h \
  $(top_srcdir)/lib/support/dqblk_v2.h \
  $(top_srcdir)/lib/support/quotaio_tree.h \
  $(top_srcdir)/lib/ext2fs/fast_commit.h $(top_srcdir)/lib/ext2fs/jfs_compat.h \
- $(top_srcdir)/lib/support/list.h $(top_srcdir)/lib/ext2fs/compiler.h \
- $(top_srcdir)/lib/ext2fs/kernel-jbd.h
+ $(top_srcdir)/lib/support/list.h $(top_srcdir)/lib/ext2fs/kernel-jbd.h
 revoke.o: $(srcdir)/../e2fsck/revoke.c $(srcdir)/../e2fsck/jfs_user.h \
  $(top_builddir)/lib/config.h $(top_builddir)/lib/dirpaths.h \
  $(srcdir)/../e2fsck/e2fsck.h $(top_srcdir)/lib/ext2fs/ext2_fs.h \
@@ -175,8 +175,7 @@ revoke.o: $(srcdir)/../e2fsck/revoke.c $(srcdir)/../e2fsck/jfs_user.h \
  $(top_srcdir)/lib/support/dqblk_v2.h \
  $(top_srcdir)/lib/support/quotaio_tree.h \
  $(top_srcdir)/lib/ext2fs/fast_commit.h $(top_srcdir)/lib/ext2fs/jfs_compat.h \
- $(top_srcdir)/lib/support/list.h $(top_srcdir)/lib/ext2fs/compiler.h \
- $(top_srcdir)/lib/ext2fs/kernel-jbd.h
+ $(top_srcdir)/lib/support/list.h $(top_srcdir)/lib/ext2fs/kernel-jbd.h
 recovery.o: $(srcdir)/../e2fsck/recovery.c $(srcdir)/../e2fsck/jfs_user.h \
  $(top_builddir)/lib/config.h $(top_builddir)/lib/dirpaths.h \
  $(srcdir)/../e2fsck/e2fsck.h $(top_srcdir)/lib/ext2fs/ext2_fs.h \
@@ -189,5 +188,4 @@ recovery.o: $(srcdir)/../e2fsck/recovery.c $(srcdir)/../e2fsck/jfs_user.h \
  $(top_srcdir)/lib/support/dqblk_v2.h \
  $(top_srcdir)/lib/support/quotaio_tree.h \
  $(top_srcdir)/lib/ext2fs/fast_commit.h $(top_srcdir)/lib/ext2fs/jfs_compat.h \
- $(top_srcdir)/lib/support/list.h $(top_srcdir)/lib/ext2fs/compiler.h \
- $(top_srcdir)/lib/ext2fs/kernel-jbd.h
+ $(top_srcdir)/lib/support/list.h $(top_srcdir)/lib/ext2fs/kernel-jbd.h
diff --git a/lib/config.h.in b/lib/config.h.in
index fd2520396..abba5e2c6 100644
--- a/lib/config.h.in
+++ b/lib/config.h.in
@@ -124,6 +124,9 @@
 /* Define to 1 if you have the 'fdatasync' function. */
 #undef HAVE_FDATASYNC
 
+/* Define to 1 if you have the 'fls' function. */
+#undef HAVE_FLS
+
 /* Define to 1 if fsmap_sizeof() is declared in linux/fsmap.h */
 #undef HAVE_FSMAP_SIZEOF
 
diff --git a/lib/support/Makefile.in b/lib/support/Makefile.in
index 6ff1c81d0..d20d6a984 100644
--- a/lib/support/Makefile.in
+++ b/lib/support/Makefile.in
@@ -199,4 +199,4 @@ dict.o: $(srcdir)/dict.c $(top_builddir)/lib/config.h \
 devname.o: $(srcdir)/devname.c $(top_builddir)/lib/config.h \
  $(top_builddir)/lib/dirpaths.h $(srcdir)/devname.h $(srcdir)/nls-enable.h
 cache.o: $(srcdir)/cache.c $(top_builddir)/lib/config.h \
- $(srcdir)/cache.h $(srcdir)/list.h $(srcdir)/xbitops.h
+ $(top_builddir)/lib/dirpaths.h $(srcdir)/list.h $(srcdir)/cache.h
diff --git a/lib/support/cache.c b/lib/support/cache.c
index 3a9e276f1..f9669e3fc 100644
--- a/lib/support/cache.c
+++ b/lib/support/cache.c
@@ -7,6 +7,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <strings.h>
 #include <unistd.h>
 #include <pthread.h>
 #include <stdbool.h>
@@ -14,9 +15,9 @@
 #include <stdint.h>
 #include <errno.h>
 
+#include "config.h"
 #include "list.h"
 #include "cache.h"
-#include "xbitops.h"
 
 #undef CACHE_DEBUG
 /* #define CACHE_DEBUG 1 */
@@ -32,6 +33,36 @@
 # define ASSERT(x)		do { } while (0)
 #endif
 
+#ifndef HAVE_FLS
+static inline int fls(int x)
+{
+	int r = 32;
+
+	if (!x)
+		return 0;
+	if (!(x & 0xffff0000u)) {
+		x = (x & 0xffffu) << 16;
+		r -= 16;
+	}
+	if (!(x & 0xff000000u)) {
+		x = (x & 0xffffffu) << 8;
+		r -= 8;
+	}
+	if (!(x & 0xf0000000u)) {
+		x = (x & 0xfffffffu) << 4;
+		r -= 4;
+	}
+	if (!(x & 0xc0000000u)) {
+		x = (x & 0x3fffffffu) << 2;
+		r -= 2;
+	}
+	if (!(x & 0x80000000u)) {
+		r -= 1;
+	}
+	return r;
+}
+#endif
+
 static unsigned int cache_generic_bulkrelse(struct cache *, struct list_head *);
 
 int
diff --git a/lib/support/xbitops.h b/lib/support/xbitops.h
deleted file mode 100644
index 78a8f2a85..000000000
--- a/lib/support/xbitops.h
+++ /dev/null
@@ -1,128 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-#ifndef __BITOPS_H__
-#define __BITOPS_H__
-
-/*
- * fls: find last bit set.
- */
-
-static inline int fls(int x)
-{
-	int r = 32;
-
-	if (!x)
-		return 0;
-	if (!(x & 0xffff0000u)) {
-		x = (x & 0xffffu) << 16;
-		r -= 16;
-	}
-	if (!(x & 0xff000000u)) {
-		x = (x & 0xffffffu) << 8;
-		r -= 8;
-	}
-	if (!(x & 0xf0000000u)) {
-		x = (x & 0xfffffffu) << 4;
-		r -= 4;
-	}
-	if (!(x & 0xc0000000u)) {
-		x = (x & 0x3fffffffu) << 2;
-		r -= 2;
-	}
-	if (!(x & 0x80000000u)) {
-		r -= 1;
-	}
-	return r;
-}
-
-static inline int fls64(uint64_t x)
-{
-	uint32_t h = x >> 32;
-	if (h)
-		return fls(h) + 32;
-	return fls(x);
-}
-
-static inline unsigned fls_long(unsigned long l)
-{
-        if (sizeof(l) == 4)
-                return fls(l);
-        return fls64(l);
-}
-
-/*
- * ffz: find first zero bit.
- * Result is undefined if no zero bit exists.
- */
-#define ffz(x)	ffs(~(x))
-
-/*
- * XFS bit manipulation routines.  Repeated here so that some programs
- * don't have to link in all of libxfs just to have bit manipulation.
- */
-
-/*
- * masks with n high/low bits set, 64-bit values
- */
-static inline uint64_t mask64hi(int n)
-{
-	return (uint64_t)-1 << (64 - (n));
-}
-static inline uint32_t mask32lo(int n)
-{
-	return ((uint32_t)1 << (n)) - 1;
-}
-static inline uint64_t mask64lo(int n)
-{
-	return ((uint64_t)1 << (n)) - 1;
-}
-
-/* Get high bit set out of 32-bit argument, -1 if none set */
-static inline int highbit32(uint32_t v)
-{
-	return fls(v) - 1;
-}
-
-/* Get high bit set out of 64-bit argument, -1 if none set */
-static inline int highbit64(uint64_t v)
-{
-	return fls64(v) - 1;
-}
-
-/* Get low bit set out of 32-bit argument, -1 if none set */
-static inline int lowbit32(uint32_t v)
-{
-	return ffs(v) - 1;
-}
-
-/* Get low bit set out of 64-bit argument, -1 if none set */
-static inline int lowbit64(uint64_t v)
-{
-	uint32_t	w = (uint32_t)v;
-	int		n = 0;
-
-	if (w) {	/* lower bits */
-		n = ffs(w);
-	} else {	/* upper bits */
-		w = (uint32_t)(v >> 32);
-		if (w) {
-			n = ffs(w);
-			if (n)
-				n += 32;
-		}
-	}
-	return n - 1;
-}
-
-/**
- * __rounddown_pow_of_two() - round down to nearest power of two
- * @n: value to round down
- */
-static inline __attribute__((const))
-unsigned long __rounddown_pow_of_two(unsigned long n)
-{
-	return 1UL << (fls_long(n) - 1);
-}
-
-#define rounddown_pow_of_two(n) __rounddown_pow_of_two(n)
-
-#endif
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 2/7] configure.ac: fix disable fuse2fs/fuse4fs by default path
  2026-05-04 23:32 [PATCH 0/7] fix up issues from djwong/fuse4fs-fork Theodore Ts'o
  2026-05-04 23:32 ` [PATCH 1/7] libsupport: drop xbitops.h and define fls() if necessary Theodore Ts'o
@ 2026-05-04 23:32 ` Theodore Ts'o
  2026-05-05  0:13   ` Darrick J. Wong
  2026-05-04 23:32 ` [PATCH 3/7] libsupport: don't use bzero in cache.c Theodore Ts'o
                   ` (5 subsequent siblings)
  7 siblings, 1 reply; 19+ messages in thread
From: Theodore Ts'o @ 2026-05-04 23:32 UTC (permalink / raw)
  To: Ext4 Developers List; +Cc: Darrick J. Wong, Theodore Ts'o

If the fuse.h header file is not present, fix the "Disabling
fuse[24]fs by default" codepath to actually disable trying to build
fuse2fs or fuse4fs.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Fixes: 239f4b7ac05b ("fuse2fs: separate libfuse3 and fuse2fs detection in configure")
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
 configure    | 2 ++
 configure.ac | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/configure b/configure
index a1a270e63..d941ff1f1 100755
--- a/configure
+++ b/configure
@@ -14737,6 +14737,7 @@ else case e in #(
 		{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Enabling fuse2fs by default" >&5
 printf "%s\n" "Enabling fuse2fs by default" >&6; }
 	else
+		FUSE2FS_CMT="#"
 		{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Disabling fuse2fs by default" >&5
 printf "%s\n" "Disabling fuse2fs by default" >&6; }
 	fi
@@ -14804,6 +14805,7 @@ else case e in #(
 		{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Enabling fuse4fs by default" >&5
 printf "%s\n" "Enabling fuse4fs by default" >&6; }
 	else
+		FUSE4FS_CMT="#"
 		{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Disabling fuse4fs by default" >&5
 printf "%s\n" "Disabling fuse4fs by default" >&6; }
 	fi
diff --git a/configure.ac b/configure.ac
index abce79594..d8f40f5df 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1459,6 +1459,7 @@ AS_HELP_STRING([--disable-fuse2fs],[do not build fuse2fs]),
 	then
 		AC_MSG_RESULT([Enabling fuse2fs by default])
 	else
+		FUSE2FS_CMT="#"
 		AC_MSG_RESULT([Disabling fuse2fs by default])
 	fi
 ]
@@ -1496,6 +1497,7 @@ AS_HELP_STRING([--disable-fuse4fs],[do not build fuse4fs]),
 	then
 		AC_MSG_RESULT([Enabling fuse4fs by default])
 	else
+		FUSE4FS_CMT="#"
 		AC_MSG_RESULT([Disabling fuse4fs by default])
 	fi
 ]
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 3/7] libsupport: don't use bzero in cache.c
  2026-05-04 23:32 [PATCH 0/7] fix up issues from djwong/fuse4fs-fork Theodore Ts'o
  2026-05-04 23:32 ` [PATCH 1/7] libsupport: drop xbitops.h and define fls() if necessary Theodore Ts'o
  2026-05-04 23:32 ` [PATCH 2/7] configure.ac: fix disable fuse2fs/fuse4fs by default path Theodore Ts'o
@ 2026-05-04 23:32 ` Theodore Ts'o
  2026-05-05  0:15   ` Darrick J. Wong
  2026-05-04 23:32 ` [PATCH 4/7] fuse[24]fs: suppress clang warnings which were breaking the github CI Theodore Ts'o
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 19+ messages in thread
From: Theodore Ts'o @ 2026-05-04 23:32 UTC (permalink / raw)
  To: Ext4 Developers List; +Cc: Darrick J. Wong, Theodore Ts'o

The bzero() function is deprecated and not available in some
platforms.  It's not needed in any case because we can just use an
automatic initializer.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Fixes: 30b3c80ed6bc ("libsupport: add a cache")
---
 lib/support/cache.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/lib/support/cache.c b/lib/support/cache.c
index f9669e3fc..aec785347 100644
--- a/lib/support/cache.c
+++ b/lib/support/cache.c
@@ -850,7 +850,7 @@ cache_report(
 {
 	int		i;
 	unsigned long	count, index, total;
-	unsigned long	hash_bucket_lengths[HASH_REPORT + 2];
+	unsigned long	hash_bucket_lengths[HASH_REPORT + 2] = { 0 };
 
 	if ((cache->c_hits + cache->c_misses) == 0)
 		return;
@@ -886,8 +886,6 @@ cache_report(
 		cache->c_mrus[i].cm_count * 100 / cache->c_count);
 
 	/* report hash bucket lengths */
-	bzero(hash_bucket_lengths, sizeof(hash_bucket_lengths));
-
 	for (i = 0; i < cache->c_hashsize; i++) {
 		count = cache->c_hash[i].ch_count;
 		if (count > HASH_REPORT)
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 4/7] fuse[24]fs: suppress clang warnings which were breaking the github CI
  2026-05-04 23:32 [PATCH 0/7] fix up issues from djwong/fuse4fs-fork Theodore Ts'o
                   ` (2 preceding siblings ...)
  2026-05-04 23:32 ` [PATCH 3/7] libsupport: don't use bzero in cache.c Theodore Ts'o
@ 2026-05-04 23:32 ` Theodore Ts'o
  2026-05-05  0:20   ` Darrick J. Wong
  2026-05-04 23:32 ` [PATCH 5/7] libsupport: remove the LIST_HEAD macro from list.h Theodore Ts'o
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 19+ messages in thread
From: Theodore Ts'o @ 2026-05-04 23:32 UTC (permalink / raw)
  To: Ext4 Developers List; +Cc: Darrick J. Wong, Theodore Ts'o

fuse[24]fs.c defines some functions which might or might not be used
depending on the version of the fuse library installed on the system.
Unfortunately while gcc won't complain if there are static inline
functions which are not used, clang will only suppress such complaints
if the static inline functions are in a header file.

Since the github CI runs a test build with -Wall -Werror this was
breaking the CI build.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
 fuse4fs/fuse4fs.c | 21 +++++++++++++++++++++
 misc/fuse2fs.c    | 21 +++++++++++++++++++++
 2 files changed, 42 insertions(+)

diff --git a/fuse4fs/fuse4fs.c b/fuse4fs/fuse4fs.c
index 13e1aae4b..b883083f8 100644
--- a/fuse4fs/fuse4fs.c
+++ b/fuse4fs/fuse4fs.c
@@ -502,6 +502,27 @@ static inline off_t FUSE4FS_FSB_TO_B(const struct fuse4fs *ff, blk64_t bno)
 	return bno << ff->blocklog;
 }
 
+#ifdef __clang__
+#define SUPPRESS_UNUSED_FUNCTION(func)    (void)func
+/*
+ * These functions might or might not be used depending on the version
+ * of the fuse library installed on the system.  Unfortunately while
+ * gcc won't complain if there are static inline functions which are
+ * not used, clang will only suppress such complaints if the static
+ * inline functions are in a header file.
+ */
+void fuse2fs_shut_up_stupid_clang_warnings(void)
+{
+	SUPPRESS_UNUSED_FUNCTION(fuse2fs_shut_up_stupid_clang_warnings);
+	SUPPRESS_UNUSED_FUNCTION(round_up);
+	SUPPRESS_UNUSED_FUNCTION(round_down);
+	SUPPRESS_UNUSED_FUNCTION(FUSE4FS_B_TO_FSBT);
+	SUPPRESS_UNUSED_FUNCTION(FUSE4FS_OFF_IN_FSB);
+	SUPPRESS_UNUSED_FUNCTION(FUSE4FS_B_TO_FSB);
+	SUPPRESS_UNUSED_FUNCTION(FUSE4FS_FSB_TO_B);
+}
+#endif
+
 static double gettime_monotonic(void)
 {
 #ifdef CLOCK_MONOTONIC
diff --git a/misc/fuse2fs.c b/misc/fuse2fs.c
index 0f4781bc4..c46cfc236 100644
--- a/misc/fuse2fs.c
+++ b/misc/fuse2fs.c
@@ -339,6 +339,27 @@ static inline off_t FUSE2FS_FSB_TO_B(const struct fuse2fs *ff, blk64_t bno)
 	return bno << ff->blocklog;
 }
 
+#ifdef __clang__
+#define SUPPRESS_UNUSED_FUNCTION(func)    (void)func
+/*
+ * These functions might or might not be used depending on the version
+ * of the fuse library installed on the system.  Unfortunately while
+ * gcc won't complain if there are static inline functions which are
+ * not used, clang will only suppress such complaints if the static
+ * inline functions are in a header file.
+ */
+void fuse2fs_shut_up_stupid_clang_warnings(void)
+{
+	SUPPRESS_UNUSED_FUNCTION(fuse2fs_shut_up_stupid_clang_warnings);
+	SUPPRESS_UNUSED_FUNCTION(round_up);
+	SUPPRESS_UNUSED_FUNCTION(round_down);
+	SUPPRESS_UNUSED_FUNCTION(FUSE2FS_B_TO_FSBT);
+	SUPPRESS_UNUSED_FUNCTION(FUSE2FS_OFF_IN_FSB);
+	SUPPRESS_UNUSED_FUNCTION(FUSE2FS_B_TO_FSB);
+	SUPPRESS_UNUSED_FUNCTION(FUSE2FS_FSB_TO_B);
+}
+#endif
+
 static double gettime_monotonic(void)
 {
 #ifdef CLOCK_MONOTONIC
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 5/7] libsupport: remove the LIST_HEAD macro from list.h
  2026-05-04 23:32 [PATCH 0/7] fix up issues from djwong/fuse4fs-fork Theodore Ts'o
                   ` (3 preceding siblings ...)
  2026-05-04 23:32 ` [PATCH 4/7] fuse[24]fs: suppress clang warnings which were breaking the github CI Theodore Ts'o
@ 2026-05-04 23:32 ` Theodore Ts'o
  2026-05-05  0:20   ` Darrick J. Wong
  2026-05-04 23:33 ` [PATCH 6/7] libsupport: fix gcc -Wall warnings Theodore Ts'o
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 19+ messages in thread
From: Theodore Ts'o @ 2026-05-04 23:32 UTC (permalink / raw)
  To: Ext4 Developers List; +Cc: Darrick J. Wong, Theodore Ts'o

The LIST_HEAD macro is defined by both the Linux kernel's list.h and
<sys/queue.h> (originally from BSD).  The problem is that on MacOS,
some system header file pulls in <sys/queue.h> leading to a macro
redefiniction conflict.  Since we don't use LIST_HEAD in e2fsprogs,
the simplest mitigation is to just comment out the definition of LIST_HEAD.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Fixes: 37dafcc0894b ("libsupport: port the kernel list.h to libsupport")
---
 lib/support/list.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/lib/support/list.h b/lib/support/list.h
index 0e00e446d..0ec8de525 100644
--- a/lib/support/list.h
+++ b/lib/support/list.h
@@ -36,8 +36,17 @@ static inline void list_head_destroy(struct list_head *list)
 
 #define LIST_HEAD_INIT(name) { &(name), &(name) }
 
+#if 0
+/*
+ * This conflicts with the LIST_HEAD defined in <sys/queue.h>.  We
+ * don't include it in e2fsprogs, but some systems' header files might
+ * pull it in, leading to the macro redefinition conflict.
+ * Fortunately, we also don't need LIST_HEAD in e2fsprogs, so just
+ * drop this convenience macro.
+ */
 #define LIST_HEAD(name) \
 	struct list_head name = LIST_HEAD_INIT(name)
+#endif
 
 /**
  * INIT_LIST_HEAD - Initialize a list_head structure
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 6/7] libsupport: fix gcc -Wall warnings
  2026-05-04 23:32 [PATCH 0/7] fix up issues from djwong/fuse4fs-fork Theodore Ts'o
                   ` (4 preceding siblings ...)
  2026-05-04 23:32 ` [PATCH 5/7] libsupport: remove the LIST_HEAD macro from list.h Theodore Ts'o
@ 2026-05-04 23:33 ` Theodore Ts'o
  2026-05-05  0:20   ` Darrick J. Wong
  2026-05-04 23:33 ` [PATCH 7/7] fuse2fs: fix uninitialized variable warnings Theodore Ts'o
  2026-05-05  0:08 ` [PATCH 0/7] fix up issues from djwong/fuse4fs-fork Darrick J. Wong
  7 siblings, 1 reply; 19+ messages in thread
From: Theodore Ts'o @ 2026-05-04 23:33 UTC (permalink / raw)
  To: Ext4 Developers List; +Cc: Darrick J. Wong, Theodore Ts'o

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
 lib/support/cache.c | 12 +++++++++---
 lib/support/cache.h |  2 +-
 lib/support/list.h  |  8 ++++----
 3 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/lib/support/cache.c b/lib/support/cache.c
index aec785347..ece0adece 100644
--- a/lib/support/cache.c
+++ b/lib/support/cache.c
@@ -15,6 +15,12 @@
 #include <stdint.h>
 #include <errno.h>
 
+#ifdef __GNUC__
+#define EXT2FS_ATTR(x) __attribute__(x)
+#else
+#define EXT2FS_ATTR(x)
+#endif
+
 #include "config.h"
 #include "list.h"
 #include "cache.h"
@@ -711,7 +717,7 @@ cache_node_put(
 
 void
 cache_node_set_priority(
-	struct cache *		cache,
+	struct cache *		cache EXT2FS_ATTR((unused)),
 	struct cache_node *	node,
 	int			priority)
 {
@@ -820,7 +826,7 @@ cache_flush(
 {
 	struct cache_hash	*hash;
 	struct cache_node	*node;
-	int			i;
+	unsigned int		i;
 	bool			still_dirty = false;
 
 	if (!cache->flush)
@@ -848,7 +854,7 @@ cache_report(
 	const char	*name,
 	struct cache	*cache)
 {
-	int		i;
+	unsigned int	i;
 	unsigned long	count, index, total;
 	unsigned long	hash_bucket_lengths[HASH_REPORT + 2] = { 0 };
 
diff --git a/lib/support/cache.h b/lib/support/cache.h
index 71fb9762f..cd0e8c20e 100644
--- a/lib/support/cache.h
+++ b/lib/support/cache.h
@@ -83,7 +83,7 @@ typedef unsigned int (*cache_node_resize_t)(const struct cache *c,
 					    unsigned int curr_size,
 					    int dir);
 
-static inline unsigned int cache_gradual_resize(const struct cache *cache,
+static inline unsigned int cache_gradual_resize(const struct cache *cache EXT2FS_ATTR((unused)),
 						unsigned int curr_size,
 						int dir)
 {
diff --git a/lib/support/list.h b/lib/support/list.h
index 0ec8de525..54e8e2360 100644
--- a/lib/support/list.h
+++ b/lib/support/list.h
@@ -148,13 +148,13 @@ static __always_inline bool __list_del_entry_valid(struct list_head *entry)
 	return ret;
 }
 #else
-static inline bool __list_add_valid(struct list_head *new,
-				struct list_head *prev,
-				struct list_head *next)
+static inline bool __list_add_valid(struct list_head *new EXT2FS_ATTR((unused)),
+				struct list_head *prev EXT2FS_ATTR((unused)),
+				struct list_head *next EXT2FS_ATTR((unused)))
 {
 	return true;
 }
-static inline bool __list_del_entry_valid(struct list_head *entry)
+static inline bool __list_del_entry_valid(struct list_head *entry EXT2FS_ATTR((unused)))
 {
 	return true;
 }
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 7/7] fuse2fs: fix uninitialized variable warnings
  2026-05-04 23:32 [PATCH 0/7] fix up issues from djwong/fuse4fs-fork Theodore Ts'o
                   ` (5 preceding siblings ...)
  2026-05-04 23:33 ` [PATCH 6/7] libsupport: fix gcc -Wall warnings Theodore Ts'o
@ 2026-05-04 23:33 ` Theodore Ts'o
  2026-05-05  0:26   ` Darrick J. Wong
  2026-05-05  0:08 ` [PATCH 0/7] fix up issues from djwong/fuse4fs-fork Darrick J. Wong
  7 siblings, 1 reply; 19+ messages in thread
From: Theodore Ts'o @ 2026-05-04 23:33 UTC (permalink / raw)
  To: Ext4 Developers List; +Cc: Darrick J. Wong, Theodore Ts'o

Clang treats use of unitialized variables found by static analysis to
be serious enough that it will emit them by default (even without
-Wall).  So let's fix them up.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
 fuse4fs/fuse4fs.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/fuse4fs/fuse4fs.c b/fuse4fs/fuse4fs.c
index b883083f8..928473268 100644
--- a/fuse4fs/fuse4fs.c
+++ b/fuse4fs/fuse4fs.c
@@ -2216,7 +2216,7 @@ static void op_mknod(fuse_req_t req, fuse_ino_t fino, const char *name,
 	const struct fuse_ctx *ctxt = fuse_req_ctx(req);
 	struct fuse4fs *ff = fuse4fs_get(req);
 	ext2_filsys fs;
-	ext2_ino_t parent, child;
+	ext2_ino_t parent, child = 0;
 	errcode_t err;
 	int filetype;
 	gid_t gid;
@@ -2311,7 +2311,7 @@ static void op_mkdir(fuse_req_t req, fuse_ino_t fino, const char *name,
 	const struct fuse_ctx *ctxt = fuse_req_ctx(req);
 	struct fuse4fs *ff = fuse4fs_get(req);
 	ext2_filsys fs;
-	ext2_ino_t parent, child;
+	ext2_ino_t parent, child = 0;
 	errcode_t err;
 	char *block;
 	blk64_t blk;
@@ -2990,7 +2990,7 @@ static void op_symlink(fuse_req_t req, const char *target, fuse_ino_t fino,
 	const struct fuse_ctx *ctxt = fuse_req_ctx(req);
 	struct fuse4fs *ff = fuse4fs_get(req);
 	ext2_filsys fs;
-	ext2_ino_t parent, child;
+	ext2_ino_t parent, child = 0;
 	errcode_t err;
 	gid_t gid;
 	int ret = 0;
@@ -6042,7 +6042,7 @@ static int fuse4fs_main(struct fuse_args *args, struct fuse4fs *ff)
 	struct fuse_cmdline_opts opts;
 	struct fuse_session *se;
 	struct fuse_loop_config *loop_config = NULL;
-	int ret;
+	int ret = 0;
 
 	if (fuse_parse_cmdline(args, &opts) != 0) {
 		ret = 1;
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: [PATCH 0/7] fix up issues from djwong/fuse4fs-fork
  2026-05-04 23:32 [PATCH 0/7] fix up issues from djwong/fuse4fs-fork Theodore Ts'o
                   ` (6 preceding siblings ...)
  2026-05-04 23:33 ` [PATCH 7/7] fuse2fs: fix uninitialized variable warnings Theodore Ts'o
@ 2026-05-05  0:08 ` Darrick J. Wong
  2026-05-05  7:21   ` Theodore Tso
  7 siblings, 1 reply; 19+ messages in thread
From: Darrick J. Wong @ 2026-05-05  0:08 UTC (permalink / raw)
  To: Theodore Ts'o; +Cc: Ext4 Developers List

On Mon, May 04, 2026 at 07:32:54PM -0400, Theodore Ts'o wrote:
> These are the patches that I've applied to the next branch to clean up
> found when trying to compile e2fsprogs on MacOS and via the github's
> continuous integration testing.
> 
> Note: See .github/workflows/ci.yaml; it's a good reason to get a
> github account if you are doing a lot of e2fsprogs development.
> If you fork my e2fsprogs repository and push your changes to your github
> repo, you can get reports like the ones found here:
>       https://github.com/tytso/e2fsprogs/actions
> 
> 
> Anyway, with these patches, e2fsprogs builds on MacOS (both using the
> github CI and on locally on my Macbook).  Unfortunately fuse2fs has
> regressed in that non-root accesses are getting denied with a permission
> denied on MacOS, and this worked with e2fsprogs v1.47.4.  Here's a
> lightly edited transcript from my Macbook Air:

Hm, curious.  It's regrettable that I no longer have a Mac, and
therefore can't really do much investigating.  If you give
-o default_permissions,allow_other , does that fix the problem?
If that fixes it, then fuse2fs has a bug somewhere in its own
permissions checking.

> % uname -a
> Darwin macsyma.local 25.4.0 Darwin Kernel Version 25.4.0: Thu Mar 19 19:33:09 PDT 2026; root:xnu-12377.101.15~1/RELEASE_ARM64_T8112 arm64 arm Darwin
> % ./mke2fs -Fq -t ext4 -d . /tmp/foo.img  1G
> % ./fuse2fs -o allow_other /tmp/foo.img /Users/tytso/mnt
> FUSE2FS (foo.img): Warning: fuse2fs does not support using the journal.
> There may be file system corruption or data loss if
> the file system is not gracefully unmounted.
> % stat /Users/tytso/mnt/revoke.o
> stat: cannot stat '/Users/tytso/mnt/revoke.o': Permission denied
> % sudo stat /Users/tytso/mnt/revoke.o
>   File: /Users/tytso/mnt/revoke.o
>   Size: 29728     	Blocks: 64         IO Block: 16384  regular file
> Device: 55,270	Inode: 91          Links: 1
> Access: (0644/-rw-r--r--)  Uid: (15806/   tytso)   Gid: (   20/   staff)
> Access: 2026-05-05 00:21:50.000000000 +0200
> Modify: 2026-05-05 00:21:50.000000000 +0200
> Change: 2026-05-05 00:21:50.000000000 +0200
>  Birth: -
> % stat revoke.o
>   File: revoke.o
>   Size: 29728     	Blocks: 64         IO Block: 4096   regular file
> Device: 1,18	Inode: 851374      Links: 1
> Access: (0644/-rw-r--r--)  Uid: (15806/   tytso)   Gid: (   20/   staff)
> Access: 2026-05-05 00:21:50.903084819 +0200
> Modify: 2026-05-05 00:21:50.346338295 +0200
> Change: 2026-05-05 00:21:50.346580544 +0200
>  Birth: 2026-05-05 00:21:50.293229053 +0200
> % sum revoke.o
> 45116    30 revoke.o
> % sum /Users/tytso/mnt/revoke.o
> sum: /Users/tytso/mnt/revoke.o: Permission denied

That's really strange.  Does MacOS do any strange idmapping stuff?

I'm also curious if there's a particular commit that makes it all work
again?  There are a few defaults that changed between fuse2 and fuse3,
and since MacFuse claims to have vendored both, it could very well be
the megacommit dropping the fuse2 api support.

--D

> So fuse2fs is broken on MacOS, but it's not *totally* broken, since you
> can still use it as root.  I'll want to fix this before updating the
> master branch, but this is good enough for the next branch.
> 
> 
> 
> Theodore Ts'o (7):
>   libsupport: drop xbitops.h and define fls() if necessary
>   configure.ac: fix disable fuse2fs/fuse4fs by default path
>   libsupport: don't use bzero in cache.c
>   fuse[24]fs: suppress clang warnings which were breaking the github CI
>   libsupport: remove the LIST_HEAD macro from list.h
>   libsupport: fix gcc -Wall warnings
>   fuse2fs: fix uninitialized variable warnings
> 
>  configure               |   8 +++
>  configure.ac            |   3 +
>  fuse4fs/Makefile.in     |  18 +++---
>  fuse4fs/fuse4fs.c       |  29 +++++++--
>  lib/config.h.in         |   3 +
>  lib/support/Makefile.in |   2 +-
>  lib/support/cache.c     |  49 ++++++++++++---
>  lib/support/cache.h     |   2 +-
>  lib/support/list.h      |  17 ++++--
>  lib/support/xbitops.h   | 128 ----------------------------------------
>  misc/fuse2fs.c          |  21 +++++++
>  11 files changed, 125 insertions(+), 155 deletions(-)
>  delete mode 100644 lib/support/xbitops.h
> 
> -- 
> 2.53.0
> 
> 

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 1/7] libsupport: drop xbitops.h and define fls() if necessary
  2026-05-04 23:32 ` [PATCH 1/7] libsupport: drop xbitops.h and define fls() if necessary Theodore Ts'o
@ 2026-05-05  0:11   ` Darrick J. Wong
  0 siblings, 0 replies; 19+ messages in thread
From: Darrick J. Wong @ 2026-05-05  0:11 UTC (permalink / raw)
  To: Theodore Ts'o; +Cc: Ext4 Developers List

On Mon, May 04, 2026 at 07:32:55PM -0400, Theodore Ts'o wrote:
> The new cache.c file doesn't actually need most of the functions in
> xbitops.h.  It only needs fls(), and on some systems, like MacOS and
> *BSD systems, fls() is defined already.  The other functions in
> xbitops.h are massively non-portable and break on non-Linux systems,
> especially MacOS.
> 
> So define fls() if it's needed (on Linux), and drop xbitops.h.
> 
> Fixes: 30b3c80ed6bc ("libsupport: add a cache")
> Signed-off-by: Theodore Ts'o <tytso@mit.edu>

Works for me; in the end I didn't use it as many places as I thought I
was going to.
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

--D

> ---
>  configure               |   6 ++
>  configure.ac            |   1 +
>  fuse4fs/Makefile.in     |  18 +++---
>  lib/config.h.in         |   3 +
>  lib/support/Makefile.in |   2 +-
>  lib/support/cache.c     |  33 ++++++++++-
>  lib/support/xbitops.h   | 128 ----------------------------------------
>  7 files changed, 51 insertions(+), 140 deletions(-)
>  delete mode 100644 lib/support/xbitops.h
> 
> diff --git a/configure b/configure
> index a97794121..a1a270e63 100755
> --- a/configure
> +++ b/configure
> @@ -13677,6 +13677,12 @@ if test "x$ac_cv_func_fdatasync" = xyes
>  then :
>    printf "%s\n" "#define HAVE_FDATASYNC 1" >>confdefs.h
>  
> +fi
> +ac_fn_c_check_func "$LINENO" "fls" "ac_cv_func_fls"
> +if test "x$ac_cv_func_fls" = xyes
> +then :
> +  printf "%s\n" "#define HAVE_FLS 1" >>confdefs.h
> +
>  fi
>  ac_fn_c_check_func "$LINENO" "fstat64" "ac_cv_func_fstat64"
>  if test "x$ac_cv_func_fstat64" = xyes
> diff --git a/configure.ac b/configure.ac
> index b62553e3d..abce79594 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -1233,6 +1233,7 @@ AC_CHECK_FUNCS(m4_flatten([
>  	fchown
>  	fcntl
>  	fdatasync
> +	fls
>  	fstat64
>  	fsync
>  	ftruncate64
> diff --git a/fuse4fs/Makefile.in b/fuse4fs/Makefile.in
> index 9f3547c27..cecee2b25 100644
> --- a/fuse4fs/Makefile.in
> +++ b/fuse4fs/Makefile.in
> @@ -134,7 +134,7 @@ distclean: clean
>  	$(RM) -f .depend Makefile $(srcdir)/TAGS $(srcdir)/Makefile.in.old
>  
>  # +++ Dependency line eater +++
> -#
> +# 
>  # Makefile dependencies follow.  This must be the last section in
>  # the Makefile.in file
>  #
> @@ -145,9 +145,10 @@ fuse4fs.o: $(srcdir)/fuse4fs.c $(top_builddir)/lib/config.h \
>   $(top_srcdir)/lib/ext2fs/ext2_io.h $(top_builddir)/lib/ext2fs/ext2_err.h \
>   $(top_srcdir)/lib/ext2fs/ext2_ext_attr.h $(top_srcdir)/lib/ext2fs/hashmap.h \
>   $(top_srcdir)/lib/ext2fs/bitops.h $(top_srcdir)/lib/ext2fs/ext2fsP.h \
> - $(top_srcdir)/lib/ext2fs/ext2fs.h $(top_srcdir)/version.h \
> - $(top_srcdir)/lib/e2p/e2p.h $(top_srcdir)/lib/support/cache.h \
> - $(top_srcdir)/lib/support/list.h $(top_srcdir)/lib/support/xbitops.h
> + $(top_srcdir)/lib/ext2fs/ext2fs.h $(top_srcdir)/lib/support/bthread.h \
> + $(top_srcdir)/lib/support/thread.h $(top_srcdir)/lib/support/list.h \
> + $(top_srcdir)/lib/support/cache.h $(top_srcdir)/version.h \
> + $(top_srcdir)/lib/e2p/e2p.h
>  journal.o: $(srcdir)/../debugfs/journal.c $(top_builddir)/lib/config.h \
>   $(top_builddir)/lib/dirpaths.h $(srcdir)/../debugfs/journal.h \
>   $(top_srcdir)/e2fsck/jfs_user.h $(top_srcdir)/e2fsck/e2fsck.h \
> @@ -161,8 +162,7 @@ journal.o: $(srcdir)/../debugfs/journal.c $(top_builddir)/lib/config.h \
>   $(top_srcdir)/lib/support/dqblk_v2.h \
>   $(top_srcdir)/lib/support/quotaio_tree.h \
>   $(top_srcdir)/lib/ext2fs/fast_commit.h $(top_srcdir)/lib/ext2fs/jfs_compat.h \
> - $(top_srcdir)/lib/support/list.h $(top_srcdir)/lib/ext2fs/compiler.h \
> - $(top_srcdir)/lib/ext2fs/kernel-jbd.h
> + $(top_srcdir)/lib/support/list.h $(top_srcdir)/lib/ext2fs/kernel-jbd.h
>  revoke.o: $(srcdir)/../e2fsck/revoke.c $(srcdir)/../e2fsck/jfs_user.h \
>   $(top_builddir)/lib/config.h $(top_builddir)/lib/dirpaths.h \
>   $(srcdir)/../e2fsck/e2fsck.h $(top_srcdir)/lib/ext2fs/ext2_fs.h \
> @@ -175,8 +175,7 @@ revoke.o: $(srcdir)/../e2fsck/revoke.c $(srcdir)/../e2fsck/jfs_user.h \
>   $(top_srcdir)/lib/support/dqblk_v2.h \
>   $(top_srcdir)/lib/support/quotaio_tree.h \
>   $(top_srcdir)/lib/ext2fs/fast_commit.h $(top_srcdir)/lib/ext2fs/jfs_compat.h \
> - $(top_srcdir)/lib/support/list.h $(top_srcdir)/lib/ext2fs/compiler.h \
> - $(top_srcdir)/lib/ext2fs/kernel-jbd.h
> + $(top_srcdir)/lib/support/list.h $(top_srcdir)/lib/ext2fs/kernel-jbd.h
>  recovery.o: $(srcdir)/../e2fsck/recovery.c $(srcdir)/../e2fsck/jfs_user.h \
>   $(top_builddir)/lib/config.h $(top_builddir)/lib/dirpaths.h \
>   $(srcdir)/../e2fsck/e2fsck.h $(top_srcdir)/lib/ext2fs/ext2_fs.h \
> @@ -189,5 +188,4 @@ recovery.o: $(srcdir)/../e2fsck/recovery.c $(srcdir)/../e2fsck/jfs_user.h \
>   $(top_srcdir)/lib/support/dqblk_v2.h \
>   $(top_srcdir)/lib/support/quotaio_tree.h \
>   $(top_srcdir)/lib/ext2fs/fast_commit.h $(top_srcdir)/lib/ext2fs/jfs_compat.h \
> - $(top_srcdir)/lib/support/list.h $(top_srcdir)/lib/ext2fs/compiler.h \
> - $(top_srcdir)/lib/ext2fs/kernel-jbd.h
> + $(top_srcdir)/lib/support/list.h $(top_srcdir)/lib/ext2fs/kernel-jbd.h
> diff --git a/lib/config.h.in b/lib/config.h.in
> index fd2520396..abba5e2c6 100644
> --- a/lib/config.h.in
> +++ b/lib/config.h.in
> @@ -124,6 +124,9 @@
>  /* Define to 1 if you have the 'fdatasync' function. */
>  #undef HAVE_FDATASYNC
>  
> +/* Define to 1 if you have the 'fls' function. */
> +#undef HAVE_FLS
> +
>  /* Define to 1 if fsmap_sizeof() is declared in linux/fsmap.h */
>  #undef HAVE_FSMAP_SIZEOF
>  
> diff --git a/lib/support/Makefile.in b/lib/support/Makefile.in
> index 6ff1c81d0..d20d6a984 100644
> --- a/lib/support/Makefile.in
> +++ b/lib/support/Makefile.in
> @@ -199,4 +199,4 @@ dict.o: $(srcdir)/dict.c $(top_builddir)/lib/config.h \
>  devname.o: $(srcdir)/devname.c $(top_builddir)/lib/config.h \
>   $(top_builddir)/lib/dirpaths.h $(srcdir)/devname.h $(srcdir)/nls-enable.h
>  cache.o: $(srcdir)/cache.c $(top_builddir)/lib/config.h \
> - $(srcdir)/cache.h $(srcdir)/list.h $(srcdir)/xbitops.h
> + $(top_builddir)/lib/dirpaths.h $(srcdir)/list.h $(srcdir)/cache.h
> diff --git a/lib/support/cache.c b/lib/support/cache.c
> index 3a9e276f1..f9669e3fc 100644
> --- a/lib/support/cache.c
> +++ b/lib/support/cache.c
> @@ -7,6 +7,7 @@
>  #include <stdio.h>
>  #include <stdlib.h>
>  #include <string.h>
> +#include <strings.h>
>  #include <unistd.h>
>  #include <pthread.h>
>  #include <stdbool.h>
> @@ -14,9 +15,9 @@
>  #include <stdint.h>
>  #include <errno.h>
>  
> +#include "config.h"
>  #include "list.h"
>  #include "cache.h"
> -#include "xbitops.h"
>  
>  #undef CACHE_DEBUG
>  /* #define CACHE_DEBUG 1 */
> @@ -32,6 +33,36 @@
>  # define ASSERT(x)		do { } while (0)
>  #endif
>  
> +#ifndef HAVE_FLS
> +static inline int fls(int x)
> +{
> +	int r = 32;
> +
> +	if (!x)
> +		return 0;
> +	if (!(x & 0xffff0000u)) {
> +		x = (x & 0xffffu) << 16;
> +		r -= 16;
> +	}
> +	if (!(x & 0xff000000u)) {
> +		x = (x & 0xffffffu) << 8;
> +		r -= 8;
> +	}
> +	if (!(x & 0xf0000000u)) {
> +		x = (x & 0xfffffffu) << 4;
> +		r -= 4;
> +	}
> +	if (!(x & 0xc0000000u)) {
> +		x = (x & 0x3fffffffu) << 2;
> +		r -= 2;
> +	}
> +	if (!(x & 0x80000000u)) {
> +		r -= 1;
> +	}
> +	return r;
> +}
> +#endif
> +
>  static unsigned int cache_generic_bulkrelse(struct cache *, struct list_head *);
>  
>  int
> diff --git a/lib/support/xbitops.h b/lib/support/xbitops.h
> deleted file mode 100644
> index 78a8f2a85..000000000
> --- a/lib/support/xbitops.h
> +++ /dev/null
> @@ -1,128 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0
> -#ifndef __BITOPS_H__
> -#define __BITOPS_H__
> -
> -/*
> - * fls: find last bit set.
> - */
> -
> -static inline int fls(int x)
> -{
> -	int r = 32;
> -
> -	if (!x)
> -		return 0;
> -	if (!(x & 0xffff0000u)) {
> -		x = (x & 0xffffu) << 16;
> -		r -= 16;
> -	}
> -	if (!(x & 0xff000000u)) {
> -		x = (x & 0xffffffu) << 8;
> -		r -= 8;
> -	}
> -	if (!(x & 0xf0000000u)) {
> -		x = (x & 0xfffffffu) << 4;
> -		r -= 4;
> -	}
> -	if (!(x & 0xc0000000u)) {
> -		x = (x & 0x3fffffffu) << 2;
> -		r -= 2;
> -	}
> -	if (!(x & 0x80000000u)) {
> -		r -= 1;
> -	}
> -	return r;
> -}
> -
> -static inline int fls64(uint64_t x)
> -{
> -	uint32_t h = x >> 32;
> -	if (h)
> -		return fls(h) + 32;
> -	return fls(x);
> -}
> -
> -static inline unsigned fls_long(unsigned long l)
> -{
> -        if (sizeof(l) == 4)
> -                return fls(l);
> -        return fls64(l);
> -}
> -
> -/*
> - * ffz: find first zero bit.
> - * Result is undefined if no zero bit exists.
> - */
> -#define ffz(x)	ffs(~(x))
> -
> -/*
> - * XFS bit manipulation routines.  Repeated here so that some programs
> - * don't have to link in all of libxfs just to have bit manipulation.
> - */
> -
> -/*
> - * masks with n high/low bits set, 64-bit values
> - */
> -static inline uint64_t mask64hi(int n)
> -{
> -	return (uint64_t)-1 << (64 - (n));
> -}
> -static inline uint32_t mask32lo(int n)
> -{
> -	return ((uint32_t)1 << (n)) - 1;
> -}
> -static inline uint64_t mask64lo(int n)
> -{
> -	return ((uint64_t)1 << (n)) - 1;
> -}
> -
> -/* Get high bit set out of 32-bit argument, -1 if none set */
> -static inline int highbit32(uint32_t v)
> -{
> -	return fls(v) - 1;
> -}
> -
> -/* Get high bit set out of 64-bit argument, -1 if none set */
> -static inline int highbit64(uint64_t v)
> -{
> -	return fls64(v) - 1;
> -}
> -
> -/* Get low bit set out of 32-bit argument, -1 if none set */
> -static inline int lowbit32(uint32_t v)
> -{
> -	return ffs(v) - 1;
> -}
> -
> -/* Get low bit set out of 64-bit argument, -1 if none set */
> -static inline int lowbit64(uint64_t v)
> -{
> -	uint32_t	w = (uint32_t)v;
> -	int		n = 0;
> -
> -	if (w) {	/* lower bits */
> -		n = ffs(w);
> -	} else {	/* upper bits */
> -		w = (uint32_t)(v >> 32);
> -		if (w) {
> -			n = ffs(w);
> -			if (n)
> -				n += 32;
> -		}
> -	}
> -	return n - 1;
> -}
> -
> -/**
> - * __rounddown_pow_of_two() - round down to nearest power of two
> - * @n: value to round down
> - */
> -static inline __attribute__((const))
> -unsigned long __rounddown_pow_of_two(unsigned long n)
> -{
> -	return 1UL << (fls_long(n) - 1);
> -}
> -
> -#define rounddown_pow_of_two(n) __rounddown_pow_of_two(n)
> -
> -#endif
> -- 
> 2.53.0
> 
> 

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 2/7] configure.ac: fix disable fuse2fs/fuse4fs by default path
  2026-05-04 23:32 ` [PATCH 2/7] configure.ac: fix disable fuse2fs/fuse4fs by default path Theodore Ts'o
@ 2026-05-05  0:13   ` Darrick J. Wong
  0 siblings, 0 replies; 19+ messages in thread
From: Darrick J. Wong @ 2026-05-05  0:13 UTC (permalink / raw)
  To: Theodore Ts'o; +Cc: Ext4 Developers List

On Mon, May 04, 2026 at 07:32:56PM -0400, Theodore Ts'o wrote:
> If the fuse.h header file is not present, fix the "Disabling
> fuse[24]fs by default" codepath to actually disable trying to build
> fuse2fs or fuse4fs.
> 
> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
> Fixes: 239f4b7ac05b ("fuse2fs: separate libfuse3 and fuse2fs detection in configure")
> Signed-off-by: Theodore Ts'o <tytso@mit.edu>

Oops.  I hadn't tried building without a fuse.h in a while. :/
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

--D

> ---
>  configure    | 2 ++
>  configure.ac | 2 ++
>  2 files changed, 4 insertions(+)
> 
> diff --git a/configure b/configure
> index a1a270e63..d941ff1f1 100755
> --- a/configure
> +++ b/configure
> @@ -14737,6 +14737,7 @@ else case e in #(
>  		{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Enabling fuse2fs by default" >&5
>  printf "%s\n" "Enabling fuse2fs by default" >&6; }
>  	else
> +		FUSE2FS_CMT="#"
>  		{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Disabling fuse2fs by default" >&5
>  printf "%s\n" "Disabling fuse2fs by default" >&6; }
>  	fi
> @@ -14804,6 +14805,7 @@ else case e in #(
>  		{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Enabling fuse4fs by default" >&5
>  printf "%s\n" "Enabling fuse4fs by default" >&6; }
>  	else
> +		FUSE4FS_CMT="#"
>  		{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: Disabling fuse4fs by default" >&5
>  printf "%s\n" "Disabling fuse4fs by default" >&6; }
>  	fi
> diff --git a/configure.ac b/configure.ac
> index abce79594..d8f40f5df 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -1459,6 +1459,7 @@ AS_HELP_STRING([--disable-fuse2fs],[do not build fuse2fs]),
>  	then
>  		AC_MSG_RESULT([Enabling fuse2fs by default])
>  	else
> +		FUSE2FS_CMT="#"
>  		AC_MSG_RESULT([Disabling fuse2fs by default])
>  	fi
>  ]
> @@ -1496,6 +1497,7 @@ AS_HELP_STRING([--disable-fuse4fs],[do not build fuse4fs]),
>  	then
>  		AC_MSG_RESULT([Enabling fuse4fs by default])
>  	else
> +		FUSE4FS_CMT="#"
>  		AC_MSG_RESULT([Disabling fuse4fs by default])
>  	fi
>  ]
> -- 
> 2.53.0
> 
> 

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 3/7] libsupport: don't use bzero in cache.c
  2026-05-04 23:32 ` [PATCH 3/7] libsupport: don't use bzero in cache.c Theodore Ts'o
@ 2026-05-05  0:15   ` Darrick J. Wong
  0 siblings, 0 replies; 19+ messages in thread
From: Darrick J. Wong @ 2026-05-05  0:15 UTC (permalink / raw)
  To: Theodore Ts'o; +Cc: Ext4 Developers List

On Mon, May 04, 2026 at 07:32:57PM -0400, Theodore Ts'o wrote:
> The bzero() function is deprecated and not available in some
> platforms.  It's not needed in any case because we can just use an
> automatic initializer.
> 
> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
> Fixes: 30b3c80ed6bc ("libsupport: add a cache")

Yeesh.  What a sordid legacy this function has (see manpage). :(
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

--D

> ---
>  lib/support/cache.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/lib/support/cache.c b/lib/support/cache.c
> index f9669e3fc..aec785347 100644
> --- a/lib/support/cache.c
> +++ b/lib/support/cache.c
> @@ -850,7 +850,7 @@ cache_report(
>  {
>  	int		i;
>  	unsigned long	count, index, total;
> -	unsigned long	hash_bucket_lengths[HASH_REPORT + 2];
> +	unsigned long	hash_bucket_lengths[HASH_REPORT + 2] = { 0 };
>  
>  	if ((cache->c_hits + cache->c_misses) == 0)
>  		return;
> @@ -886,8 +886,6 @@ cache_report(
>  		cache->c_mrus[i].cm_count * 100 / cache->c_count);
>  
>  	/* report hash bucket lengths */
> -	bzero(hash_bucket_lengths, sizeof(hash_bucket_lengths));
> -
>  	for (i = 0; i < cache->c_hashsize; i++) {
>  		count = cache->c_hash[i].ch_count;
>  		if (count > HASH_REPORT)
> -- 
> 2.53.0
> 
> 

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 4/7] fuse[24]fs: suppress clang warnings which were breaking the github CI
  2026-05-04 23:32 ` [PATCH 4/7] fuse[24]fs: suppress clang warnings which were breaking the github CI Theodore Ts'o
@ 2026-05-05  0:20   ` Darrick J. Wong
  0 siblings, 0 replies; 19+ messages in thread
From: Darrick J. Wong @ 2026-05-05  0:20 UTC (permalink / raw)
  To: Theodore Ts'o; +Cc: Ext4 Developers List

On Mon, May 04, 2026 at 07:32:58PM -0400, Theodore Ts'o wrote:
> fuse[24]fs.c defines some functions which might or might not be used
> depending on the version of the fuse library installed on the system.
> Unfortunately while gcc won't complain if there are static inline
> functions which are not used, clang will only suppress such complaints
> if the static inline functions are in a header file.

<groan>

> Since the github CI runs a test build with -Wall -Werror this was
> breaking the CI build.
> 
> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
> ---
>  fuse4fs/fuse4fs.c | 21 +++++++++++++++++++++
>  misc/fuse2fs.c    | 21 +++++++++++++++++++++
>  2 files changed, 42 insertions(+)
> 
> diff --git a/fuse4fs/fuse4fs.c b/fuse4fs/fuse4fs.c
> index 13e1aae4b..b883083f8 100644
> --- a/fuse4fs/fuse4fs.c
> +++ b/fuse4fs/fuse4fs.c
> @@ -502,6 +502,27 @@ static inline off_t FUSE4FS_FSB_TO_B(const struct fuse4fs *ff, blk64_t bno)
>  	return bno << ff->blocklog;
>  }
>  
> +#ifdef __clang__
> +#define SUPPRESS_UNUSED_FUNCTION(func)    (void)func
> +/*
> + * These functions might or might not be used depending on the version
> + * of the fuse library installed on the system.  Unfortunately while
> + * gcc won't complain if there are static inline functions which are
> + * not used, clang will only suppress such complaints if the static
> + * inline functions are in a header file.
> + */
> +void fuse2fs_shut_up_stupid_clang_warnings(void)
> +{
> +	SUPPRESS_UNUSED_FUNCTION(fuse2fs_shut_up_stupid_clang_warnings);

Why is this stupid recursive shi ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
even necessary?

> +	SUPPRESS_UNUSED_FUNCTION(round_up);
> +	SUPPRESS_UNUSED_FUNCTION(round_down);
> +	SUPPRESS_UNUSED_FUNCTION(FUSE4FS_B_TO_FSBT);
> +	SUPPRESS_UNUSED_FUNCTION(FUSE4FS_OFF_IN_FSB);
> +	SUPPRESS_UNUSED_FUNCTION(FUSE4FS_B_TO_FSB);
> +	SUPPRESS_UNUSED_FUNCTION(FUSE4FS_FSB_TO_B);

Hrmm some of these aren't strictly necessary, but ... oh.  The first
three are actively used in the punch hole helpers, but that only applies
on a platform that *supports* hole punching.  So my guess is that these
clang warnings appear on macos, where there isn't holepunching?

--D

> +}
> +#endif
> +
>  static double gettime_monotonic(void)
>  {
>  #ifdef CLOCK_MONOTONIC
> diff --git a/misc/fuse2fs.c b/misc/fuse2fs.c
> index 0f4781bc4..c46cfc236 100644
> --- a/misc/fuse2fs.c
> +++ b/misc/fuse2fs.c
> @@ -339,6 +339,27 @@ static inline off_t FUSE2FS_FSB_TO_B(const struct fuse2fs *ff, blk64_t bno)
>  	return bno << ff->blocklog;
>  }
>  
> +#ifdef __clang__
> +#define SUPPRESS_UNUSED_FUNCTION(func)    (void)func
> +/*
> + * These functions might or might not be used depending on the version
> + * of the fuse library installed on the system.  Unfortunately while
> + * gcc won't complain if there are static inline functions which are
> + * not used, clang will only suppress such complaints if the static
> + * inline functions are in a header file.
> + */
> +void fuse2fs_shut_up_stupid_clang_warnings(void)
> +{
> +	SUPPRESS_UNUSED_FUNCTION(fuse2fs_shut_up_stupid_clang_warnings);
> +	SUPPRESS_UNUSED_FUNCTION(round_up);
> +	SUPPRESS_UNUSED_FUNCTION(round_down);
> +	SUPPRESS_UNUSED_FUNCTION(FUSE2FS_B_TO_FSBT);
> +	SUPPRESS_UNUSED_FUNCTION(FUSE2FS_OFF_IN_FSB);
> +	SUPPRESS_UNUSED_FUNCTION(FUSE2FS_B_TO_FSB);
> +	SUPPRESS_UNUSED_FUNCTION(FUSE2FS_FSB_TO_B);
> +}
> +#endif
> +
>  static double gettime_monotonic(void)
>  {
>  #ifdef CLOCK_MONOTONIC
> -- 
> 2.53.0
> 
> 

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 5/7] libsupport: remove the LIST_HEAD macro from list.h
  2026-05-04 23:32 ` [PATCH 5/7] libsupport: remove the LIST_HEAD macro from list.h Theodore Ts'o
@ 2026-05-05  0:20   ` Darrick J. Wong
  0 siblings, 0 replies; 19+ messages in thread
From: Darrick J. Wong @ 2026-05-05  0:20 UTC (permalink / raw)
  To: Theodore Ts'o; +Cc: Ext4 Developers List

On Mon, May 04, 2026 at 07:32:59PM -0400, Theodore Ts'o wrote:
> The LIST_HEAD macro is defined by both the Linux kernel's list.h and
> <sys/queue.h> (originally from BSD).  The problem is that on MacOS,
> some system header file pulls in <sys/queue.h> leading to a macro
> redefiniction conflict.  Since we don't use LIST_HEAD in e2fsprogs,
> the simplest mitigation is to just comment out the definition of LIST_HEAD.
> 
> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
> Fixes: 37dafcc0894b ("libsupport: port the kernel list.h to libsupport")

Sounds fine to me.
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

--D

> ---
>  lib/support/list.h | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/lib/support/list.h b/lib/support/list.h
> index 0e00e446d..0ec8de525 100644
> --- a/lib/support/list.h
> +++ b/lib/support/list.h
> @@ -36,8 +36,17 @@ static inline void list_head_destroy(struct list_head *list)
>  
>  #define LIST_HEAD_INIT(name) { &(name), &(name) }
>  
> +#if 0
> +/*
> + * This conflicts with the LIST_HEAD defined in <sys/queue.h>.  We
> + * don't include it in e2fsprogs, but some systems' header files might
> + * pull it in, leading to the macro redefinition conflict.
> + * Fortunately, we also don't need LIST_HEAD in e2fsprogs, so just
> + * drop this convenience macro.
> + */
>  #define LIST_HEAD(name) \
>  	struct list_head name = LIST_HEAD_INIT(name)
> +#endif
>  
>  /**
>   * INIT_LIST_HEAD - Initialize a list_head structure
> -- 
> 2.53.0
> 
> 

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 6/7] libsupport: fix gcc -Wall warnings
  2026-05-04 23:33 ` [PATCH 6/7] libsupport: fix gcc -Wall warnings Theodore Ts'o
@ 2026-05-05  0:20   ` Darrick J. Wong
  0 siblings, 0 replies; 19+ messages in thread
From: Darrick J. Wong @ 2026-05-05  0:20 UTC (permalink / raw)
  To: Theodore Ts'o; +Cc: Ext4 Developers List

On Mon, May 04, 2026 at 07:33:00PM -0400, Theodore Ts'o wrote:
> Signed-off-by: Theodore Ts'o <tytso@mit.edu>

Looks good to me,
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

--D

> ---
>  lib/support/cache.c | 12 +++++++++---
>  lib/support/cache.h |  2 +-
>  lib/support/list.h  |  8 ++++----
>  3 files changed, 14 insertions(+), 8 deletions(-)
> 
> diff --git a/lib/support/cache.c b/lib/support/cache.c
> index aec785347..ece0adece 100644
> --- a/lib/support/cache.c
> +++ b/lib/support/cache.c
> @@ -15,6 +15,12 @@
>  #include <stdint.h>
>  #include <errno.h>
>  
> +#ifdef __GNUC__
> +#define EXT2FS_ATTR(x) __attribute__(x)
> +#else
> +#define EXT2FS_ATTR(x)
> +#endif
> +
>  #include "config.h"
>  #include "list.h"
>  #include "cache.h"
> @@ -711,7 +717,7 @@ cache_node_put(
>  
>  void
>  cache_node_set_priority(
> -	struct cache *		cache,
> +	struct cache *		cache EXT2FS_ATTR((unused)),
>  	struct cache_node *	node,
>  	int			priority)
>  {
> @@ -820,7 +826,7 @@ cache_flush(
>  {
>  	struct cache_hash	*hash;
>  	struct cache_node	*node;
> -	int			i;
> +	unsigned int		i;
>  	bool			still_dirty = false;
>  
>  	if (!cache->flush)
> @@ -848,7 +854,7 @@ cache_report(
>  	const char	*name,
>  	struct cache	*cache)
>  {
> -	int		i;
> +	unsigned int	i;
>  	unsigned long	count, index, total;
>  	unsigned long	hash_bucket_lengths[HASH_REPORT + 2] = { 0 };
>  
> diff --git a/lib/support/cache.h b/lib/support/cache.h
> index 71fb9762f..cd0e8c20e 100644
> --- a/lib/support/cache.h
> +++ b/lib/support/cache.h
> @@ -83,7 +83,7 @@ typedef unsigned int (*cache_node_resize_t)(const struct cache *c,
>  					    unsigned int curr_size,
>  					    int dir);
>  
> -static inline unsigned int cache_gradual_resize(const struct cache *cache,
> +static inline unsigned int cache_gradual_resize(const struct cache *cache EXT2FS_ATTR((unused)),
>  						unsigned int curr_size,
>  						int dir)
>  {
> diff --git a/lib/support/list.h b/lib/support/list.h
> index 0ec8de525..54e8e2360 100644
> --- a/lib/support/list.h
> +++ b/lib/support/list.h
> @@ -148,13 +148,13 @@ static __always_inline bool __list_del_entry_valid(struct list_head *entry)
>  	return ret;
>  }
>  #else
> -static inline bool __list_add_valid(struct list_head *new,
> -				struct list_head *prev,
> -				struct list_head *next)
> +static inline bool __list_add_valid(struct list_head *new EXT2FS_ATTR((unused)),
> +				struct list_head *prev EXT2FS_ATTR((unused)),
> +				struct list_head *next EXT2FS_ATTR((unused)))
>  {
>  	return true;
>  }
> -static inline bool __list_del_entry_valid(struct list_head *entry)
> +static inline bool __list_del_entry_valid(struct list_head *entry EXT2FS_ATTR((unused)))
>  {
>  	return true;
>  }
> -- 
> 2.53.0
> 
> 

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 7/7] fuse2fs: fix uninitialized variable warnings
  2026-05-04 23:33 ` [PATCH 7/7] fuse2fs: fix uninitialized variable warnings Theodore Ts'o
@ 2026-05-05  0:26   ` Darrick J. Wong
  0 siblings, 0 replies; 19+ messages in thread
From: Darrick J. Wong @ 2026-05-05  0:26 UTC (permalink / raw)
  To: Theodore Ts'o; +Cc: Ext4 Developers List

On Mon, May 04, 2026 at 07:33:01PM -0400, Theodore Ts'o wrote:
> Clang treats use of unitialized variables found by static analysis to
> be serious enough that it will emit them by default (even without
> -Wall).  So let's fix them up.
> 
> Signed-off-by: Theodore Ts'o <tytso@mit.edu>

I wonder why gcc doesn't complain about this??

Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

--D

> ---
>  fuse4fs/fuse4fs.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/fuse4fs/fuse4fs.c b/fuse4fs/fuse4fs.c
> index b883083f8..928473268 100644
> --- a/fuse4fs/fuse4fs.c
> +++ b/fuse4fs/fuse4fs.c
> @@ -2216,7 +2216,7 @@ static void op_mknod(fuse_req_t req, fuse_ino_t fino, const char *name,
>  	const struct fuse_ctx *ctxt = fuse_req_ctx(req);
>  	struct fuse4fs *ff = fuse4fs_get(req);
>  	ext2_filsys fs;
> -	ext2_ino_t parent, child;
> +	ext2_ino_t parent, child = 0;
>  	errcode_t err;
>  	int filetype;
>  	gid_t gid;
> @@ -2311,7 +2311,7 @@ static void op_mkdir(fuse_req_t req, fuse_ino_t fino, const char *name,
>  	const struct fuse_ctx *ctxt = fuse_req_ctx(req);
>  	struct fuse4fs *ff = fuse4fs_get(req);
>  	ext2_filsys fs;
> -	ext2_ino_t parent, child;
> +	ext2_ino_t parent, child = 0;
>  	errcode_t err;
>  	char *block;
>  	blk64_t blk;
> @@ -2990,7 +2990,7 @@ static void op_symlink(fuse_req_t req, const char *target, fuse_ino_t fino,
>  	const struct fuse_ctx *ctxt = fuse_req_ctx(req);
>  	struct fuse4fs *ff = fuse4fs_get(req);
>  	ext2_filsys fs;
> -	ext2_ino_t parent, child;
> +	ext2_ino_t parent, child = 0;
>  	errcode_t err;
>  	gid_t gid;
>  	int ret = 0;
> @@ -6042,7 +6042,7 @@ static int fuse4fs_main(struct fuse_args *args, struct fuse4fs *ff)
>  	struct fuse_cmdline_opts opts;
>  	struct fuse_session *se;
>  	struct fuse_loop_config *loop_config = NULL;
> -	int ret;
> +	int ret = 0;
>  
>  	if (fuse_parse_cmdline(args, &opts) != 0) {
>  		ret = 1;
> -- 
> 2.53.0
> 
> 

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 0/7] fix up issues from djwong/fuse4fs-fork
  2026-05-05  0:08 ` [PATCH 0/7] fix up issues from djwong/fuse4fs-fork Darrick J. Wong
@ 2026-05-05  7:21   ` Theodore Tso
  2026-05-05 15:58     ` Darrick J. Wong
  0 siblings, 1 reply; 19+ messages in thread
From: Theodore Tso @ 2026-05-05  7:21 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: Ext4 Developers List

On Mon, May 04, 2026 at 05:08:31PM -0700, Darrick J. Wong wrote:
> Hm, curious.  It's regrettable that I no longer have a Mac, and
> therefore can't really do much investigating.  If you give
> -o default_permissions,allow_other , does that fix the problem?
> If that fixes it, then fuse2fs has a bug somewhere in its own
> permissions checking.

Nice catch!  Yes, using default_permissions does fix things.  So now I
need to figure out what changed between v1.47.4 and next, and what
default_permissions does.  I notice that in kernel mode we enable
default_permissions?

Can you give me a suggestion at what I might try to look at next?

    	     	  	     	     - Ted




^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 0/7] fix up issues from djwong/fuse4fs-fork
  2026-05-05  7:21   ` Theodore Tso
@ 2026-05-05 15:58     ` Darrick J. Wong
  2026-05-05 22:04       ` Theodore Tso
  0 siblings, 1 reply; 19+ messages in thread
From: Darrick J. Wong @ 2026-05-05 15:58 UTC (permalink / raw)
  To: Theodore Tso; +Cc: Ext4 Developers List

On Tue, May 05, 2026 at 09:21:44AM +0200, Theodore Tso wrote:
> On Mon, May 04, 2026 at 05:08:31PM -0700, Darrick J. Wong wrote:
> > Hm, curious.  It's regrettable that I no longer have a Mac, and
> > therefore can't really do much investigating.  If you give
> > -o default_permissions,allow_other , does that fix the problem?
> > If that fixes it, then fuse2fs has a bug somewhere in its own
> > permissions checking.
> 
> Nice catch!  Yes, using default_permissions does fix things.  So now I
> need to figure out what changed between v1.47.4 and next, and what
> default_permissions does.  I notice that in kernel mode we enable
> default_permissions?

Yes.  Though the addition of allow_other and default_permissions was
exactly the same in 1.47.4.

> Can you give me a suggestion at what I might try to look at next?

Hrm.  A bisect would be the best (but least conference-friendly) option
to narrow things down.

On Linux, adding "default_permissions" means that the kernel uses the
same permission checking code that it uses for in-kernel filesystems.
Without it, the fuse server is responsible for doing all permission
checking.

And now that I've tried it, there are bugs in fuse2fs' permission
checking (aka !default_permissions):

# fuse2fs /dev/sda /mnt -d -f -o iomap=0,allow_other
# mkdir /mnt/lost+found/frogs
# su - djwong
$ ls -d /mnt/ /mnt/lost+found/ /mnt/lost+found/frogs/
drwxr-xr-x 3 root root  4096 May  5 08:32 /mnt//
drwx------ 3 root root 16384 May  5 08:49 /mnt/lost+found//
drwxr-xr-x 2 root root  4096 May  5 08:49 /mnt/lost+found/frogs//

So I guess I'm still confused.  I've wondered if fuse2fs should always
inject default_permissions?

--D

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 0/7] fix up issues from djwong/fuse4fs-fork
  2026-05-05 15:58     ` Darrick J. Wong
@ 2026-05-05 22:04       ` Theodore Tso
  0 siblings, 0 replies; 19+ messages in thread
From: Theodore Tso @ 2026-05-05 22:04 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: Ext4 Developers List

[-- Attachment #1: Type: text/plain, Size: 991 bytes --]

On Tue, May 05, 2026 at 08:58:21AM -0700, Darrick J. Wong wrote:
> Hrm.  A bisect would be the best (but least conference-friendly) option
> to narrow things down.

Well, a bisect was a bit painful because I had to cherry-pick patches
so I could get a successfull build.  But I did finally come up with
the guilty commit, and it's.... surprising at least to me:

commit b0bd58062bbf645942ab4f0aced3bb229f462dde
Author: Darrick J. Wong <djwong@kernel.org>
Date:   Thu Aug 28 10:30:40 2025 -0700

    fuse2fs: cache symlink targets in the kernel

    Speed up symlinks by allowing the kernel to cache them.

    Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>

I don't know why it made a difference, but this attached patch appears
fix the MacOS regression.  Could this be a bug in MacFuse[1]?  FWIW, I'm
running MacFuse 5.2.0_1 from MacPorts.

[1] https://macfuse.github.io

I could condition the patch so that we only avoid setting
FUSE_CAP_CACHE_SYMLINKS on MacOS?  WDYT?

						- Ted

[-- Attachment #2: 0001-Revert-fuse2fs-cache-symlink-targets-in-the-kernel.patch --]
[-- Type: text/plain, Size: 1085 bytes --]

From fb3d2fc975d17d97ed76b2ed76022462a3b329f1 Mon Sep 17 00:00:00 2001
From: Theodore Ts'o <tytso@mit.edu>
Date: Tue, 5 May 2026 23:34:53 +0200
Subject: [PATCH] Revert "fuse2fs: cache symlink targets in the kernel"

This reverts commit b0bd58062bbf645942ab4f0aced3bb229f462dde.

This commit is apparently causing fuse2fs on MacOS to fail without "-o
default_permissions".  It's not clear why, but it was determined using
a git bisect, and reverting the commit addresses the regression.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
 misc/fuse2fs.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/misc/fuse2fs.c b/misc/fuse2fs.c
index c46cfc23..0f9cefa6 100644
--- a/misc/fuse2fs.c
+++ b/misc/fuse2fs.c
@@ -1593,9 +1593,6 @@ static void *op_init(struct fuse_conn_info *conn,
 	if (ff->acl)
 		fuse_set_feature_flag(conn, FUSE_CAP_POSIX_ACL);
 #endif
-#ifdef FUSE_CAP_CACHE_SYMLINKS
-	fuse_set_feature_flag(conn, FUSE_CAP_CACHE_SYMLINKS);
-#endif
 #ifdef FUSE_CAP_NO_EXPORT_SUPPORT
 	fuse_set_feature_flag(conn, FUSE_CAP_NO_EXPORT_SUPPORT);
 #endif
-- 
2.50.1 (Apple Git-155)


^ permalink raw reply related	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2026-05-05 22:04 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-04 23:32 [PATCH 0/7] fix up issues from djwong/fuse4fs-fork Theodore Ts'o
2026-05-04 23:32 ` [PATCH 1/7] libsupport: drop xbitops.h and define fls() if necessary Theodore Ts'o
2026-05-05  0:11   ` Darrick J. Wong
2026-05-04 23:32 ` [PATCH 2/7] configure.ac: fix disable fuse2fs/fuse4fs by default path Theodore Ts'o
2026-05-05  0:13   ` Darrick J. Wong
2026-05-04 23:32 ` [PATCH 3/7] libsupport: don't use bzero in cache.c Theodore Ts'o
2026-05-05  0:15   ` Darrick J. Wong
2026-05-04 23:32 ` [PATCH 4/7] fuse[24]fs: suppress clang warnings which were breaking the github CI Theodore Ts'o
2026-05-05  0:20   ` Darrick J. Wong
2026-05-04 23:32 ` [PATCH 5/7] libsupport: remove the LIST_HEAD macro from list.h Theodore Ts'o
2026-05-05  0:20   ` Darrick J. Wong
2026-05-04 23:33 ` [PATCH 6/7] libsupport: fix gcc -Wall warnings Theodore Ts'o
2026-05-05  0:20   ` Darrick J. Wong
2026-05-04 23:33 ` [PATCH 7/7] fuse2fs: fix uninitialized variable warnings Theodore Ts'o
2026-05-05  0:26   ` Darrick J. Wong
2026-05-05  0:08 ` [PATCH 0/7] fix up issues from djwong/fuse4fs-fork Darrick J. Wong
2026-05-05  7:21   ` Theodore Tso
2026-05-05 15:58     ` Darrick J. Wong
2026-05-05 22:04       ` Theodore Tso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox