diff options
| author | Christian Brauner <brauner@kernel.org> | 2026-10-12 12:22:17 +0200 |
|---|---|---|
| committer | Christian Brauner <brauner@kernel.org> | 2026-10-12 12:25:28 +0200 |
| commit | 0b5c87bbf2742347b4e593defbfeee2cde0a316d (patch) | |
| tree | d429fb52d6af0cd1f9e6e33f0ef64f06830c4d57 /tools/lib/python | |
| parent | 23194f382636f51511a3ceb4b579ad586643c8ac (diff) | |
| parent | 0773e3ceb2a822c142dfcb9ff83c2cde9ee8e225 (diff) | |
| download | linux-next-0b5c87bbf2742347b4e593defbfeee2cde0a316d.tar.gz linux-next-0b5c87bbf2742347b4e593defbfeee2cde0a316d.zip | |
Merge patch series "fs: drop the smp_mb()s that mnt_get_count() made redundant"
Christian Brauner <brauner@kernel.org> says:
mntput_no_expire_slowpath() and do_umount() both have an smp_mb()
between taking mount_lock and summing up the reference count. They pair
with the smp_mb() in __legitimize_mnt(). The walker increments the count
and then re-reads the seqcount. The unmounter writes the seqcount when
it takes mount_lock and then sums up the count. They must not both miss
each other's store. That's store buffering and it needs a full barrier
on both sides.
Since 7eb84d54fac5 ("fs: don't let a migrating task hide its reference
from do_umount()"), which is in mainline now, mnt_get_count() has an
smp_mb() between summing up the puts and the gets. In program order it
sits after the seqcount write and before the loads of the gets. That's
the barrier the walker needs. The outer ones don't order anything on
top of it that anyone relies on. So drop them.
I ran into this while getting rid of the grace period in
namespace_unlock(). It doesn't depend on that work so I'm sending it on
its own.
A reproducer can't exercise this. The pairing is store buffering with a
full barrier on both sides, which is exactly
tools/memory-model/litmus-tests/SB+fencembonceonces.litmus: the
walker's increment is the store to x and its re-read of the seqcount
the load of y, the seqcount write in lock_mount_hash() is the store to
y and the loads of the gets in mnt_get_count() the load of x. I had two
litmus tests cut from fs/namespace.c in the series for this. Andrea
pointed out that once the seqlock and the lock are peeled off that's
all that's left of them, so I dropped them. They and their runs under
the AArch64, POWER, RISC-V, MIPS and ARM models and with klitmus7 on
x86 are in
https://github.com/brauner/linux-formal
kernel/mount/gp-on-demand-proposal/litmus/
* patches from https://patch.msgid.link/20261011-work-mount-fixes-5-v1-0-a9b9a8ecf565@kernel.org:
fs: drop the smp_mb()s that mnt_get_count() made redundant
Link: https://patch.msgid.link/20261011-work-mount-fixes-5-v1-0-a9b9a8ecf565@kernel.org
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
Diffstat (limited to 'tools/lib/python')
0 files changed, 0 insertions, 0 deletions
