• Liu Bo's avatar
    Btrfs: fix deadlock during allocating chunks · 15d1ff81
    Liu Bo authored
    This deadlock comes from xfstests 251.
    
    We'll hold the chunk_mutex throughout the whole of a chunk allocation.
    But if we find that we've used up system chunk space, we need to allocate a
    new system chunk, but this will lead to a recursion of chunk allocation and end
    up with a deadlock on chunk_mutex.
    So instead we need to allocate the system chunk first if we find we're in ENOSPC.
    Signed-off-by: default avatarLiu Bo <liubo2009@cn.fujitsu.com>
    Signed-off-by: default avatarChris Mason <chris.mason@oracle.com>
    15d1ff81
extent-tree.c 213 KB