Skip to content

Commit 5e3c208

Browse files
author
Kent Overstreet
committed
bcachefs: Ratelimit checksum error messages
Signed-off-by: Kent Overstreet <[email protected]>
1 parent 0f3372d commit 5e3c208

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

fs/bcachefs/checksum.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <linux/xxhash.h>
1111
#include <linux/key.h>
1212
#include <linux/random.h>
13+
#include <linux/ratelimit.h>
1314
#include <linux/scatterlist.h>
1415
#include <crypto/algapi.h>
1516
#include <crypto/chacha.h>
@@ -436,7 +437,7 @@ int bch2_rechecksum_bio(struct bch_fs *c, struct bio *bio,
436437
if (bch2_crc_cmp(merged, crc_old.csum) && !c->opts.no_data_io) {
437438
struct printbuf buf = PRINTBUF;
438439
prt_printf(&buf, "checksum error in %s() (memory corruption or bug?)\n"
439-
"expected %0llx:%0llx got %0llx:%0llx (old type ",
440+
" expected %0llx:%0llx got %0llx:%0llx (old type ",
440441
__func__,
441442
crc_old.csum.hi,
442443
crc_old.csum.lo,
@@ -446,7 +447,7 @@ int bch2_rechecksum_bio(struct bch_fs *c, struct bio *bio,
446447
prt_str(&buf, " new type ");
447448
bch2_prt_csum_type(&buf, new_csum_type);
448449
prt_str(&buf, ")");
449-
bch_err(c, "%s", buf.buf);
450+
WARN_RATELIMIT(1, "%s", buf.buf);
450451
printbuf_exit(&buf);
451452
return -EIO;
452453
}

fs/bcachefs/io_write.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1080,7 +1080,10 @@ static int bch2_write_extent(struct bch_write_op *op, struct write_point *wp,
10801080
*_dst = dst;
10811081
return more;
10821082
csum_err:
1083-
bch_err(c, "%s write error: error verifying existing checksum while rewriting existing data (memory corruption?)",
1083+
bch_err_inum_offset_ratelimited(c,
1084+
op->pos.inode,
1085+
op->pos.offset << 9,
1086+
"%s write error: error verifying existing checksum while rewriting existing data (memory corruption?)",
10841087
op->flags & BCH_WRITE_MOVE ? "move" : "user");
10851088
ret = -EIO;
10861089
err:

0 commit comments

Comments
 (0)