summaryrefslogtreecommitdiff
path: root/include/linux/filelock.h
diff options
context:
space:
mode:
authorMateusz Guzik <mjguzik@gmail.com>2025-12-03 10:48:36 +0100
committerChristian Brauner <brauner@kernel.org>2025-12-15 14:33:38 +0100
commit1fa4e69a54a250fa17d2afd9c5b54a59329033c1 (patch)
treeaca72244bcb7200d1666fef9878494ad4c343108 /include/linux/filelock.h
parent5854fc6391e9d67c9ebfb4cb618406b5a372db6b (diff)
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>
Diffstat (limited to 'include/linux/filelock.h')
-rw-r--r--include/linux/filelock.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/include/linux/filelock.h b/include/linux/filelock.h
index 54b824c05299..dc15f5427680 100644
--- a/include/linux/filelock.h
+++ b/include/linux/filelock.h
@@ -241,7 +241,10 @@ bool locks_owner_has_blockers(struct file_lock_context *flctx,
static inline struct file_lock_context *
locks_inode_context(const struct inode *inode)
{
- return smp_load_acquire(&inode->i_flctx);
+ /*
+ * Paired with the fence in locks_get_lock_context().
+ */
+ return READ_ONCE(inode->i_flctx);
}
#else /* !CONFIG_FILE_LOCKING */