Re: [PATCH] ntfs: serialize read iomap lookup with mrec_lock

From: Cen Zhang

Date: Sat Jun 27 2026 - 00:27:06 EST


Hi Hyunchul,

Hyunchul Lee <hyc.lee@xxxxxxxxx> 于2026年6月26日周五 15:30写道:
>
> It looks like there is a race condition here.
> The concurrent writer may create attr_list immediately after this check.
> In that case, the reader can call ntfs_external_attr_find() from
> ntfs_attr_lookup() and access the newly created attr_list without the lock.
>
> There also appears to be a few places such as ntfs_attr_map_whole_runlist()
> to call ntfs_attr_lookup() without the lock.
>
> Considering performance, how about introducing the rw_semaphore to
> protect attr_list?

Thanks for your review, that make sense.

I will rework this to try to use a per-inode attr_list rwsem instead.

Thanks,
Cen Zhang