Skip to content

Commit 6fab154

Browse files
committed
Merge tag 'for-5.13-rc6-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux
Pull btrfs fix from David Sterba: "One more fix, for a space accounting bug in zoned mode. It happens when a block group is switched back rw->ro and unusable bytes (due to zoned constraints) are subtracted twice. It has user visible effects so I consider it important enough for late -rc inclusion and backport to stable" * tag 'for-5.13-rc6-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux: btrfs: zoned: fix negative space_info->bytes_readonly
2 parents 728a748 + f9f28e5 commit 6fab154

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

fs/btrfs/block-group.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2442,16 +2442,16 @@ void btrfs_dec_block_group_ro(struct btrfs_block_group *cache)
24422442
spin_lock(&sinfo->lock);
24432443
spin_lock(&cache->lock);
24442444
if (!--cache->ro) {
2445-
num_bytes = cache->length - cache->reserved -
2446-
cache->pinned - cache->bytes_super -
2447-
cache->zone_unusable - cache->used;
2448-
sinfo->bytes_readonly -= num_bytes;
24492445
if (btrfs_is_zoned(cache->fs_info)) {
24502446
/* Migrate zone_unusable bytes back */
24512447
cache->zone_unusable = cache->alloc_offset - cache->used;
24522448
sinfo->bytes_zone_unusable += cache->zone_unusable;
24532449
sinfo->bytes_readonly -= cache->zone_unusable;
24542450
}
2451+
num_bytes = cache->length - cache->reserved -
2452+
cache->pinned - cache->bytes_super -
2453+
cache->zone_unusable - cache->used;
2454+
sinfo->bytes_readonly -= num_bytes;
24552455
list_del_init(&cache->ro_list);
24562456
}
24572457
spin_unlock(&cache->lock);

0 commit comments

Comments
 (0)