From: Alan Huang Date: Tue, 18 Mar 2025 07:50:00 +0000 (+0800) Subject: bcachefs: Add missing smp_rmb() X-Git-Tag: v6.15-rc1~146^2~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5d361ae5afeef075264b369c413dbed0a0d04cfa;p=thirdparty%2Flinux.git 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 Signed-off-by: Kent Overstreet --- diff --git a/fs/bcachefs/journal.h b/fs/bcachefs/journal.h index ab68c5c4d8d8c..47828771f9c23 100644 --- a/fs/bcachefs/journal.h +++ b/fs/bcachefs/journal.h @@ -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;