Re: lockdep: bdev->bd_mutex deadlock

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <[email protected]>
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 <[email protected]>
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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux