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);
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,