lkml.org 
[lkml]   [2006]   [Jul]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: lockdep: bdev->bd_mutex deadlock
From
Date
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);

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-07-11 13:17    [W:0.179 / U:0.136 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site