diff options
author | Alasdair G Kergon <agk@redhat.com> | 2005-07-29 00:15:59 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-07-29 00:46:03 -0400 |
commit | 4e90188be4a56f37fbb4ffb5b58745683526dcb9 (patch) | |
tree | dde381c2419cce6e529729fd361bf0b9b90392ac /drivers/md | |
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/md')
-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 f0cd8ea327d3..88f1f27526cc 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c | |||
@@ -825,18 +825,13 @@ static void event_callback(void *context) | |||
825 | wake_up(&md->eventq); | 825 | wake_up(&md->eventq); |
826 | } | 826 | } |
827 | 827 | ||
828 | static void __set_size(struct gendisk *disk, sector_t size) | 828 | static void __set_size(struct mapped_device *md, sector_t size) |
829 | { | 829 | { |
830 | struct block_device *bdev; | 830 | set_capacity(md->disk, size); |
831 | 831 | ||
832 | set_capacity(disk, size); | 832 | down(&md->frozen_bdev->bd_inode->i_sem); |
833 | bdev = bdget_disk(disk, 0); | 833 | i_size_write(md->frozen_bdev->bd_inode, (loff_t)size << SECTOR_SHIFT); |
834 | if (bdev) { | 834 | up(&md->frozen_bdev->bd_inode->i_sem); |
835 | down(&bdev->bd_inode->i_sem); | ||
836 | i_size_write(bdev->bd_inode, (loff_t)size << SECTOR_SHIFT); | ||
837 | up(&bdev->bd_inode->i_sem); | ||
838 | bdput(bdev); | ||
839 | } | ||
840 | } | 835 | } |
841 | 836 | ||
842 | static int __bind(struct mapped_device *md, struct dm_table *t) | 837 | 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) | |||
845 | sector_t size; | 840 | sector_t size; |
846 | 841 | ||
847 | size = dm_table_get_size(t); | 842 | size = dm_table_get_size(t); |
848 | __set_size(md->disk, size); | 843 | __set_size(md, size); |
849 | if (size == 0) | 844 | if (size == 0) |
850 | return 0; | 845 | return 0; |
851 | 846 | ||