• Josef Bacik's avatar
    btrfs: clear space cache inode generation always · 8e138e0d
    Josef Bacik authored
    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: default avatarJosef Bacik <jbacik@fb.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    8e138e0d
extent-tree.c 300 KB