Skip to content
  • Wang Shilong's avatar
    Btrfs: fix an oops when doing balance relocation · c974c464
    Wang Shilong authored
    
    
    I hit an oops when inserting reloc root into @reloc_root_tree(it can be
    easily triggered when forcing cow for relocation root)
    
    [  866.494539]  [<ffffffffa0499579>] btrfs_init_reloc_root+0x79/0xb0 [btrfs]
    [  866.495321]  [<ffffffffa044c240>] record_root_in_trans+0xb0/0x110 [btrfs]
    [  866.496109]  [<ffffffffa044d758>] btrfs_record_root_in_trans+0x48/0x80 [btrfs]
    [  866.496908]  [<ffffffffa0494da8>] select_reloc_root+0xa8/0x210 [btrfs]
    [  866.497703]  [<ffffffffa0495c8a>] do_relocation+0x16a/0x540 [btrfs]
    
    This is because reloc root inserted into @reloc_root_tree is not within one
    transaction,reloc root may be cowed and root block bytenr will be reused then
    oops happens.We should update reloc root in @reloc_root_tree when cow reloc
    root node, fix it.
    
    Signed-off-by: default avatarWang Shilong <wangsl.fnst@cn.fujitsu.com>
    Reviewed-by: default avatarMiao Xie <miaox@cn.fujitsu.com>
    Signed-off-by: default avatarChris Mason <clm@fb.com>
    c974c464