Skip to content

Commit 1fa4e69

Browse files
mjguzikbrauner
authored andcommitted
filelock: use a consume fence in locks_inode_context()
Matches the idiom of storing a pointer with a release fence and safely getting the content with a consume fence after. Eliminates an actual fence on some archs. Reviewed-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Mateusz Guzik <mjguzik@gmail.com> Link: https://patch.msgid.link/20251203094837.290654-1-mjguzik@gmail.com Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent 5854fc6 commit 1fa4e69

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

include/linux/filelock.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,10 @@ bool locks_owner_has_blockers(struct file_lock_context *flctx,
241241
static inline struct file_lock_context *
242242
locks_inode_context(const struct inode *inode)
243243
{
244-
return smp_load_acquire(&inode->i_flctx);
244+
/*
245+
* Paired with the fence in locks_get_lock_context().
246+
*/
247+
return READ_ONCE(inode->i_flctx);
245248
}
246249

247250
#else /* !CONFIG_FILE_LOCKING */

0 commit comments

Comments
 (0)