[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <175573318801.4130038.5441212769275575364.stgit@frogsfrogsfrogs>
Date: Wed, 20 Aug 2025 16:43:44 -0700
From: "Darrick J. Wong" <djwong@...nel.org>
To: tytso@....edu
Cc: linux-ext4@...r.kernel.org, linux-ext4@...r.kernel.org
Subject: [PATCH 11/12] fuse2fs: disable fallocate/zero range on indirect files
From: Darrick J. Wong <djwong@...nel.org>
Indirect mapped files can't have unwritten extents, so we can't do
unwritten preallocation or zero-range because both depend on unwritten
extents.
Cc: <linux-ext4@...r.kernel.org> # v1.43
Fixes: 81cbf1ef4f5dab ("misc: add fuse2fs, a FUSE server for e2fsprogs")
Signed-off-by: "Darrick J. Wong" <djwong@...nel.org>
---
misc/fuse2fs.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/misc/fuse2fs.c b/misc/fuse2fs.c
index 318bfb55345b9b..cb5620c7e2ee33 100644
--- a/misc/fuse2fs.c
+++ b/misc/fuse2fs.c
@@ -4137,6 +4137,10 @@ static int fallocate_helper(struct fuse_file_info *fp, int mode, off_t offset,
return err;
fsize = EXT2_I_SIZE(&inode);
+ /* Indirect files do not support unwritten extents */
+ if (!(inode.i_flags & EXT4_EXTENTS_FL))
+ return -EOPNOTSUPP;
+
/* Allocate a bunch of blocks */
flags = (mode & FL_KEEP_SIZE_FLAG ? 0 :
EXT2_FALLOCATE_INIT_BEYOND_EOF);
@@ -4279,6 +4283,14 @@ static int punch_helper(struct fuse_file_info *fp, int mode, off_t offset,
if (err)
return translate_error(fs, fh->ino, err);
+ /*
+ * Indirect files do not support unwritten extents, which means we
+ * can't support zero range. Punch goes first in zero-range, which
+ * is why the check is here.
+ */
+ if ((mode & FL_ZERO_RANGE_FLAG) && !(inode.i_flags & EXT4_EXTENTS_FL))
+ return -EOPNOTSUPP;
+
/* Zero everything before the first block and after the last block */
if (FUSE2FS_B_TO_FSBT(ff, offset) == FUSE2FS_B_TO_FSBT(ff, offset + len))
err = clean_block_middle(ff, fh->ino, &inode, offset,
Powered by blists - more mailing lists