Re: [RFC PATCH 19/24] erofs: introduce namei alternative to C

Gao Xiang
2024-09-17T08:07:07Z

On 2024/9/17 15:31, Al Viro wrote:
> On Tue, Sep 17, 2024 at 03:14:58PM +0800, Gao Xiang wrote:
>
>>> Sorry for my ignorance.
>>> I mean i just borrowed the code from the fs/erofs/namei.c and i directly
>>> translated that into Rust code. That might be a problem that also
>>> exists in original working C code.
>>
>> As for EROFS (an immutable fs), I think after d_splice_alias(), d_name is
>> still stable (since we don't have rename semantics likewise for now).
>
> Even on corrupted images? If you have two directories with entries that
> act as hardlinks to the same subdirectory, and keep hitting them on lookups,
> it will have to transplant the subtree between the parents.

Oh, I missed unexpected directory hardlink corrupted cases.

>
>> But as the generic filesystem POV, d_name access is actually tricky under
>> RCU walk path indeed.
>
> ->lookup() is never called in RCU mode.

I know, I just said d_name access is tricky in RCU walk.

->lookup() is for real lookup, not search dcache as fast cached lookup
in the RCU context.

Thanks,
Gao Xiang