Re: [PATCH v4 4/4] ntfs: protect mapping-pairs attr-list updates with attr_list_persist_lock

Namjae Jeon <[email protected]> Fri, 31 Jul 2026 20:52:32 +0900
Newsgroups dev.linux.lists.ntfs
Message-ID <CAKYAXd9u5hpANu2WKf590L-wQzmu_fU1L_pHELKBdxOZ1PU8yw@mail.gmail.com>
There is still a race between this initial NInoAttrList() check and
attribute-list creation.

Thread A: ntfs_attr_update_mapping_pairs()     Thread B:
ntfs_inode_add_attrlist()
 -------------------------------------------
----------------------------------

  1. Checks NInoAttrList(base_ni)
     -> false

  2. Does not take attr_list_persist_lock
     attrlist_locked = false

                                                  3. Takes
attr_list_persist_lock
                                                     Creates and
publishes attr_list
                                                     Sets NI_AttrList
                                                     Starts persisting
the new list

  4. Calls ntfs_attr_lookup()
     -> now sees NI_AttrList == true
     -> uses the external attribute-list path
     -> ctx->al_cursor.valid = true

  5. Updates an ALE under attr_list_lock
     attrlist_changed = true

                                                  6. May still be
writing the same
                                                     in-memory attr_list buffer

  7. Calls ntfs_attrlist_update_locked()
     but attr_list_persist_lock was never acquired

This allows Thread A to modify or persist attr_list concurrently with
Thread B's persist transaction.