Re: [PATCH] btrfs: fix negative space_info->bytes_readonly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jun 17, 2021 at 01:56:18PM +0900, Naohiro Aota wrote:
> Consider we have a using block group on zoned btrfs.
> 
> |<- ZU ->|<- used ->|<---free--->|
>                      `- Alloc offset
> ZU: Zone unusable
> 
> Marking the block group read-only will migrate the zone unusable bytes
> to the read-only bytes. So, we will have this.
> 
> |<- RO ->|<- used ->|<--- RO --->|
> RO: Read only
> 
> When marking it back to read-write, btrfs_dec_block_group_ro()
> subtracts the above "RO" bytes from the
> space_info->bytes_readonly. And, it moves the zone unusable bytes back
> and again subtracts those bytes from the space_info->bytes_readonly,
> leading to negative bytes_readonly.
> 
> This commit fixes the issue by reordering the operations.
> 
> Link: https://github.com/naota/linux/issues/37

I've copied the 'fi df' output to changelog.

> Fixes: 169e0da91a21 ("btrfs: zoned: track unusable bytes for zones")
> Cc: stable@xxxxxxxxxxxxxxx # 5.12+
> Signed-off-by: Naohiro Aota <naohiro.aota@xxxxxxx>

Added to misc-next, thanks.



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux