Skip to content

Commit 2adfa46

Browse files
author
Kent Overstreet
committed
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 <kent.overstreet@linux.dev>
1 parent 739200c commit 2adfa46

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

fs/bcachefs/btree_io.c

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2117,8 +2117,14 @@ static void btree_node_write_work(struct work_struct *work)
21172117
return;
21182118
err:
21192119
set_btree_node_noevict(b);
2120-
bch2_fs_fatal_err_on(!bch2_err_matches(ret, EROFS), c,
2121-
"writing btree node: %s", bch2_err_str(ret));
2120+
2121+
if (!bch2_err_matches(ret, EROFS)) {
2122+
struct printbuf buf = PRINTBUF;
2123+
prt_printf(&buf, "writing btree node: %s\n ", bch2_err_str(ret));
2124+
bch2_btree_pos_to_text(&buf, c, b);
2125+
bch2_fs_fatal_error(c, "%s", buf.buf);
2126+
printbuf_exit(&buf);
2127+
}
21222128
goto out;
21232129
}
21242130

@@ -2135,10 +2141,14 @@ static void btree_node_write_endio(struct bio *bio)
21352141
bch2_account_io_completion(ca, BCH_MEMBER_ERROR_write,
21362142
wbio->submit_time, !bio->bi_status);
21372143

2138-
if (ca && bio->bi_status)
2139-
bch_err_dev_ratelimited(ca,
2140-
"btree write error: %s",
2141-
bch2_blk_status_to_str(bio->bi_status));
2144+
if (ca && bio->bi_status) {
2145+
struct printbuf buf = PRINTBUF;
2146+
prt_printf(&buf, "btree write error: %s\n ",
2147+
bch2_blk_status_to_str(bio->bi_status));
2148+
bch2_btree_pos_to_text(&buf, c, b);
2149+
bch_err_dev_ratelimited(ca, "%s", buf.buf);
2150+
printbuf_exit(&buf);
2151+
}
21422152

21432153
if (bio->bi_status) {
21442154
unsigned long flags;

0 commit comments

Comments
 (0)