Skip to content

Commit 4c327d0

Browse files
author
Kent Overstreet
committed
bcachefs: Change __journal_entry_close() assert to ERO
We've got some reports of this happening in the wild, and need a bit more info to debug it: koverstreet/bcachefs#854 https://www.reddit.com/r/bcachefs/comments/1k28kjm/surprise_soft_lockup/ Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
1 parent 6468aef commit 4c327d0

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

fs/bcachefs/journal.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,24 @@ static void __journal_entry_close(struct journal *j, unsigned closed_val, bool t
281281

282282
sectors = vstruct_blocks_plus(buf->data, c->block_bits,
283283
buf->u64s_reserved) << c->block_bits;
284-
BUG_ON(sectors > buf->sectors);
284+
if (unlikely(sectors > buf->sectors)) {
285+
struct printbuf err = PRINTBUF;
286+
err.atomic++;
287+
288+
prt_printf(&err, "journal entry overran reserved space: %u > %u\n",
289+
sectors, buf->sectors);
290+
prt_printf(&err, "buf u64s %u u64s reserved %u cur_entry_u64s %u block_bits %u\n",
291+
le32_to_cpu(buf->data->u64s), buf->u64s_reserved,
292+
j->cur_entry_u64s,
293+
c->block_bits);
294+
prt_printf(&err, "fatal error - emergency read only");
295+
bch2_journal_halt_locked(j);
296+
297+
bch_err(c, "%s", err.buf);
298+
printbuf_exit(&err);
299+
return;
300+
}
301+
285302
buf->sectors = sectors;
286303

287304
/*

0 commit comments

Comments
 (0)