diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2019-03-15 22:23:19 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2019-04-09 19:18:04 -0400 |
commit | 5467a68cbf6884c9a9d91e2a89140afb1839c835 (patch) | |
tree | 06501c271a2d4140c50b3643a64e30086170f134 /fs/autofs | |
parent | 9419a3191dcb27f24478d288abaab697228d28e6 (diff) | |
download | linux-5467a68cbf6884c9a9d91e2a89140afb1839c835.tar.bz2 |
dcache: sort the freeing-without-RCU-delay mess for good.
For lockless accesses to dentries we don't have pinned we rely
(among other things) upon having an RCU delay between dropping
the last reference and actually freeing the memory.
On the other hand, for things like pipes and sockets we neither
do that kind of lockless access, nor want to deal with the
overhead of an RCU delay every time a socket gets closed.
So delay was made optional - setting DCACHE_RCUACCESS in ->d_flags
made sure it would happen. We tried to avoid setting it unless
we knew we need it. Unfortunately, that had led to recurring
class of bugs, in which we missed the need to set it.
We only really need it for dentries that are created by
d_alloc_pseudo(), so let's not bother with trying to be smart -
just make having an RCU delay the default. The ones that do
*not* get it set the replacement flag (DCACHE_NORCU) and we'd
better use that sparingly. d_alloc_pseudo() is the only
such user right now.
FWIW, the race that finally prompted that switch had been
between __lock_parent() of immediate subdirectory of what's
currently the root of a disconnected tree (e.g. from
open-by-handle in progress) racing with d_splice_alias()
elsewhere picking another alias for the same inode, either
on outright corrupted fs image, or (in case of open-by-handle
on NFS) that subdirectory having been just moved on server.
It's not easy to hit, so the sky is not falling, but that's
not the first race on similar missed cases and the logics
for settinf DCACHE_RCUACCESS has gotten ridiculously
convoluted.
Cc: stable@vger.kernel.org
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/autofs')
0 files changed, 0 insertions, 0 deletions