aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/md/dm.c19
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
828static void __set_size(struct gendisk *disk, sector_t size) 828static 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
842static int __bind(struct mapped_device *md, struct dm_table *t) 837static 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