From: Al Viro <viro@zeniv.linux.org.uk>
To: Christian Brauner <brauner@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] fix bitmap corruption on close_range() with CLOSE_RANGE_UNSHARE
Date: Tue, 6 Aug 2024 17:32:08 +0100 [thread overview]
Message-ID: <20240806163208.GQ5334@ZenIV> (raw)
In-Reply-To: <20240806-beugen-unsinn-9433e4a8e276@brauner>
On Tue, Aug 06, 2024 at 10:41:59AM +0200, Christian Brauner wrote:
> > Would rcu_assign_pointer of pointers + smp_store_release of max_fds on expand
> > (all under ->files_lock, etc.) paired with
> > smp_load_acquire of max_fds + rcu_dereference of ->fd on file lookup side
> > be enough, or do we need an explicit smp_wmb/smp_rmb in there?
>
> Afair, smp_load_acquire() would be a barrier for both later loads and
> stores and smp_store_release() would be a barrier for both earlier loads
> and stores.
>
> Iiuc, here we only care about ordering stores to ->fd and max_fds on the
> write side and about ordering loads of max_fds and ->fd on the reader
> side. The reader doesn't actually write anything.
>
> In other words, we want to make ->fd visible before max_fds on the write
> side and we want to load max_fds after ->fd.
>
> So I think smp_wmb() and smp_rmb() would be sufficient. I also find it
> clearer in this case.
It's not the question of sufficiency; it's whether anything cheaper can be
had.
next prev parent reply other threads:[~2024-08-06 16:32 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-03 22:50 [PATCH] fix bitmap corruption on close_range() with CLOSE_RANGE_UNSHARE Al Viro
2024-08-03 23:06 ` Al Viro
2024-08-03 23:51 ` Linus Torvalds
2024-08-04 0:05 ` Linus Torvalds
2024-08-04 0:34 ` Al Viro
2024-08-04 3:42 ` Linus Torvalds
2024-08-04 3:47 ` Al Viro
2024-08-04 4:17 ` Al Viro
2024-08-04 15:18 ` Linus Torvalds
2024-08-04 21:13 ` Al Viro
2024-08-05 23:44 ` Al Viro
2024-08-06 0:04 ` Linus Torvalds
2024-08-06 1:02 ` Al Viro
2024-08-06 8:41 ` Christian Brauner
2024-08-06 16:32 ` Al Viro [this message]
2024-08-06 17:01 ` Linus Torvalds
2024-08-05 7:22 ` Christian Brauner
2024-08-05 18:54 ` Al Viro
2024-08-06 9:11 ` Christian Brauner
2024-08-05 9:48 ` 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=20240806163208.GQ5334@ZenIV \
--to=viro@zeniv.linux.org.uk \
--cc=brauner@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.