diff options
author | Alasdair G Kergon <agk@redhat.com> | 2005-07-28 21:15:59 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-07-28 21:46:03 -0700 |
commit | 4e90188be4a56f37fbb4ffb5b58745683526dcb9 (patch) | |
tree | dde381c2419cce6e529729fd361bf0b9b90392ac /drivers | |
parent | cf222b3769c3759488579441ab724ed33a2da5f4 (diff) |
[PATCH] device-mapper: fix deadlocks in core
Avoid another bdget_disk which can deadlock.
Signed-Off-By: Alasdair G Kergon <agk@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/md/dm.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index f0cd8ea327d..88f1f27526c 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c @@ -825,18 +825,13 @@ static void event_callback(void *context) 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(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); - } + set_capacity(md->disk, size); + + 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 @@ static int __bind(struct mapped_device *md, struct dm_table *t) sector_t size; size = dm_table_get_size(t); - __set_size(md->disk, size); + __set_size(md, size); if (size == 0) return 0; |