mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-29 05:44:11 +00:00
bcachefs: Check for writing superblocks with nonsense member seq fields
We're seeing some unmountable filesystems due to split brain detection going awry; it seems we somehow wrote out superblocks where we updated the superblock seq without updating any member seq fields. A given device's superblock should always have the main seq equal to it's member seq field, so this is easy to check for. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
5e105fb806
commit
c42006458b
1 changed files with 8 additions and 0 deletions
|
@ -470,6 +470,14 @@ static int bch2_sb_validate(struct bch_sb_handle *disk_sb, struct printbuf *out,
|
|||
return ret;
|
||||
}
|
||||
|
||||
if (rw == WRITE &&
|
||||
bch2_sb_member_get(sb, sb->dev_idx).seq != sb->seq) {
|
||||
prt_printf(out, "Invalid superblock: member seq %llu != sb seq %llu",
|
||||
le64_to_cpu(bch2_sb_member_get(sb, sb->dev_idx).seq),
|
||||
le64_to_cpu(sb->seq));
|
||||
return -BCH_ERR_invalid_sb_members_missing;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue