mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-17 06:04:23 +03:00
fix for md component detection changes
And some fine tuning of when the checks are applied in "start" mode.
This commit is contained in:
parent
df4c50396b
commit
018bba897c
56
lib/cache/lvmcache.c
vendored
56
lib/cache/lvmcache.c
vendored
@ -1056,7 +1056,8 @@ void lvmcache_extra_md_component_checks(struct cmd_context *cmd)
|
|||||||
struct device *dev;
|
struct device *dev;
|
||||||
const char *device_hint;
|
const char *device_hint;
|
||||||
uint64_t devsize, pvsize;
|
uint64_t devsize, pvsize;
|
||||||
int do_check;
|
int do_check_size, do_check_name;
|
||||||
|
int md_check_start;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* use_full_md_check: if set then no more needs to be done here,
|
* use_full_md_check: if set then no more needs to be done here,
|
||||||
@ -1073,9 +1074,11 @@ void lvmcache_extra_md_component_checks(struct cmd_context *cmd)
|
|||||||
* function is looking for.
|
* function is looking for.
|
||||||
*/
|
*/
|
||||||
if (!cmd->md_component_detection || cmd->use_full_md_check ||
|
if (!cmd->md_component_detection || cmd->use_full_md_check ||
|
||||||
!strcmp(cmd->md_component_checks, "none") || !strcmp(cmd->md_component_checks, "start"))
|
!strcmp(cmd->md_component_checks, "none"))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
md_check_start = !strcmp(cmd->md_component_checks, "start");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We want to avoid extra scanning for end-of-device md superblocks
|
* We want to avoid extra scanning for end-of-device md superblocks
|
||||||
* whenever possible, since it can add up to a lot of extra io if we're
|
* whenever possible, since it can add up to a lot of extra io if we're
|
||||||
@ -1093,7 +1096,8 @@ void lvmcache_extra_md_component_checks(struct cmd_context *cmd)
|
|||||||
device_hint = _get_pvsummary_device_hint(dev->pvid);
|
device_hint = _get_pvsummary_device_hint(dev->pvid);
|
||||||
pvsize = _get_pvsummary_size(dev->pvid);
|
pvsize = _get_pvsummary_size(dev->pvid);
|
||||||
devsize = dev->size;
|
devsize = dev->size;
|
||||||
do_check = 0;
|
do_check_size = 0;
|
||||||
|
do_check_name = 0;
|
||||||
|
|
||||||
if (!devsize && !dev_get_size(dev, &devsize))
|
if (!devsize && !dev_get_size(dev, &devsize))
|
||||||
log_debug("No size for %s.", dev_name(dev));
|
log_debug("No size for %s.", dev_name(dev));
|
||||||
@ -1103,23 +1107,43 @@ void lvmcache_extra_md_component_checks(struct cmd_context *cmd)
|
|||||||
* can be common, but not as often as PV larger.
|
* can be common, but not as often as PV larger.
|
||||||
*/
|
*/
|
||||||
if (pvsize && devsize && (pvsize != devsize))
|
if (pvsize && devsize && (pvsize != devsize))
|
||||||
do_check = 1;
|
do_check_size = 1;
|
||||||
else if (device_hint && !strcmp(device_hint, "/dev/md"))
|
if (device_hint && !strncmp(device_hint, "/dev/md", 7))
|
||||||
do_check = 1;
|
do_check_name = 1;
|
||||||
|
|
||||||
if (do_check) {
|
if (!do_check_size && !do_check_name)
|
||||||
log_debug("extra md component check %llu %llu device_hint %s dev %s",
|
continue;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If only the size is different (which can be fairly
|
||||||
|
* common for non-md-component devs) and the user has
|
||||||
|
* set "start" to disable full md checks, then skip it.
|
||||||
|
* If the size is different, *and* the device name hint
|
||||||
|
* looks like an md device, then it seems very likely
|
||||||
|
* to be an md component, so do a full check on it even
|
||||||
|
* if the user has set "start".
|
||||||
|
*
|
||||||
|
* In "auto" mode, do a full check if either the size
|
||||||
|
* or the name indicates a possible md component.
|
||||||
|
*/
|
||||||
|
if (do_check_size && !do_check_name && md_check_start) {
|
||||||
|
log_debug("extra md component check skip %llu %llu device_hint %s dev %s",
|
||||||
(unsigned long long)pvsize, (unsigned long long)devsize,
|
(unsigned long long)pvsize, (unsigned long long)devsize,
|
||||||
device_hint ?: "none", dev_name(dev));
|
device_hint ?: "none", dev_name(dev));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (dev_is_md_component(dev, NULL, 1)) {
|
log_debug("extra md component check %llu %llu device_hint %s dev %s",
|
||||||
log_debug("dropping PV from md component %s", dev_name(dev));
|
(unsigned long long)pvsize, (unsigned long long)devsize,
|
||||||
dev->flags &= ~DEV_SCAN_FOUND_LABEL;
|
device_hint ?: "none", dev_name(dev));
|
||||||
/* lvmcache_del will also delete vginfo if info was last one */
|
|
||||||
lvmcache_del(info);
|
if (dev_is_md_component(dev, NULL, 1)) {
|
||||||
lvmcache_del_dev_from_duplicates(dev);
|
log_debug("dropping PV from md component %s", dev_name(dev));
|
||||||
cmd->filter->wipe(cmd, cmd->filter, dev, NULL);
|
dev->flags &= ~DEV_SCAN_FOUND_LABEL;
|
||||||
}
|
/* lvmcache_del will also delete vginfo if info was last one */
|
||||||
|
lvmcache_del(info);
|
||||||
|
lvmcache_del_dev_from_duplicates(dev);
|
||||||
|
cmd->filter->wipe(cmd, cmd->filter, dev, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user