• Dave Chinner's avatar
    xfs: fix potential log item leak · c230a4a8
    Dave Chinner authored
    Ever since we added shadown format buffers to the log items, log
    items need to handle the item being released with shadow buffers
    attached. Due to the fact this requirement was added at the same
    time we added new rmap/reflink intents, we missed the cleanup of
    those items.
    
    In theory, this means shadow buffers can be leaked in a very small
    window when a shutdown is initiated. Testing with KASAN shows this
    leak does not happen in practice - we haven't identified a single
    leak in several years of shutdown testing since ~v4.8 kernels.
    
    However, the intent whiteout cleanup mechanism results in every
    cancelled intent in exactly the same state as this tiny race window
    creates and so if intents down clean up shadow buffers on final
    release we will leak the shadow buffer for just about every intent
    we create.
    
    Hence we start with this patch to close this condition off and
    ensure that when whiteouts start to be used we don't leak lots of
    memory.
    Signed-off-by: default avatarDave Chinner <dchinner@redhat.com>
    Reviewed-by: default avatarDarrick J. Wong <djwong@kernel.org>
    Reviewed-by: default avatarAllison Henderson <allison.henderson@oracle.com>
    Signed-off-by: default avatarDave Chinner <david@fromorbit.com>
    c230a4a8
xfs_icreate_item.c 7.59 KB