Message ID | cover.1697104952.git.naohiro.aota@wdc.com (mailing list archive) |
---|---|
Headers | show |
Series | btrfs-progs: zoned: check existence of SB zone, not LBA | expand |
On Thu, Oct 12, 2023 at 11:19:28PM +0900, Naohiro Aota wrote: > Running btrfs check can fail on a certain zoned decice setup (e.g, > zone size = 128MB, device size = 16GB): > > (from generic/330) > yes|/usr/local/bin/btrfs check --repair --force /dev/nullb1 > [1/7] checking root items > Fixed 0 roots. > [2/7] checking extents > ERROR: zoned: failed to read zone info of 4096 and 4097: Invalid argument > ERROR: failed to write super block for devid 1: write error: Input/output error > failed to write new super block err -5 > failed to repair damaged filesystem, aborting > > This happens because write_dev_supers() is comparing the original > superblock location vs the device size to check if it can write out a > superblock copy or not. > > For the above example, since the first copy location (64MB) < device size > (16GB), it tries to write out the copy. But, the copy must be written into > zone 4096 (512G / zone size (128M) = 4096), which is out of the device. I've added the text above to changelog of patch 2 as it's relevant for the change. > To address the issue, this series introduces check_sb_location() to check > if a SB copy can be written out. > > The patch 1 is a preparation to factor out logic of converting the original > superblock location to SB log writing superblock zone. And, the second one > implements check_sb_location() to write_dev_supers(). > > Naohiro Aota (2): > btrfs-progs: zoned: introduce sb_bytenr_to_sb_zone() > btrfs-progs: zoned: check SB zone existence properly Added to devel, thanks.