Commit 5d361ae5 authored by Alan Huang's avatar Alan Huang Committed by Kent Overstreet
Browse files

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: default avatarAlan Huang <mmpgouride@gmail.com>
Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
parent 4a4000b9
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -350,8 +350,10 @@ static inline int journal_res_get_fast(struct journal *j,

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