https://github.com/torvalds/linux
Revision beed9263f4000c48a5c48912f26576f6fa091181 authored by Nikolay Borisov on 13 December 2017, 11:50:07 UTC, committed by David Sterba on 02 January 2018, 17:00:13 UTC
Commit e0ae99941423 ("btrfs: preallocate device flush bio") reworked
the way the flush bio is allocated and used. Concretely it allocates
the bio in __alloc_device and then re-uses it multiple times with a
very simple endio routine that just calls complete() without consuming
a reference. Allocated bios by default come with a ref count of 1,
which is then consumed by the endio routine (or not, in which case they
should be bio_put by the caller). The way the impleementation works now
is that the flush bio has a refcount of 2 and we only ever bio_put it
once, leaving it to hang indefinitely. Fix this by removing the extra
bio_get in __alloc_device.

Fixes: e0ae99941423 ("btrfs: preallocate device flush bio")
Signed-off-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: Liu Bo <bo.li.liu@oracle.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
1 parent c8bcbfb
History
Tip revision: beed9263f4000c48a5c48912f26576f6fa091181 authored by Nikolay Borisov on 13 December 2017, 11:50:07 UTC
btrfs: Fix flush bio leak
Tip revision: beed926
File Mode Size
apparmor
integrity
keys
loadpin
selinux
smack
tomoyo
yama
Kconfig -rw-r--r-- 8.9 KB
Makefile -rw-r--r-- 989 bytes
commoncap.c -rw-r--r-- 36.8 KB
device_cgroup.c -rw-r--r-- 21.0 KB
inode.c -rw-r--r-- 10.5 KB
lsm_audit.c -rw-r--r-- 10.7 KB
min_addr.c -rw-r--r-- 1.3 KB
security.c -rw-r--r-- 42.7 KB

back to top