• Hugh Dickins's avatar
    [PATCH] Fix vma corruption · e4cf8264
    Hugh Dickins authored
    It occurred to me that if vma and new_vma are one and the same, then
    vma_relink_file will not do a good job of linking it after itself - in
    that pretty unlikely case when move_page_tables fails.
    
    And more generally, whenever copy_vma's vma_merge succeeds, we have no
    guarantee that old vma comes before new_vma in the i_mmap lists, as we
    need to satisfy Rajesh's point: that ordering is only guaranteed in the
    newly allocated case.
    
    We have to abandon the ordering method when/if we move from lists to
    prio_trees, so this patch switches to the less glamorous use of
    i_shared_sem exclusion, as in my prio_tree mremap.
    e4cf8264
mremap.c 10.1 KB