]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
fs: make sure to fail try_to_unlazy() and try_to_unlazy() for LOOKUP_CACHED
authorMateusz Guzik <mjguzik@gmail.com>
Sat, 20 Dec 2025 05:40:22 +0000 (06:40 +0100)
committerChristian Brauner <brauner@kernel.org>
Wed, 24 Dec 2025 12:31:56 +0000 (13:31 +0100)
commit46af9ae1305f1025fd9ff7d8945de98a6ec0a52b
tree159888aa32388ee2eeebfa288092faafab222f3a
parent570ad253a3455a520f03c2136af8714bc780186d
fs: make sure to fail try_to_unlazy() and try_to_unlazy() for LOOKUP_CACHED

Otherwise the slowpath can be taken by the caller, defeating the flag.

This regressed after calls to legitimize_links() started being
conditionally elided and stems from the routine always failing
after seeing the flag, regardless if there were any links.

In order to address both the bug and the weird semantics make it illegal
to call legitimize_links() with LOOKUP_CACHED and handle the problem at
the two callsites.

Fixes: 7c179096e77eca21 ("fs: add predicts based on nd->depth")
Reported-by: Chris Mason <clm@meta.com>
Signed-off-by: Mateusz Guzik <mjguzik@gmail.com>
Link: https://patch.msgid.link/20251220054023.142134-1-mjguzik@gmail.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/namei.c