diff --git a/WHATS_NEW b/WHATS_NEW index f97bf9a7d..94a9e91f5 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.65 - ================================= + Skip internal lvm devices in scan if ignore suspended devices is requested. Do not merge old device cache after we run full scan. (2.02.56) Add pkgconfigdir Makefile variable for make install override. Switch usage of Libs.private: to Requires.private: in devmapper.pc, lvm2app.pc. diff --git a/lib/activate/activate.h b/lib/activate/activate.h index 019f44c25..cae962e58 100644 --- a/lib/activate/activate.h +++ b/lib/activate/activate.h @@ -110,6 +110,6 @@ int pv_uses_vg(struct physical_volume *pv, /* * Returns 1 if mapped device is not suspended. */ -int device_is_usable(dev_t dev); +int device_is_usable(struct device *dev); #endif diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c index d52d46f60..710b3aeab 100644 --- a/lib/activate/dev_manager.c +++ b/lib/activate/dev_manager.c @@ -126,11 +126,11 @@ static int _info_run(const char *name, const char *dlid, struct dm_info *info, return r; } -int device_is_usable(dev_t dev) +int device_is_usable(struct device *dev) { struct dm_task *dmt; struct dm_info info; - const char *name; + const char *name, *uuid; uint64_t start, length; char *target_type = NULL; char *params; @@ -142,7 +142,7 @@ int device_is_usable(dev_t dev) return 0; } - if (!dm_task_set_major_minor(dmt, MAJOR(dev), MINOR(dev), 1)) + if (!dm_task_set_major_minor(dmt, MAJOR(dev->dev), MINOR(dev->dev), 1)) goto_out; if (!dm_task_run(dmt)) { @@ -157,6 +157,7 @@ int device_is_usable(dev_t dev) goto out; name = dm_task_get_name(dmt); + uuid = dm_task_get_uuid(dmt); /* FIXME Also check for mirror block_on_error and mpath no paths */ /* For now, we exclude all mirrors */ @@ -165,12 +166,21 @@ int device_is_usable(dev_t dev) next = dm_get_next_target(dmt, next, &start, &length, &target_type, ¶ms); /* Skip if target type doesn't match */ - if (target_type && !strcmp(target_type, "mirror")) + if (target_type && !strcmp(target_type, "mirror")) { + log_debug("%s: Mirror device not usable.", dev_name(dev)); goto out; + } } while (next); /* 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; + } + r = 1; out: diff --git a/lib/filters/filter.c b/lib/filters/filter.c index b33d099ff..2f865477a 100644 --- a/lib/filters/filter.c +++ b/lib/filters/filter.c @@ -132,8 +132,8 @@ static int _passes_lvm_type_device_filter(struct dev_filter *f __attribute((unus /* Skip suspended devices */ if (MAJOR(dev->dev) == _device_mapper_major && - ignore_suspended_devices() && !device_is_usable(dev->dev)) { - log_debug("%s: Skipping: Suspended dm device", name); + ignore_suspended_devices() && !device_is_usable(dev)) { + log_debug("%s: Skipping: Suspended or internal dm device", name); return 0; }