From: Jeff Layton <jlayton@kernel.org>
To: Mateusz Guzik <mjguzik@gmail.com>, brauner@kernel.org
Cc: viro@zeniv.linux.org.uk, jack@suse.cz,
linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH v2 1/2] filelock: use a consume fence in locks_inode_context()
Date: Wed, 12 Nov 2025 06:49:21 -0500 [thread overview]
Message-ID: <1d73231c675b6d77ca42d8f7a0a866c82c3be821.camel@kernel.org> (raw)
In-Reply-To: <20251112104432.1785404-1-mjguzik@gmail.com>
On Wed, 2025-11-12 at 11:44 +0100, Mateusz Guzik wrote:
> 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.
>
> 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 c2ce8ba05d06..37e1b33bd267 100644
> --- a/include/linux/filelock.h
> +++ b/include/linux/filelock.h
> @@ -232,7 +232,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 */
Seems reasonable
Reviewed-by: Jeff Layton <jlayton@kernel.org>
next prev parent reply other threads:[~2025-11-12 11:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-12 10:44 [PATCH v2 1/2] filelock: use a consume fence in locks_inode_context() Mateusz Guzik
2025-11-12 10:44 ` [PATCH v2 2/2] fs: track the inode having file locks with a flag in ->i_opflags Mateusz Guzik
2025-11-12 12:31 ` Jeff Layton
2025-11-12 11:49 ` Jeff Layton [this message]
2025-11-13 13:21 ` [PATCH v2 1/2] filelock: use a consume fence in locks_inode_context() Christian Brauner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1d73231c675b6d77ca42d8f7a0a866c82c3be821.camel@kernel.org \
--to=jlayton@kernel.org \
--cc=brauner@kernel.org \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mjguzik@gmail.com \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox