Linux filesystem development
 help / color / mirror / Atom feed
* [PATCH v3 1/2] filelock: use a consume fence in locks_inode_context()
@ 2025-11-13 17:58 Mateusz Guzik
  2025-11-13 17:58 ` [PATCH v3 2/2] fs: track the inode having file locks with a flag in ->i_opflags Mateusz Guzik
  0 siblings, 1 reply; 2+ messages in thread
From: Mateusz Guzik @ 2025-11-13 17:58 UTC (permalink / raw)
  To: brauner, jlayton; +Cc: viro, jack, linux-kernel, linux-fsdevel, Mateusz Guzik

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>
---
 include/linux/filelock.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

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 */
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-11-13 17:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-13 17:58 [PATCH v3 1/2] filelock: use a consume fence in locks_inode_context() Mateusz Guzik
2025-11-13 17:58 ` [PATCH v3 2/2] fs: track the inode having file locks with a flag in ->i_opflags Mateusz Guzik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox