aboutsummaryrefslogtreecommitdiff
path: root/fs/bcachefs/super-io.c
diff options
context:
space:
mode:
authorGravatar Kent Overstreet <kent.overstreet@gmail.com> 2022-01-01 19:04:33 -0500
committerGravatar Kent Overstreet <kent.overstreet@linux.dev> 2023-10-22 17:09:21 -0400
commitbf15946316757a4fd23c87e51434520bd6a87f64 (patch)
tree721414f23c6915998c645d11d8a67e77a4fc08e1 /fs/bcachefs/super-io.c
parentbcachefs: Log what we're doing when repairing (diff)
downloadlinux-bf15946316757a4fd23c87e51434520bd6a87f64.tar.gz
linux-bf15946316757a4fd23c87e51434520bd6a87f64.tar.bz2
linux-bf15946316757a4fd23c87e51434520bd6a87f64.zip
bcachefs: Improve error messages in superblock write path
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/super-io.c')
-rw-r--r--fs/bcachefs/super-io.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/fs/bcachefs/super-io.c b/fs/bcachefs/super-io.c
index 8928f1ba5354..e0b1dfadacd9 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;