• Mikulas Patocka's avatar
    dm: add memory barrier before waitqueue_active · 645efa84
    Mikulas Patocka authored
    Block core changes to switch bio-based IO accounting to be percpu had a
    side-effect of altering DM core to now rely on calling waitqueue_active
    (in both bio-based and request-based) to check if another task is in
    dm_wait_for_completion().
    
    A memory barrier is needed before calling waitqueue_active().  DM core
    doesn't piggyback on a preceding memory barrier so it must explicitly
    use its own.
    
    For more details on why using waitqueue_active() without a preceding
    barrier is unsafe, please see the comment before the waitqueue_active()
    definition in include/linux/wait.h.
    
    Add the missing memory barrier by switching to using wq_has_sleeper().
    
    Fixes: 6f757231 ("dm: remove the pending IO accounting")
    Fixes: c4576aed ("dm: fix request-based dm's use of dm_wait_for_completion")
    Signed-off-by: default avatarMikulas Patocka <mpatocka@redhat.com>
    Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
    645efa84
dm-rq.c 14.8 KB