Skip to content

Commit ef0beeb

Browse files
author
Kent Overstreet
committed
bcachefs: move journal seq assertion
journal_cur_seq() can legitimately be used outside of the journal lock, where this assert can race Signed-off-by: Kent Overstreet <[email protected]>
1 parent 1b1bd0f commit ef0beeb

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

fs/bcachefs/journal.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,8 @@ static int journal_entry_open(struct journal *j)
321321
atomic64_inc(&j->seq);
322322
journal_pin_list_init(fifo_push_ref(&j->pin), 1);
323323

324+
BUG_ON(j->pin.back - 1 != atomic64_read(&j->seq));
325+
324326
BUG_ON(j->buf + (journal_cur_seq(j) & JOURNAL_BUF_MASK) != buf);
325327

326328
bkey_extent_init(&buf->key);

fs/bcachefs/journal.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,7 @@ static inline u64 journal_last_seq(struct journal *j)
136136

137137
static inline u64 journal_cur_seq(struct journal *j)
138138
{
139-
EBUG_ON(j->pin.back - 1 != atomic64_read(&j->seq));
140-
141-
return j->pin.back - 1;
139+
return atomic64_read(&j->seq);
142140
}
143141

144142
static inline u64 journal_last_unwritten_seq(struct journal *j)

0 commit comments

Comments
 (0)