aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColy Li <colyli@suse.de>2023-03-07 18:14:34 +0800
committerColy Li <colyli@suse.de>2023-03-07 19:27:07 +0800
commitae04b5b805e796afdc523f1a6887ab93186ad91c (patch)
treeb34c6d3b863a35af5b6f5e77937bbd85cb5f0c41
parenta639543e6858589a1ac8ff59971683bb3930ce3d (diff)
downloadlinux-bcache-nvdimm-meta.tar.gz
bcache: print error message earlier in __bch_check_keys()nvdimm-meta
Currently bch_dump_bucket() is called before dumping all buckets information. If the cache device is quite large, it is possible that before all buckets information dumpped out, the system is reset or kmessage buffer is overwhelmed, the following error message has no chance to be printed. Then the clue of error will be lost. This patch prints the error message earlier, then there is chance to cache them before the system reset or panic. Signed-off-by: Coly Li <colyli@suse.de>
-rw-r--r--drivers/md/bcache/bset.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/md/bcache/bset.c b/drivers/md/bcache/bset.c
index c9e58805100c8..9821e75f2a17d 100644
--- a/drivers/md/bcache/bset.c
+++ b/drivers/md/bcache/bset.c
@@ -99,12 +99,14 @@ void __bch_check_keys(struct btree_keys *b_keys, const char *fmt, ...)
#endif
return;
bug:
- bch_dump_bucket(b_keys);
-
va_start(args, fmt);
vprintk(fmt, args);
va_end(args);
+ /* An early message before dump buckets info */
+ pr_err("\nbch_check_keys error: %s:\n", err);
+ bch_dump_bucket(b_keys);
+
panic("bch_check_keys error: %s:\n", err);
}