1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-10 16:58:47 +03:00

dev_manager: skip also zero targets

Devices made only from 'error' target cannot be used,
but if the device is also combined from 'zero' target
the same rule can be applied as such device cannot be used.
This commit is contained in:
Zdenek Kabelac 2021-03-18 17:17:21 +01:00
parent a9b4acd511
commit adc238062d

View File

@ -630,7 +630,7 @@ int device_is_usable(struct device *dev, struct dev_usable_check_params check, i
char *params, *vgname, *lvname, *layer;
char vg_name[NAME_LEN];
void *next = NULL;
int only_error_target = 1;
int only_error_or_zero_target = 1;
int r = 0;
if (!(dmt = _setup_task_run(DM_DEVICE_STATUS, &info, NULL, NULL, NULL,
@ -766,13 +766,15 @@ int device_is_usable(struct device *dev, struct dev_usable_check_params check, i
goto out;
}
if (strcmp(target_type, TARGET_NAME_ERROR))
only_error_target = 0;
if (only_error_or_zero_target &&
strcmp(target_type, TARGET_NAME_ERROR) &&
strcmp(target_type, TARGET_NAME_ZERO))
only_error_or_zero_target = 0;
} while (next);
/* Skip devices consisting entirely of error targets. */
/* Skip devices consisting entirely of error or zero targets. */
/* FIXME Deal with device stacked above error targets? */
if (check.check_error_target && only_error_target) {
if (check.check_error_target && only_error_or_zero_target) {
log_debug_activation("%s: Error device %s not usable.",
dev_name(dev), name);
goto out;