Re: New boot time message: detected capacity change
From: Tejun Heo
Date: Thu May 19 2011 - 05:30:36 EST
On Wed, May 18, 2011 at 01:32:50PM -0700, Tony Luck wrote:
> Today's pull from Linus' tree (HEAD = 258-ga2b9c1f) gave me some new
> messages during boot:
>
> sda: detected capacity change from 0 to 146815737856
> sdb: detected capacity change from 0 to 146815737856
>
> They weren't there yesterday (HEAD = 211-gc1d10d1) ... nor do they
> show up in any of my saved boot time dmesg files for the last few
> months.
>
> Harmless? Or something to worry about in the last few commits
> before 2.6.39 goes final?
Yes, it is harmless. The order was changed between
rescan_partitions() and bd_set_size() - rescan_partitions() checked
for size change too and it resulted in simpler condition checks.
However, rescan_partitions() triggers the above message when it
detects size change unlike the silient bd_set_size().
Does the following patch remove the messages for you?
Thanks.
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 257b00e..bf9c7a7 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)
goto restart;
}
}
+
+ if (!ret && !bdev->bd_openers) {
+ bd_set_size(bdev,(loff_t)get_capacity(disk)<<9);
+ bdi = blk_get_backing_dev_info(bdev);
+ if (bdi == NULL)
+ bdi = &default_backing_dev_info;
+ bdev_inode_switch_bdi(bdev->bd_inode, bdi);
+ }
+
/*
* If the device is invalidated, rescan partition
* 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)
rescan_partitions(disk, bdev);
if (ret)
goto out_clear;
-
- if (!bdev->bd_openers) {
- bd_set_size(bdev,(loff_t)get_capacity(disk)<<9);
- bdi = blk_get_backing_dev_info(bdev);
- if (bdi == NULL)
- bdi = &default_backing_dev_info;
- bdev_inode_switch_bdi(bdev->bd_inode, bdi);
- }
} else {
struct block_device *whole;
whole = bdget_disk(disk, 0);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/