]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
fuse2fs: return -EOPNOTSUPP when we don't recognize a fallocate mode
authorDarrick J. Wong <djwong@kernel.org>
Thu, 24 Apr 2025 21:41:18 +0000 (14:41 -0700)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 9 Jun 2025 20:08:10 +0000 (16:08 -0400)
If we don't recognize a set bit in the mode parameter to fallocate,
return EOPNOTSUPP to communicate that we don't support that mode instead
of EINVAL.  This avoids unnecessary failures in generic/521 such as:

generic/521       - output mismatch (see /var/tmp/fstests/generic/521.out.bad)
    --- tests/generic/521.out   2025-01-30 10:00:16.898276477 -0800
    +++ /var/tmp/fstests/generic/521.out.bad    2025-04-03 14:46:20.019822396 -0700
    @@ -1,2 +1,9 @@
     QA output created by 521
    +zero range: 0x407ca to 0x52885
    +do_zero_range: fallocate: Invalid argument

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Link: https://lore.kernel.org/r/174553064961.1160461.9412670014664878384.stgit@frogsfrogsfrogs
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
(cherry picked from commit 7775293c08d2255e90b1e003ee532d826af52d95)

misc/fuse2fs.c

index 2e04632019bd4af60363e1c761fcdc8078febbbf..1ec7cd22f8a6ce0402e66ee59c45a903c52bb864 100644 (file)
@@ -3616,7 +3616,7 @@ static int op_fallocate(const char *path EXT2FS_ATTR((unused)), int mode,
 
        /* Catch unknown flags */
        if (mode & ~(FL_PUNCH_HOLE_FLAG | FL_KEEP_SIZE_FLAG))
-               return -EINVAL;
+               return -EOPNOTSUPP;
 
        pthread_mutex_lock(&ff->bfl);
        if (!fs_writeable(fs)) {