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:

https://github.com/koverstreet/bcachefs/issues/854
https://www.reddit.com/r/bcachefs/comments/1k28kjm/surprise_soft_lockup/

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Kent Overstreet
2025-04-18 13:38:23 -04:00
parent 6468aef231
commit 4c327d03d7
+18 -1
View File
@@ -281,7 +281,24 @@ static void __journal_entry_close(struct journal *j, unsigned closed_val, bool t
sectors = vstruct_blocks_plus(buf->data, c->block_bits,
buf->u64s_reserved) << c->block_bits;
BUG_ON(sectors > buf->sectors);
if (unlikely(sectors > buf->sectors)) {
struct printbuf err = PRINTBUF;
err.atomic++;
prt_printf(&err, "journal entry overran reserved space: %u > %u\n",
sectors, buf->sectors);
prt_printf(&err, "buf u64s %u u64s reserved %u cur_entry_u64s %u block_bits %u\n",
le32_to_cpu(buf->data->u64s), buf->u64s_reserved,
j->cur_entry_u64s,
c->block_bits);
prt_printf(&err, "fatal error - emergency read only");
bch2_journal_halt_locked(j);
bch_err(c, "%s", err.buf);
printbuf_exit(&err);
return;
}
buf->sectors = sectors;
/*