mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
metadata: do not issue warning message about PV dev size being 0 when the device has gone just after VG read
There's a window between doing VG read and checking PV device size against real device size. If the device is removed in this window, the dev cache still holds struct device and pv->dev still references that and that PV is not marked as missing. However, if we're trying to get size for such device, the open fails because that device doesn't exists anymore. We called existing pv_dev_size in _check_pv_dev_sizes fn. But pv_dev_size assigned a size of 0 if the dev_get_size it called failed (because the device is gone). So call the dev_get_size directly and check for the return code in _check_pv_dev_sizes and go further only if we really know the device size. This is to avoid confusing warning messages like: Device /dev/sdd1 has size of 0 sectors which is smaller than corresponding PV size of 31455207 sectors. Was device resized? One or more devices used as PVs in VG helter_skelter have changed sizes.
This commit is contained in:
parent
8f01ee3035
commit
9918d95490
@ -680,8 +680,14 @@ static int _check_pv_dev_sizes(struct volume_group *vg)
|
||||
dm_list_iterate_items(pvl, &vg->pvs) {
|
||||
if (is_missing_pv(pvl->pv))
|
||||
continue;
|
||||
|
||||
dev_size = pv_dev_size(pvl->pv);
|
||||
/*
|
||||
* Don't compare the sizes if we're not able
|
||||
* to determine the real dev_size. This may
|
||||
* happen if the device has gone since we did
|
||||
* VG read.
|
||||
*/
|
||||
if (!dev_get_size(pvl->pv->dev, &dev_size))
|
||||
continue;
|
||||
size = pv_size(pvl->pv);
|
||||
|
||||
if (dev_size < size) {
|
||||
|
Loading…
Reference in New Issue
Block a user