dm mpath: fix lock order inconsistency in multipath_ioctl
authorMike Snitzer <snitzer@redhat.com>
Tue, 13 May 2014 17:49:39 +0000 (13:49 -0400)
committerMike Snitzer <snitzer@redhat.com>
Wed, 14 May 2014 20:12:17 +0000 (16:12 -0400)
Commit 3e9f1be1b40 ("dm mpath: remove process_queued_ios()") did not
consistently take the multipath device's spinlock (m->lock) before
calling dm_table_run_md_queue_async() -- which takes the q->queue_lock.

Found with code inspection using hint from reported lockdep warning.

Reported-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
drivers/md/dm-mpath.c

index aa009e86587189a20a4ccf4734ad9d999cb5701f..fa0f6cbd6a41283d21b1286558eb4764e2c06b4b 100644 (file)
@@ -1566,8 +1566,8 @@ static int multipath_ioctl(struct dm_target *ti, unsigned int cmd,
                }
                if (m->pg_init_required)
                        __pg_init_all_paths(m);
-               spin_unlock_irqrestore(&m->lock, flags);
                dm_table_run_md_queue_async(m->ti->table);
+               spin_unlock_irqrestore(&m->lock, flags);
        }
 
        return r ? : __blkdev_driver_ioctl(bdev, mode, cmd, arg);