• Filipe Manana's avatar
    btrfs: abort transaction on generation mismatch when marking eb as dirty · 50564b65
    Filipe Manana authored
    When marking an extent buffer as dirty, at btrfs_mark_buffer_dirty(),
    we check if its generation matches the running transaction and if not we
    just print a warning. Such mismatch is an indicator that something really
    went wrong and only printing a warning message (and stack trace) is not
    enough to prevent a corruption. Allowing a transaction to commit with such
    an extent buffer will trigger an error if we ever try to read it from disk
    due to a generation mismatch with its parent generation.
    
    So abort the current transaction with -EUCLEAN if we notice a generation
    mismatch. For this we need to pass a transaction handle to
    btrfs_mark_buffer_dirty() which is always available except in test code,
    in which case we can pass NULL since it operates on dummy extent buffers
    and all test roots have a single node/leaf (root node at level 0).
    Signed-off-by: default avatarFilipe Manana <fdmanana@suse.com>
    Reviewed-by: default avatarDavid Sterba <dsterba@suse.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    50564b65
dir-item.c 12.3 KB