]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: clear space cache inode generation always
authorJosef Bacik <jbacik@fb.com>
Fri, 17 Nov 2017 19:50:46 +0000 (14:50 -0500)
committerDavid Sterba <dsterba@suse.com>
Mon, 20 Nov 2017 19:43:39 +0000 (20:43 +0100)
commitf027f3f9546964a6ce6788ca2a68904efc72739f
tree996f716135f903d962d3d5ce419c70d64115d8b7
parenta60692447b8a308035336e1da584b3919ce14ca3
btrfs: clear space cache inode generation always

We discovered a box that had double allocations, and suspected the space
cache may be to blame.  While auditing the write out path I noticed that
if we've already setup the space cache we will just carry on.  This
means that any error we hit after cache_save_setup before we go to
actually write the cache out we won't reset the inode generation, so
whatever was already written will be considered correct, except it'll be
stale.  Fix this by _always_ resetting the generation on the block group
inode, this way we only ever have valid or invalid cache.

With this patch I was no longer able to reproduce cache corruption with
dm-log-writes and my bpf error injection tool.

Cc: stable@vger.kernel.org
Signed-off-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent-tree.c