]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
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)
committerMike Snitzer <snitzer@redhat.com>
Thu, 10 Jul 2014 20:44:15 +0000 (16:44 -0400)
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>
Cc: stable@vger.kernel.org # v3.15
drivers/md/dm-mpath.c

index 3f6fd9d33ba3dc4a77500fb285d19bdd54f0c836..f4167b013d990c3fc25f185ee467952824f0ae5d 100644 (file)
@@ -1611,8 +1611,9 @@ static int multipath_busy(struct dm_target *ti)
 
        spin_lock_irqsave(&m->lock, flags);
 
-       /* pg_init in progress, requeue until done */
-       if (!pg_ready(m)) {
+       /* pg_init in progress or no paths available */
+       if (m->pg_init_in_progress ||
+           (!m->nr_valid_paths && m->queue_if_no_path)) {
                busy = 1;
                goto out;
        }