]> git.baikalelectronics.ru Git - kernel.git/commitdiff
btrfs: fail if fstrim_range->start == U64_MAX
authorJosef Bacik <josef@toxicpanda.com>
Mon, 22 Nov 2021 22:04:19 +0000 (17:04 -0500)
committerDavid Sterba <dsterba@suse.com>
Wed, 8 Dec 2021 14:42:24 +0000 (15:42 +0100)
We've always been failing generic/260 because it's testing things we
actually don't care about and thus won't fail for.  However we probably
should fail for fstrim_range->start == U64_MAX since we clearly can't
trim anything past that.  This in combination with an update to
generic/260 will allow us to pass this test properly.

Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent-tree.c

index 3fd736a02c1e6d4ad5d2e26edda031416f33c8f3..fc4895e6a62cd18ca6110b3c87d1874d47d237f0 100644 (file)
@@ -6051,6 +6051,9 @@ int btrfs_trim_fs(struct btrfs_fs_info *fs_info, struct fstrim_range *range)
        int dev_ret = 0;
        int ret = 0;
 
+       if (range->start == U64_MAX)
+               return -EINVAL;
+
        /*
         * Check range overflow if range->len is set.
         * The default range->len is U64_MAX.