diff options
author | Tejun Heo <tj@kernel.org> | 2011-05-23 07:24:54 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-05-23 11:50:48 -0400 |
commit | ff2a9941ca27ab18169d17b3803aca68b154951c (patch) | |
tree | 18cc498e623ce1f97ad25a2618dd2a82166511c9 /fs | |
parent | f4b10bc60a310916bab5413f821b99ef845cac17 (diff) |
block: move bd_set_size() above rescan_partitions() in __blkdev_get()
02e352287a4 (block: rescan partitions on invalidated devices on
-ENOMEDIA too) relocated partition rescan above explicit bd_set_size()
to simplify condition check. As rescan_partitions() does its own bdev
size setting, this doesn't break anything; however,
rescan_partitions() prints out the following messages when adjusting
bdev size, which can be confusing.
sda: detected capacity change from 0 to 146815737856
sdb: detected capacity change from 0 to 146815737856
This patch restores the original order and remove the warning
messages.
stable: Please apply together with 02e352287a4 (block: rescan
partitions on invalidated devices on -ENOMEDIA too).
Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Tony Luck <tony.luck@gmail.com>
Tested-by: Tony Luck <tony.luck@gmail.com>
Cc: stable@kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/block_dev.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c index 257b00e98428..bf9c7a720371 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c | |||
@@ -1120,6 +1120,15 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) | |||
1120 | goto restart; | 1120 | goto restart; |
1121 | } | 1121 | } |
1122 | } | 1122 | } |
1123 | |||
1124 | if (!ret && !bdev->bd_openers) { | ||
1125 | bd_set_size(bdev,(loff_t)get_capacity(disk)<<9); | ||
1126 | bdi = blk_get_backing_dev_info(bdev); | ||
1127 | if (bdi == NULL) | ||
1128 | bdi = &default_backing_dev_info; | ||
1129 | bdev_inode_switch_bdi(bdev->bd_inode, bdi); | ||
1130 | } | ||
1131 | |||
1123 | /* | 1132 | /* |
1124 | * If the device is invalidated, rescan partition | 1133 | * If the device is invalidated, rescan partition |
1125 | * if open succeeded or failed with -ENOMEDIUM. | 1134 | * if open succeeded or failed with -ENOMEDIUM. |
@@ -1130,14 +1139,6 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) | |||
1130 | rescan_partitions(disk, bdev); | 1139 | rescan_partitions(disk, bdev); |
1131 | if (ret) | 1140 | if (ret) |
1132 | goto out_clear; | 1141 | goto out_clear; |
1133 | |||
1134 | if (!bdev->bd_openers) { | ||
1135 | bd_set_size(bdev,(loff_t)get_capacity(disk)<<9); | ||
1136 | bdi = blk_get_backing_dev_info(bdev); | ||
1137 | if (bdi == NULL) | ||
1138 | bdi = &default_backing_dev_info; | ||
1139 | bdev_inode_switch_bdi(bdev->bd_inode, bdi); | ||
1140 | } | ||
1141 | } else { | 1142 | } else { |
1142 | struct block_device *whole; | 1143 | struct block_device *whole; |
1143 | whole = bdget_disk(disk, 0); | 1144 | whole = bdget_disk(disk, 0); |