dm mpath: fix ioctl deadlock when no paths
authorHannes Reinecke <hare@suse.de>
Wed, 10 Jul 2013 22:41:15 +0000 (23:41 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 4 Aug 2013 08:51:02 +0000 (16:51 +0800)
commit565ff95cdc72f76d53d4e98d5e84254368b9a041
tree2d58ab785c6709bf870866b1b49fa288d8968b77
parentf03519471a796be1c6d2aa9871928139828550c5
dm mpath: fix ioctl deadlock when no paths

commit 6c182cd88d179cbbd06f4f8a8a19b6977940753f upstream.

When multipath needs to retry an ioctl the reference to the
current live table needs to be dropped. Otherwise a deadlock
occurs when all paths are down:
- dm_blk_ioctl takes a reference to the current table
  and spins in multipath_ioctl().
- A new table is being loaded, but upon resume the process
  hangs in dm_table_destroy() waiting for references to
  drop to zero.

With this patch the reference to the old table is dropped
prior to retry, thereby avoiding the deadlock.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Cc: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/md/dm-mpath.c
drivers/md/dm.c