mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arjan van de Ven <arjan@infradead.org>
To: Peter Jones <pjones@redhat.com>
Cc: mingo@elte.hu, linux-kernel <linux-kernel@vger.kernel.org>,
	Dave Jones <davej@redhat.com>
Subject: Re: lockdep: bdev->bd_mutex deadlock
Date: Tue, 11 Jul 2006 13:14:46 +0200	[thread overview]
Message-ID: <1152616486.3128.34.camel@laptopd505.fenrus.org> (raw)
In-Reply-To: <1152287003.14409.2.camel@localhost.localdomain>

On Fri, 2006-07-07 at 11:43 -0400, Peter Jones wrote:
> <4> [<c05ebd9d>] mutex_lock+0x21/0x24
> <4> [<c04c4acf>] blkdev_ioctl+0x5dd/0x732
> <4> [<c046323b>] block_ioctl+0x16/0x1b


From: Arjan van de Ven <arjan@linux.intel.com>
Subject: lockdep: annotate the BLKPG_DEL_PARTITION ioctl

The delete partition IOCTL takes the bd_mutex for both the disk and the partition;
these have an obvious hierarchical relationship and this patch annotates this
relationship for lockdep.

Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Index: linux-2.6.18-rc1/block/ioctl.c
===================================================================
--- linux-2.6.18-rc1.orig/block/ioctl.c
+++ linux-2.6.18-rc1/block/ioctl.c
@@ -72,7 +72,7 @@ static int blkpg_ioctl(struct block_devi
 			bdevp = bdget_disk(disk, part);
 			if (!bdevp)
 				return -ENOMEM;
-			mutex_lock(&bdevp->bd_mutex);
+			mutex_lock_nested(&bdevp->bd_mutex, BD_MUTEX_PARTITION);
 			if (bdevp->bd_openers) {
 				mutex_unlock(&bdevp->bd_mutex);
 				bdput(bdevp);
@@ -82,7 +82,7 @@ static int blkpg_ioctl(struct block_devi
 			fsync_bdev(bdevp);
 			invalidate_bdev(bdevp, 0);
 
-			mutex_lock(&bdev->bd_mutex);
+			mutex_lock_nested(&bdev->bd_mutex, BD_MUTEX_WHOLE);
 			delete_partition(disk, part);
 			mutex_unlock(&bdev->bd_mutex);
 			mutex_unlock(&bdevp->bd_mutex);



      reply	other threads:[~2006-07-11 11:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-06 21:31 Peter Jones
2006-07-06 22:07 ` Dave Jones
2006-07-07  7:34 ` Arjan van de Ven
2006-07-07 15:43   ` Peter Jones
2006-07-11 11:14     ` Arjan van de Ven [this message]

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=1152616486.3128.34.camel@laptopd505.fenrus.org \
    --to=arjan@infradead.org \
    --cc=davej@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=pjones@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®