Skip to content

Commit 5d361ae

Browse files
alanskindKent Overstreet
authored andcommitted
bcachefs: Add missing smp_rmb()
The smp_rmb() guarantees that reads from reservations.counter occur before accessing cur_entry_u64s. It's paired with the atomic64_try_cmpxchg in journal_entry_open. Signed-off-by: Alan Huang <mmpgouride@gmail.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
1 parent 4a4000b commit 5d361ae

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

fs/bcachefs/journal.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,8 +350,10 @@ static inline int journal_res_get_fast(struct journal *j,
350350

351351
/*
352352
* Check if there is still room in the current journal
353-
* entry:
353+
* entry, smp_rmb() guarantees that reads from reservations.counter
354+
* occur before accessing cur_entry_u64s:
354355
*/
356+
smp_rmb();
355357
if (new.cur_entry_offset + res->u64s > j->cur_entry_u64s)
356358
return 0;
357359

0 commit comments

Comments
 (0)