Re: [PATCH v2] fs: make sure to fail try_to_unlazy() and try_to_unlazy() for LOOKUP_CACHED
From: Al Viro
Date: Wed Dec 17 2025 - 06:12:44 EST
On Wed, Dec 17, 2025 at 11:13:22AM +0100, Mateusz Guzik wrote:
> I'm not arguing for drop_links() to change behavior, but for it to be
> renamed to something which indicates there is still potential
> symlink-related clean up to do.
>
> As an outsider, a routine named drop_${whatever} normally suggests the
> ${whatever} is fully taken care of after the call, which is not the
> case here.
*shrug*
drop_link_bodies()? Seriously, though - the real source of headache
had been a decision (mine, IIRC) to stash LOOKUP_CACHED logics into
legitimize_links() rather than having it done in both of its callers
(try_to_unlazy() and try_to_unlazy_next()).
It could be lifted into both callers instead, but we'd need to
* remember that it should come *before* any references get
grabbed (and there would be a constant itch to move it down -
it would even work, and past legitimize_links() we wouldn't need
drop_links(), but it would make the thing potentially do seriously
blocking IO, contrary to LOOKUP_CACHED intent)
* remember to keep drop_links()/resetting ->depth if done
before legitimize_links().
* keep these two in sync.
If you have a cleaner solution for that, I'm all ears. Really.
I'm not happy with details of that area (lazy to nonlazy transitions),
but so far I hadn't been able to make it more obviously correct.
And I'd looked at your original patches and missed that fun ;-/