Btrfs: fix broken nocow after balance
authorMiao Xie <miaox@cn.fujitsu.com>
Thu, 6 Jun 2013 03:28:03 +0000 (03:28 +0000)
committerJosef Bacik <jbacik@fusionio.com>
Mon, 1 Jul 2013 12:52:25 +0000 (08:52 -0400)
commit5bc7247ac47cf100309e4d7e24214889c46a1636
tree2e28c383acea82994e54c330ba7345b436b69656
parent8c2a1a3028d560cfb95f1c583e872c65ed2f0b3d
Btrfs: fix broken nocow after balance

Balance will create reloc_root for each fs root, and it's going to
record last_snapshot to filter shared blocks.  The side effect of
setting last_snapshot is to break nocow attributes of files.

Since the extents are not shared by the relocation tree after the balance,
we can recover the old last_snapshot safely if no one snapshoted the
source tree. We fix the above problem by this way.

Reported-by: Kyle Gates <kylegates@hotmail.com>
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
fs/btrfs/relocation.c