Message ID | 0cd08a6b0f5285498811504d3713ced3afe3b8d2.1707812175.git.johannes.thumshirn@wdc.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | btrfs: zoned: don't skip block group profile checks on conv zones | expand |
On Tue, Feb 13, 2024 at 12:16:15AM -0800, Johannes Thumshirn wrote: > On a zoned filesystem with conventional zones, we're skipping the block > group profile checks for the conventional zones. > > This allows converting a zoned filesystem's data block groups to RAID when > all of the zones backing the chunk are on conventional zones. But this > will lead to problems, once we're trying to allocate chunks backed by > sequential zones. > > So also check for conventional zones when loading a block group's profile > on them. > > Reported-by: HAN Yuwei <hrx@bupt.moe> > Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Reviewed-by: Boris Burkov <boris@bur.io> > --- > --- > fs/btrfs/zoned.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c > index d9716456bce0..e43c689b1253 100644 > --- a/fs/btrfs/zoned.c > +++ b/fs/btrfs/zoned.c > @@ -1637,6 +1637,15 @@ int btrfs_load_block_group_zone_info(struct btrfs_block_group *cache, bool new) > } > > out: > + /* Reject non SINGLE data profiles without RST */ > + if ((map->type & BTRFS_BLOCK_GROUP_DATA) && > + (map->type & BTRFS_BLOCK_GROUP_PROFILE_MASK) && > + !fs_info->stripe_root) { > + btrfs_err(fs_info, "zoned: data %s needs raid-stripe-tree", > + btrfs_bg_type_to_raid_name(map->type)); > + return -EINVAL; > + } > + > if (cache->alloc_offset > cache->zone_capacity) { > btrfs_err(fs_info, > "zoned: invalid write pointer %llu (larger than zone capacity %llu) in block group %llu", > -- > 2.43.0 >
On Tue, Feb 13, 2024 at 12:16:15AM -0800, Johannes Thumshirn wrote: > On a zoned filesystem with conventional zones, we're skipping the block > group profile checks for the conventional zones. > > This allows converting a zoned filesystem's data block groups to RAID when > all of the zones backing the chunk are on conventional zones. But this > will lead to problems, once we're trying to allocate chunks backed by > sequential zones. > > So also check for conventional zones when loading a block group's profile > on them. > > Reported-by: HAN Yuwei <hrx@bupt.moe> > Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> > --- > --- > fs/btrfs/zoned.c | 9 +++++++++ > 1 file changed, 9 insertions(+) Looks good, Reviewed-by: Naohiro Aota <naohiro.aota@wdc.com>
On Tue, Feb 13, 2024 at 12:16:15AM -0800, Johannes Thumshirn wrote: > On a zoned filesystem with conventional zones, we're skipping the block > group profile checks for the conventional zones. > > This allows converting a zoned filesystem's data block groups to RAID when > all of the zones backing the chunk are on conventional zones. But this > will lead to problems, once we're trying to allocate chunks backed by > sequential zones. > > So also check for conventional zones when loading a block group's profile > on them. > > Reported-by: HAN Yuwei <hrx@bupt.moe> > Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> Reviewed-by: David Sterba <dsterba@suse.com> Please add link to the report (as Link: tag), I think it is interesting how the root cause was discovered.
diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c index d9716456bce0..e43c689b1253 100644 --- a/fs/btrfs/zoned.c +++ b/fs/btrfs/zoned.c @@ -1637,6 +1637,15 @@ int btrfs_load_block_group_zone_info(struct btrfs_block_group *cache, bool new) } out: + /* Reject non SINGLE data profiles without RST */ + if ((map->type & BTRFS_BLOCK_GROUP_DATA) && + (map->type & BTRFS_BLOCK_GROUP_PROFILE_MASK) && + !fs_info->stripe_root) { + btrfs_err(fs_info, "zoned: data %s needs raid-stripe-tree", + btrfs_bg_type_to_raid_name(map->type)); + return -EINVAL; + } + if (cache->alloc_offset > cache->zone_capacity) { btrfs_err(fs_info, "zoned: invalid write pointer %llu (larger than zone capacity %llu) in block group %llu",
On a zoned filesystem with conventional zones, we're skipping the block group profile checks for the conventional zones. This allows converting a zoned filesystem's data block groups to RAID when all of the zones backing the chunk are on conventional zones. But this will lead to problems, once we're trying to allocate chunks backed by sequential zones. So also check for conventional zones when loading a block group's profile on them. Reported-by: HAN Yuwei <hrx@bupt.moe> Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com> --- --- fs/btrfs/zoned.c | 9 +++++++++ 1 file changed, 9 insertions(+)