• Zhaolei's avatar
    btrfs: Fix data checksum error cause by replace with io-load. · 55e3a601
    Zhaolei authored
    xfstests btrfs/070 sometimes failed.
    In my test machine, its fail rate is about 30%.
    In another vm(vmware), its fail rate is about 50%.
    
    Reason:
      btrfs/070 do replace and defrag with fsstress simultaneously,
      after above operation, checksum error is found by scrub.
    
      Actually, it have no relationship with defrag operation, only
      replace with fsstress can trigger this bug.
    
      New data writen to target device have possibility rewrited by
      old data from source device by replace code in debug, to avoid
      above problem, we can set target block group to readonly in
      replace period, so new data requested by other operation will
      not write to same place with replace code.
    
      Before patch(4.1-rc3):
        30% failed in 100 xfstests.
      After patch:
        0% failed in 300 xfstests.
    
    It also happened in btrfs/071 as it's another scrub with IO load tests.
    Reported-by: default avatarQu Wenruo <quwenruo@cn.fujitsu.com>
    Signed-off-by: default avatarQu Wenruo <quwenruo@cn.fujitsu.com>
    Signed-off-by: default avatarZhao Lei <zhaolei@cn.fujitsu.com>
    Signed-off-by: default avatarChris Mason <clm@fb.com>
    55e3a601
volumes.c 178 KB