Skip to content

Commit 6468aef

Browse files
author
Kent Overstreet
committed
bcachefs: Ensure journal space is block size aligned
We don't require that bucket size is block size aligned (although it should be!) - so we need to handle this in the journal code. This fixes an assertion pop in jorunal_entry_close(), where the journal entry overruns available space - after rounding it up to block size. Fixes: koverstreet/bcachefs#854 Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
1 parent 71f8e80 commit 6468aef

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

fs/bcachefs/journal_reclaim.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,10 @@ void bch2_journal_space_available(struct journal *j)
252252

253253
bch2_journal_set_watermark(j);
254254
out:
255-
j->cur_entry_sectors = !ret ? j->space[journal_space_discarded].next_entry : 0;
255+
j->cur_entry_sectors = !ret
256+
? round_down(j->space[journal_space_discarded].next_entry,
257+
block_sectors(c))
258+
: 0;
256259
j->cur_entry_error = ret;
257260

258261
if (!ret)

0 commit comments

Comments
 (0)