• Mike Snitzer's avatar
    dm: safely allocate multiple bioset bios · 318716dd
    Mike Snitzer authored
    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: default avatarNeilBrown <neilb@suse.com>
    Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
    318716dd
dm.c 68.9 KB