• Zachary Hays's avatar
    mmc: block: handle complete_work on separate workqueue · 1fdf7b8b
    Zachary Hays authored
    commit dcf6e2e3 upstream.
    
    The kblockd workqueue is created with the WQ_MEM_RECLAIM flag set.
    This generates a rescuer thread for that queue that will trigger when
    the CPU is under heavy load and collect the uncompleted work.
    
    In the case of mmc, this creates the possibility of a deadlock when
    there are multiple partitions on the device as other blk-mq work is
    also run on the same queue. For example:
    
    - worker 0 claims the mmc host to work on partition 1
    - worker 1 attempts to claim the host for partition 2 but has to wait
      for worker 0 to finish
    - worker 0 schedules complete_work to release the host
    - rescuer thread is triggered after time-out and collects the dangling
      work
    - rescuer thread attempts to complete the work in order starting with
      claim host
    - the task to release host is now blocked by a task to claim it and
      will never be called
    
    The above results in multiple hung tasks that lead to failures to
    mount partitions.
    
    Handling complete_work on a separate workqueue avoids this by keeping
    the work completion tasks separate from the other blk-mq work. This
    allows the host to be released without getting blocked by other tasks
    attempting to claim the host.
    Signed-off-by: 's avatarZachary Hays <zhays@lexmark.com>
    Fixes: 81196976 ("mmc: block: Add blk-mq support")
    Cc: <stable@vger.kernel.org>
    Signed-off-by: 's avatarUlf Hansson <ulf.hansson@linaro.org>
    Signed-off-by: 's avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    1fdf7b8b
Name
Last commit
Last update
..
acpi Loading commit data...
asm-generic Loading commit data...
clocksource Loading commit data...
crypto Loading commit data...
drm Loading commit data...
dt-bindings Loading commit data...
keys Loading commit data...
kvm Loading commit data...
linux Loading commit data...
math-emu Loading commit data...
media Loading commit data...
memory Loading commit data...
misc Loading commit data...
net Loading commit data...
pcmcia Loading commit data...
ras Loading commit data...
rdma Loading commit data...
scsi Loading commit data...
soc Loading commit data...
sound Loading commit data...
target Loading commit data...
trace Loading commit data...
uapi Loading commit data...
video Loading commit data...
xen Loading commit data...