]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
dm mpath: fix IO hang due to logic bug in multipath_busy
authorJun'ichi Nomura <j-nomura@ce.jp.nec.com>
Tue, 8 Jul 2014 00:55:14 +0000 (00:55 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 17 Jul 2014 23:23:14 +0000 (16:23 -0700)
commit2a0dd0a658c48fdbef2a85e58efa601acc6ca150
treea250e349f802ad038fec5343750ddcc69e7156f3
parenta59683e362bcd79a92ebcff1c9d5fd63780b013e
dm mpath: fix IO hang due to logic bug in multipath_busy

commit 7a7a3b45fed9a144dbf766ee842a4c5d0632b81d upstream.

Commit e80991773 ("dm mpath: push back requests instead of queueing")
modified multipath_busy() to return true if !pg_ready().  pg_ready()
checks the current state of the multipath device and may return false
even if a new IO is needed to change the state.

Bart Van Assche reported that he had multipath IO lockup when he was
performing cable pull tests.  Analysis showed that the multipath
device had a single path group with both paths active, but that the
path group itself was not active.  During the multipath device state
transitions 'queue_io' got set but nothing could clear it.  Clearing
'queue_io' only happens in __choose_pgpath(), but it won't be called
if multipath_busy() returns true due to pg_ready() returning false
when 'queue_io' is set.

As such the !pg_ready() check in multipath_busy() is wrong because new
IO will not be sent to multipath target and the multipath state change
won't happen.  That results in multipath IO lockup.

The intent of multipath_busy() is to avoid unnecessary cycles of
dequeue + request_fn + requeue if it is known that the multipath
device will requeue.

Such "busy" situations would be:
  - path group is being activated
  - there is no path and the multipath is setup to requeue if no path

Fix multipath_busy() to return "busy" early only for these specific
situations.

Reported-by: Bart Van Assche <bvanassche@acm.org>
Tested-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/md/dm-mpath.c