Skip to content

Commit 74098a9

Browse files
morbidrsakdave
authored andcommitted
btrfs: zoned: use zone aware sb location for scrub
At the moment scrub_supers() doesn't grab the super block's location via the zoned device aware btrfs_sb_log_location() but via btrfs_sb_offset(). This leads to checksum errors on 'scrub' as we're not accessing the correct location of the super block. So use btrfs_sb_log_location() for getting the super blocks location on scrub. Reported-by: WA AM <[email protected]> Link: http://lore.kernel.org/linux-btrfs/CANU2Z0EvUzfYxczLgGUiREoMndE9WdQnbaawV5Fv5gNXptPUKw@mail.gmail.com CC: [email protected] # 5.15+ Reviewed-by: Qu Wenruo <[email protected]> Reviewed-by: Naohiro Aota <[email protected]> Signed-off-by: Johannes Thumshirn <[email protected]> Reviewed-by: David Sterba <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 1cab137 commit 74098a9

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

fs/btrfs/scrub.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2812,7 +2812,17 @@ static noinline_for_stack int scrub_supers(struct scrub_ctx *sctx,
28122812
gen = btrfs_get_last_trans_committed(fs_info);
28132813

28142814
for (i = 0; i < BTRFS_SUPER_MIRROR_MAX; i++) {
2815-
bytenr = btrfs_sb_offset(i);
2815+
ret = btrfs_sb_log_location(scrub_dev, i, 0, &bytenr);
2816+
if (ret == -ENOENT)
2817+
break;
2818+
2819+
if (ret) {
2820+
spin_lock(&sctx->stat_lock);
2821+
sctx->stat.super_errors++;
2822+
spin_unlock(&sctx->stat_lock);
2823+
continue;
2824+
}
2825+
28162826
if (bytenr + BTRFS_SUPER_INFO_SIZE >
28172827
scrub_dev->commit_total_bytes)
28182828
break;

0 commit comments

Comments
 (0)