• Josef Bacik's avatar
    Btrfs: fix possible corruption when fsyncing written prealloced extents · 224ecce5
    Josef Bacik authored
    While working on my fsync patch my fsync tester kept hitting mismatching
    md5sums when I would randomly write to a prealloc'ed region, syncfs() and
    then write to the prealloced region some more and then fsync() and then
    immediately reboot.  This is because the tree logging code will skip writing
    csums for file extents who's generation is less than the current running
    transaction.  When we mark extents as written we haven't been updating their
    generation so they were always being skipped.  This wouldn't happen if you
    were to preallocate and then write in the same transaction, but if you for
    example prealloced a VM you could definitely run into this problem.  This
    patch makes my fsync tester happy again.  Thanks,
    Signed-off-by: default avatarJosef Bacik <jbacik@fusionio.com>
    224ecce5
file.c 49.1 KB