diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index 9189f9e3c3598fb5ce517fc09cde7ac8a36a0862..07b3b36f40ee51657b248112a6d1f028cea9e364 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c @@ -4009,6 +4009,12 @@ static noinline_for_stack int relocate_block_group(struct reloc_control *rc) if (!RB_EMPTY_ROOT(&blocks)) { ret = relocate_tree_blocks(trans, rc, &blocks); if (ret < 0) { + /* + * if we fail to relocate tree blocks, force to update + * backref cache when committing transaction. + */ + rc->backref_cache.last_trans = trans->transid - 1; + if (ret != -EAGAIN) { err = ret; break;