linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] device-mapper: [2/4] Fix deadlocks in core
@ 2005-07-11 22:20 Alasdair G Kergon
  0 siblings, 0 replies; only message in thread
From: Alasdair G Kergon @ 2005-07-11 22:20 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel

Avoid another bdget_disk which can deadlock.

Signed-Off-By: Alasdair G Kergon <agk@redhat.com>

--- diff/drivers/md/dm.c	2005-07-11 22:52:10.000000000 +0100
+++ source/drivers/md/dm.c	2005-07-11 22:57:58.000000000 +0100
@@ -825,18 +825,13 @@
 	wake_up(&md->eventq);
 }
 
-static void __set_size(struct gendisk *disk, sector_t size)
+static void __set_size(struct mapped_device *md, sector_t size)
 {
-	struct block_device *bdev;
+	set_capacity(md->disk, size);
 
-	set_capacity(disk, size);
-	bdev = bdget_disk(disk, 0);
-	if (bdev) {
-		down(&bdev->bd_inode->i_sem);
-		i_size_write(bdev->bd_inode, (loff_t)size << SECTOR_SHIFT);
-		up(&bdev->bd_inode->i_sem);
-		bdput(bdev);
-	}
+	down(&md->frozen_bdev->bd_inode->i_sem);
+	i_size_write(md->frozen_bdev->bd_inode, (loff_t)size << SECTOR_SHIFT);
+	up(&md->frozen_bdev->bd_inode->i_sem);
 }
 
 static int __bind(struct mapped_device *md, struct dm_table *t)
@@ -845,7 +840,7 @@
 	sector_t size;
 
 	size = dm_table_get_size(t);
-	__set_size(md->disk, size);
+	__set_size(md, size);
 	if (size == 0)
 		return 0;
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-07-11 22:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-11 22:20 [PATCH] device-mapper: [2/4] Fix deadlocks in core Alasdair G Kergon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).