All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: Bart Van Assche <bvanassche@acm.org>
Cc: dm-devel@redhat.com
Subject: Re: 3.15-rc4: circular locking dependency triggered by dm-multipath
Date: Mon, 26 May 2014 14:51:33 +0200	[thread overview]
Message-ID: <538338D5.4080804@suse.de> (raw)
In-Reply-To: <53833730.50509@suse.de>

[-- Attachment #1: Type: text/plain, Size: 1991 bytes --]

On 05/26/2014 02:44 PM, Hannes Reinecke wrote:
> On 05/26/2014 02:29 PM, Hannes Reinecke wrote:
>> On 05/26/2014 02:20 PM, Bart Van Assche wrote:
>>> On 05/26/14 14:10, Hannes Reinecke wrote:
>>>> Mike Snitzer had a patch in his device-mapper tree:
>>>>
>>>> dm mpath: fix lock order inconsistency in multipath_ioctl
>>>> (2014-05-14
>>>> 16:12:17 -0400)
>>>>
>>>> I was sort of hoping that would address this issue.
>>>> Can you check?
>>>
>>> Hello Hannes,
>>>
>>> Is it possible that that patch already got included in v3.15-rc6 and
>>> hence that that patch was included in my test ?
>>>
>>> $ git log v3.15-rc5..v3.15-rc6 | grep 'dm mpath: fix lock order
>>> inconsistency in multipath_ioctl'
>>>        dm mpath: fix lock order inconsistency in multipath_ioctl
>>>      dm mpath: fix lock order inconsistency in multipath_ioctl
>>>
>> Could be.
>>
>> Okay, I'll be cross-checking.
>>
> Can you check if this makes lockdep happy?
>
> diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c
> index aa009e8..40b3036 100644
> --- a/drivers/md/dm-mpath.c
> +++ b/drivers/md/dm-mpath.c
> @@ -445,11 +445,11 @@ static int queue_if_no_path(struct multipath
> *m, unsigned
> queue_if_no_path,
>          else
>                  m->saved_queue_if_no_path = queue_if_no_path;
>          m->queue_if_no_path = queue_if_no_path;
> -       if (!m->queue_if_no_path)
> -               dm_table_run_md_queue_async(m->ti->table);
> -
>          spin_unlock_irqrestore(&m->lock, flags);
>
> +       if (!queue_if_no_path)
> +               dm_table_run_md_queue_async(m->ti->table);
> +
>          return 0;
>   }
>
Or, better still, try the attached patch.
There's one more instance where lockdep might complain.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		      zSeries & Storage
hare@suse.de			      +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)

[-- Attachment #2: 0001-dm-multipath-Fixup-lockdep-warning.patch --]
[-- Type: text/x-patch, Size: 1833 bytes --]

From 44bd0601e47f5cc5d26b679550f0a5a2f2c3f487 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Mon, 26 May 2014 14:45:39 +0200
Subject: [PATCH] dm-multipath: Fixup lockdep warning

lockdep complains about a circular locking.
And indeed, we need to release the lock before calling
dm_table_run_md_queue_asycn().

Reported-by: Bart van Assche <bvanassche@acm.org>
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 drivers/md/dm-mpath.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c
index aa009e8..ebfa411 100644
--- a/drivers/md/dm-mpath.c
+++ b/drivers/md/dm-mpath.c
@@ -445,11 +445,11 @@ static int queue_if_no_path(struct multipath *m, unsigned queue_if_no_path,
 	else
 		m->saved_queue_if_no_path = queue_if_no_path;
 	m->queue_if_no_path = queue_if_no_path;
-	if (!m->queue_if_no_path)
-		dm_table_run_md_queue_async(m->ti->table);
-
 	spin_unlock_irqrestore(&m->lock, flags);
 
+	if (!queue_if_no_path)
+		dm_table_run_md_queue_async(m->ti->table);
+
 	return 0;
 }
 
@@ -954,7 +954,7 @@ out:
  */
 static int reinstate_path(struct pgpath *pgpath)
 {
-	int r = 0;
+	int r = 0, run_queue = 0;
 	unsigned long flags;
 	struct multipath *m = pgpath->pg->m;
 
@@ -978,7 +978,7 @@ static int reinstate_path(struct pgpath *pgpath)
 
 	if (!m->nr_valid_paths++) {
 		m->current_pgpath = NULL;
-		dm_table_run_md_queue_async(m->ti->table);
+		run_queue = 1;
 	} else if (m->hw_handler_name && (m->current_pg == pgpath->pg)) {
 		if (queue_work(kmpath_handlerd, &pgpath->activate_path.work))
 			m->pg_init_in_progress++;
@@ -991,6 +991,8 @@ static int reinstate_path(struct pgpath *pgpath)
 
 out:
 	spin_unlock_irqrestore(&m->lock, flags);
+	if (run_queue)
+		dm_table_run_md_queue_async(m->ti->table);
 
 	return r;
 }
-- 
1.7.12.4


[-- Attachment #3: Type: text/plain, Size: 0 bytes --]



  reply	other threads:[~2014-05-26 12:51 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-06  9:31 3.15-rc4: circular locking dependency triggered by dm-multipath Bart Van Assche
2014-05-06 13:22 ` Mike Snitzer
2014-05-06 13:46   ` Bart Van Assche
2014-05-07 20:53 ` Mike Snitzer
2014-05-08  5:57 ` Hannes Reinecke
2014-05-26 11:44   ` Bart Van Assche
2014-05-26 12:10     ` Hannes Reinecke
2014-05-26 12:20       ` Bart Van Assche
2014-05-26 12:29         ` Hannes Reinecke
2014-05-26 12:44           ` Hannes Reinecke
2014-05-26 12:51             ` Hannes Reinecke [this message]
2014-05-26 14:54               ` Bart Van Assche
2014-05-27 13:22                 ` Mike Snitzer
2014-05-27 14:49                   ` Mike Snitzer
2014-05-27 16:09                     ` Bart Van Assche

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=538338D5.4080804@suse.de \
    --to=hare@suse.de \
    --cc=bvanassche@acm.org \
    --cc=dm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.