• Qu Wenruo's avatar
    btrfs: raid56: avoid double freeing for rbio if full_stripe_write() failed · ab4c54c6
    Qu Wenruo authored
    Currently if full_stripe_write() failed to allocate the pages for
    parity, it will call __free_raid_bio() first, then return -ENOMEM.
    
    But some caller of full_stripe_write() will also call __free_raid_bio()
    again, this would cause double freeing.
    
    And it's not a logically sound either, normally we should either free
    the memory at the same level where we allocated it, or let endio to
    handle everything.
    
    So this patch will solve the double freeing by make
    raid56_parity_write() to handle the error and free the rbio.
    
    Just like what we do in raid56_parity_recover().
    Signed-off-by: default avatarQu Wenruo <wqu@suse.com>
    Signed-off-by: default avatarDavid Sterba <dsterba@suse.com>
    ab4c54c6
raid56.c 72.1 KB