• C
    Btrfs: fix barrier flushes · 387125fc
    Chris Mason 提交于
    When btrfs is writing the super blocks, it send barrier flushes to make
    sure writeback caching drives get all the metadata on disk in the
    right order.
    
    But, we have two bugs in the way these are sent down.  When doing
    full commits (not via the tree log), we are sending the barrier down
    before the last super when it should be going down before the first.
    
    In multi-device setups, we should be waiting for the barriers to
    complete on all devices before writing any of the supers.
    
    Both of these bugs can cause corruptions on power failures.  We fix it
    with some new code to send down empty barriers to all devices before
    writing the first super.
    
    Alexandre Oliva found the multi-device bug.  Arne Jansen did the async
    barrier loop.
    Signed-off-by: NChris Mason <chris.mason@oracle.com>
    Reported-by: NAlexandre Oliva <oliva@lsd.ic.unicamp.br>
    387125fc
disk-io.c 95.9 KB