[PATCH] md: Fix device-size updates in md

As 'array_size' is a 'sector_t', it may overflow inappropriately when shifted
10 bits. So We should cast it to a loff_t first.

There are two places with this problem, but the second (in update_raid_disks)
isn't needed so just remove it:
The only personality that handles ->reshape currently is raid1,
and it doesn't change the size of the array.
When added for raid5/6, reshape again won't change the size of the array,
at least not straight away.
This code might be need for reshaping 'linear' but linear->shape,
if implemented, should probably do the i_size_write itself.

Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by NeilBrown and committed by Linus Torvalds 6d89332b cf41f8ac

+1 -12
+1 -12
drivers/md/md.c
··· 3465 3465 bdev = bdget_disk(mddev->gendisk, 0); 3466 3466 if (bdev) { 3467 3467 mutex_lock(&bdev->bd_inode->i_mutex); 3468 - i_size_write(bdev->bd_inode, mddev->array_size << 10); 3468 + i_size_write(bdev->bd_inode, (loff_t)mddev->array_size << 10); 3469 3469 mutex_unlock(&bdev->bd_inode->i_mutex); 3470 3470 bdput(bdev); 3471 3471 } ··· 3485 3485 if (mddev->sync_thread) 3486 3486 return -EBUSY; 3487 3487 rv = mddev->pers->reshape(mddev, raid_disks); 3488 - if (!rv) { 3489 - struct block_device *bdev; 3490 - 3491 - bdev = bdget_disk(mddev->gendisk, 0); 3492 - if (bdev) { 3493 - mutex_lock(&bdev->bd_inode->i_mutex); 3494 - i_size_write(bdev->bd_inode, mddev->array_size << 10); 3495 - mutex_unlock(&bdev->bd_inode->i_mutex); 3496 - bdput(bdev); 3497 - } 3498 - } 3499 3488 return rv; 3500 3489 } 3501 3490