1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-30 10:50:34 +03:00

Fix device_is_usable to properly detect only internal LV names.

This commit is contained in:
Milan Broz 2010-05-14 12:03:32 +00:00
parent 8e50c4e4bb
commit 83b4f8366a

View File

@ -133,7 +133,7 @@ int device_is_usable(struct device *dev)
const char *name, *uuid;
uint64_t start, length;
char *target_type = NULL;
char *params;
char *params, *vgname = NULL, *lvname, *layer;
void *next = NULL;
int r = 0;
@ -175,15 +175,23 @@ int device_is_usable(struct device *dev)
/* FIXME Also check dependencies? */
/* Check internal lvm devices */
if (is_reserved_lvname(name) && uuid &&
!strncmp(uuid, UUID_PREFIX, sizeof(UUID_PREFIX) - 1)) {
log_debug("%s: Reserved internal LVM device not usable.", dev_name(dev));
goto out;
if (uuid && !strncmp(uuid, UUID_PREFIX, sizeof(UUID_PREFIX) - 1)) {
if (!(vgname = dm_strdup(name)) ||
!dm_split_lvm_name(NULL, NULL, &vgname, &lvname, &layer))
goto_out;
if (lvname && (is_reserved_lvname(lvname) || layer)) {
log_debug("%s: Reserved internal LV device %s/%s%s%s not usable.",
dev_name(dev), vgname, lvname, layer ? "-" : "",
layer ?: "");
goto out;
}
}
r = 1;
out:
dm_free(vgname);
dm_task_destroy(dmt);
return r;
}