]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
bcachefs: Ratelimit checksum error messages
authorKent Overstreet <kent.overstreet@linux.dev>
Fri, 28 Jun 2024 17:51:38 +0000 (13:51 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Sun, 14 Jul 2024 23:00:16 +0000 (19:00 -0400)
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/checksum.c
fs/bcachefs/io_write.c

index 3bd3aba90d8f5c51c0d6853f9f1849f5b4f334dd..e7208bf1974e562616a3ee5a2a747f4da8389e27 100644 (file)
@@ -10,6 +10,7 @@
 #include <linux/xxhash.h>
 #include <linux/key.h>
 #include <linux/random.h>
+#include <linux/ratelimit.h>
 #include <linux/scatterlist.h>
 #include <crypto/algapi.h>
 #include <crypto/chacha.h>
@@ -436,7 +437,7 @@ int bch2_rechecksum_bio(struct bch_fs *c, struct bio *bio,
        if (bch2_crc_cmp(merged, crc_old.csum) && !c->opts.no_data_io) {
                struct printbuf buf = PRINTBUF;
                prt_printf(&buf, "checksum error in %s() (memory corruption or bug?)\n"
-                          "expected %0llx:%0llx got %0llx:%0llx (old type ",
+                          "  expected %0llx:%0llx got %0llx:%0llx (old type ",
                           __func__,
                           crc_old.csum.hi,
                           crc_old.csum.lo,
@@ -446,7 +447,7 @@ int bch2_rechecksum_bio(struct bch_fs *c, struct bio *bio,
                prt_str(&buf, " new type ");
                bch2_prt_csum_type(&buf, new_csum_type);
                prt_str(&buf, ")");
-               bch_err(c, "%s", buf.buf);
+               WARN_RATELIMIT(1, "%s", buf.buf);
                printbuf_exit(&buf);
                return -EIO;
        }
index 335e66222869ca61d5db91e64b9b3860ad2d14f3..b3b05e9392aea3d13e114ab4060f8dfff387d53f 100644 (file)
@@ -1080,7 +1080,10 @@ do_write:
        *_dst = dst;
        return more;
 csum_err:
-       bch_err(c, "%s write error: error verifying existing checksum while rewriting existing data (memory corruption?)",
+       bch_err_inum_offset_ratelimited(c,
+               op->pos.inode,
+               op->pos.offset << 9,
+               "%s write error: error verifying existing checksum while rewriting existing data (memory corruption?)",
                op->flags & BCH_WRITE_MOVE ? "move" : "user");
        ret = -EIO;
 err: