From: Kent Overstreet Date: Sun, 2 Jan 2022 00:04:33 +0000 (-0500) Subject: bcachefs: Improve error messages in superblock write path X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=bf15946316757a4fd23c87e51434520bd6a87f64;p=users%2Fjedix%2Flinux-maple.git bcachefs: Improve error messages in superblock write path Signed-off-by: Kent Overstreet --- diff --git a/fs/bcachefs/super-io.c b/fs/bcachefs/super-io.c index 8928f1ba53548..e0b1dfadacd94 100644 --- a/fs/bcachefs/super-io.c +++ b/fs/bcachefs/super-io.c @@ -754,11 +754,24 @@ int bch2_write_super(struct bch_fs *c) closure_sync(cl); for_each_online_member(ca, c, i) { - if (!ca->sb_write_error && - ca->disk_sb.seq != - le64_to_cpu(ca->sb_read_scratch->seq)) { + if (ca->sb_write_error) + continue; + + if (le64_to_cpu(ca->sb_read_scratch->seq) < ca->disk_sb.seq) { + bch2_fs_fatal_error(c, + "Superblock write was silently dropped! (seq %llu expected %llu)", + le64_to_cpu(ca->sb_read_scratch->seq), + ca->disk_sb.seq); + percpu_ref_put(&ca->io_ref); + ret = -EROFS; + goto out; + } + + if (le64_to_cpu(ca->sb_read_scratch->seq) > ca->disk_sb.seq) { bch2_fs_fatal_error(c, - "Superblock modified by another process"); + "Superblock modified by another process (seq %llu expected %llu)", + le64_to_cpu(ca->sb_read_scratch->seq), + ca->disk_sb.seq); percpu_ref_put(&ca->io_ref); ret = -EROFS; goto out;