• Dave Chinner's avatar
    xfs: take i_mmap_lock on extent manipulation operations · 1c2ed395
    Dave Chinner authored
    commit e8e9ad42 upstream.
    
    Now we have the i_mmap_lock being held across the page fault IO
    path, we now add extent manipulation operation exclusion by adding
    the lock to the paths that directly modify extent maps. This
    includes truncate, hole punching and other fallocate based
    operations. The operations will now take both the i_iolock and the
    i_mmaplock in exclusive mode, thereby ensuring that all IO and page
    faults block without holding any page locks while the extent
    manipulation is in progress.
    
    This gives us the lock order during truncate of i_iolock ->
    i_mmaplock -> page_lock -> i_lock, hence providing the same
    lock order as the iolock provides the normal IO path without
    involving the mmap_sem.
    Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
    Reviewed-by: default avatarBrian Foster <bfoster@redhat.com>
    Signed-off-by: default avatarDave Chinner <david@fromorbit.com>
    [bwh: Backported to 3.16:
     - We never need to break layouts, so take both i_iolock and i_mmaplock at the
       same time
     - Adjust context]
    Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
    Cc: Jan Kara <jack@suse.cz>
    Cc: xfs@oss.sgi.com
    1c2ed395
xfs_iops.c 32.7 KB