• Dave Chinner's avatar
    xfs: Ensure we force all busy extents in range to disk · fd45e478
    Dave Chinner authored
    When we search for and find a busy extent during allocation we
    force the log out to ensure the extent free transaction is on
    disk before the allocation transaction. The current implementation
    has a subtle bug in it--it does not handle multiple overlapping
    ranges.
    
    That is, if we free lots of little extents into a single
    contiguous extent, then allocate the contiguous extent, the busy
    search code stops searching at the first extent it finds that
    overlaps the allocated range. It then uses the commit LSN of the
    transaction to force the log out to.
    
    Unfortunately, the other busy ranges might have more recent
    commit LSNs than the first busy extent that is found, and this
    results in xfs_alloc_search_busy() returning before all the
    extent free transactions are on disk for the range being
    allocated. This can lead to potential metadata corruption or
    stale data exposure after a crash because log replay won't replay
    all the extent free transactions that cover the allocation range.
    Modified-by: default avatarAlex Elder <aelder@sgi.com>
    
    (Dropped the "found" argument from the xfs_alloc_busysearch trace
    event.)
    Signed-off-by: default avatarDave Chinner <david@fromorbit.com>
    Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
    Signed-off-by: default avatarAlex Elder <aelder@sgi.com>
    fd45e478
xfs_alloc.c 72 KB