flow: fix hang with flow control and zoned block devices
authorAravind Ramesh <Aravind.Ramesh@wdc.com>
Mon, 7 Dec 2020 10:30:45 +0000 (10:30 +0000)
committerJens Axboe <axboe@kernel.dk>
Mon, 7 Dec 2020 23:56:37 +0000 (16:56 -0700)
commit731365d849407426fe32981c97a2f9b42cdc0149
treea33fd108f3d93c8f7bd9bb0a2880ec9940abb7f8
parent950ad00360bed6797a502232483b735d4bf0c4ed
flow: fix hang with flow control and zoned block devices

When flow control is specified between 2 or more threads executing a workload
with zonemode=zbd and flow_sleep is not specified by the user (default to zero),
then a job A can lock a zone Z with the flow ratio exceeded, resulting in the
job to not issue the IO until other jobs IOs balance the flow ratio.
Since job A will wait with the Zone Z locked, other jobs will deadlock waiting
for this zone lock if their workload resulted in this zone Z being chosen
as an IO target.

Executing io_u_quiesce() when the flow ratio is exceeded solves this potential
deadlock as job A will wait for the flow ratio to balance without holding the
zone A lock. To preserve the behavior for regular block devices and to avoid
extra overhead, io_u_quiesce() only needs to be executed when the workload
specifies zonedmode=zbd.

Signed-off-by: Aravind Ramesh <aravind.ramesh@wdc.com>
Signed-off-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
flow.c