btrfs: add missing device::flush_bio puts
authorDavid Sterba <dsterba@suse.com>
Mon, 30 Oct 2017 17:36:08 +0000 (18:36 +0100)
committerDavid Sterba <dsterba@suse.com>
Wed, 15 Nov 2017 13:45:26 +0000 (14:45 +0100)
commit3065ae5b85654e9141b134bc7b07eb0f2ca7cfcf
tree80fea504120e32bee7d599cdb4e65a29f41da829
parent5e9f2ad5b2904a7e81df6d9a3dbef29478952eac
btrfs: add missing device::flush_bio puts

This fixes potential bio leaks, in several error paths. Unfortunatelly
the device structure freeing is opencoded in many places and I missed
them when introducing the flush_bio.

Most of the time, devices get freed through call_rcu(..., free_device),
so it at least it's not that easy to hit the leak, but it's still
possible through the path that frees stale devices.

Fixes: e0ae99941423 ("btrfs: preallocate device flush bio")
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/volumes.c