From: Kent Overstreet Date: Sat, 22 Mar 2025 20:26:32 +0000 (-0400) Subject: bcachefs: btree node write errors now print btree node X-Git-Tag: io_uring-6.15-20250403~68^2~1 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=2adfa467347f6e5d8091ecbc45a78cac3d2a2b91;p=linux-block.git bcachefs: btree node write errors now print btree node It turned out a user was wondering why we were going read-only after a write error, and he didn't realize he didn't have replication enabled - this will make that more obvious, and we should be printing it anyways. Link: https://www.reddit.com/r/bcachefs/comments/1jf9akl/large_data_transfers_switched_bcachefs_to_readonly/ Signed-off-by: Kent Overstreet --- diff --git a/fs/bcachefs/btree_io.c b/fs/bcachefs/btree_io.c index 6abc9f17ea3c..2ba33ffc9795 100644 --- a/fs/bcachefs/btree_io.c +++ b/fs/bcachefs/btree_io.c @@ -2117,8 +2117,14 @@ out: return; err: set_btree_node_noevict(b); - bch2_fs_fatal_err_on(!bch2_err_matches(ret, EROFS), c, - "writing btree node: %s", bch2_err_str(ret)); + + if (!bch2_err_matches(ret, EROFS)) { + struct printbuf buf = PRINTBUF; + prt_printf(&buf, "writing btree node: %s\n ", bch2_err_str(ret)); + bch2_btree_pos_to_text(&buf, c, b); + bch2_fs_fatal_error(c, "%s", buf.buf); + printbuf_exit(&buf); + } goto out; } @@ -2135,10 +2141,14 @@ static void btree_node_write_endio(struct bio *bio) bch2_account_io_completion(ca, BCH_MEMBER_ERROR_write, wbio->submit_time, !bio->bi_status); - if (ca && bio->bi_status) - bch_err_dev_ratelimited(ca, - "btree write error: %s", - bch2_blk_status_to_str(bio->bi_status)); + if (ca && bio->bi_status) { + struct printbuf buf = PRINTBUF; + prt_printf(&buf, "btree write error: %s\n ", + bch2_blk_status_to_str(bio->bi_status)); + bch2_btree_pos_to_text(&buf, c, b); + bch_err_dev_ratelimited(ca, "%s", buf.buf); + printbuf_exit(&buf); + } if (bio->bi_status) { unsigned long flags;