]> git.ipfire.org Git - people/arne_f/kernel.git/commitdiff
btrfs: reset max_extent_size on clear in a bitmap
authorJosef Bacik <jbacik@fb.com>
Fri, 28 Sep 2018 11:18:00 +0000 (07:18 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 13 Nov 2018 19:15:14 +0000 (11:15 -0800)
commit 553cceb49681d60975d00892877d4c871bf220f9 upstream.

We need to clear the max_extent_size when we clear bits from a bitmap
since it could have been from the range that contains the
max_extent_size.

CC: stable@vger.kernel.org # 4.4+
Reviewed-by: Liu Bo <bo.liu@linux.alibaba.com>
Signed-off-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/btrfs/free-space-cache.c

index e75489e3b67cd21c8d418edd8ef44e921a31cf8f..9b3fbe7c16a910d0a06e03ff10fb443dc792a99b 100644 (file)
@@ -1710,6 +1710,8 @@ static inline void __bitmap_clear_bits(struct btrfs_free_space_ctl *ctl,
        bitmap_clear(info->bitmap, start, count);
 
        info->bytes -= bytes;
+       if (info->max_extent_size > ctl->unit)
+               info->max_extent_size = 0;
 }
 
 static void bitmap_clear_bits(struct btrfs_free_space_ctl *ctl,