tcmu: don't block submitting context for block waits
authorMike Christie <mchristi@redhat.com>
Tue, 28 Nov 2017 18:40:39 +0000 (12:40 -0600)
committerNicholas Bellinger <nab@linux-iscsi.org>
Fri, 12 Jan 2018 23:07:19 +0000 (15:07 -0800)
commitaf1dd7ff46824a94da1d90443bd07db2796bd545
tree8738bc72ba01cad344c8917ba86472d0a3c2b09a
parentf890f5799a6628fe006ae524e625900186074cdb
tcmu: don't block submitting context for block waits

This patch has tcmu internally queue cmds if its ring buffer
is full. It also makes the TCMU_GLOBAL_MAX_BLOCKS limit a
hint instead of a hard limit, so we do not have to add any
new locks/atomics in the main IO path except when IO is not
running.

This fixes the following bugs:

1. We cannot sleep from the submitting context because it might be
called from a target recv context. This results in transport level
commands timing out. For example if the ring is full, we would
sleep, and a iscsi initiator would send a iscsi ping/nop which
times out because the target's recv thread is sleeping here.

2. Devices were not fairly scheduled to run when they hit the global
limit so they could time out waiting for ring space while others
got run.

Signed-off-by: Mike Christie <mchristi@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
drivers/target/target_core_user.c