]> asedeno.scripts.mit.edu Git - linux.git/commit
dm: safely allocate multiple bioset bios
authorMike Snitzer <snitzer@redhat.com>
Wed, 22 Nov 2017 19:56:12 +0000 (14:56 -0500)
committerMike Snitzer <snitzer@redhat.com>
Wed, 13 Dec 2017 17:15:58 +0000 (12:15 -0500)
commit318716ddea0829d3be566efc69d31029c40d51e2
tree20933ee1320f34e07218541df77f3f406b044e5d
parentf31c21e4365c02ccf7226c33ea978cd5dbfc351e
dm: safely allocate multiple bioset bios

DM targets can request multiple bios be sent to them by DM core (see:
num_{flush,discard,write_same,write_zeroes}_bios).  But until now these
bios were allocated in an unsafe manner than could potentially exhaust
the DM device's bioset -- in the face of multiple threads each trying to
do multiple allocations from the same DM device's bioset.

Fix __send_duplicate_bios() by using the new alloc_multiple_bios().  The
allocation strategy used by alloc_multiple_bios() models that used by
dm-crypt.c:crypt_alloc_buffer().

Neil Brown initially proposed this fix but the implementation has been
revised enough that it inappropriate to attribute the entirety of it to
him.

Suggested-by: NeilBrown <neilb@suse.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
drivers/md/dm.c