mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-03 05:18:29 +03:00
Detect duplicate PV uuids - select the one on an md device if appropriate.
This commit is contained in:
parent
fdf481c665
commit
f3f3424f9a
23
lib/cache/cache.c
vendored
23
lib/cache/cache.c
vendored
@ -11,6 +11,9 @@
|
|||||||
#include "toolcontext.h"
|
#include "toolcontext.h"
|
||||||
#include "dev-cache.h"
|
#include "dev-cache.h"
|
||||||
#include "metadata.h"
|
#include "metadata.h"
|
||||||
|
#include "filter.h"
|
||||||
|
|
||||||
|
#include <linux/kdev_t.h>
|
||||||
|
|
||||||
static struct hash_table *_pvid_hash = NULL;
|
static struct hash_table *_pvid_hash = NULL;
|
||||||
static struct hash_table *_vgid_hash = NULL;
|
static struct hash_table *_vgid_hash = NULL;
|
||||||
@ -409,6 +412,26 @@ struct cache_info *cache_add(struct labeller *labeller, const char *pvid,
|
|||||||
list_init(&info->list);
|
list_init(&info->list);
|
||||||
info->dev = dev;
|
info->dev = dev;
|
||||||
} else {
|
} else {
|
||||||
|
if (existing->dev != dev) {
|
||||||
|
/* Is the existing entry a duplicate pvid e.g. md ? */
|
||||||
|
if (MAJOR(existing->dev->dev) == md_major() &&
|
||||||
|
MAJOR(dev->dev) != md_major()) {
|
||||||
|
log_very_verbose("Ignoring duplicate PV %s on "
|
||||||
|
"%s - using md %s",
|
||||||
|
pvid, dev_name(dev),
|
||||||
|
dev_name(existing->dev));
|
||||||
|
return NULL;
|
||||||
|
} else if (MAJOR(existing->dev->dev) != md_major() &&
|
||||||
|
MAJOR(dev->dev) == md_major())
|
||||||
|
log_very_verbose("Duplicate PV %s on %s - "
|
||||||
|
"using md %s", pvid,
|
||||||
|
dev_name(existing->dev),
|
||||||
|
dev_name(dev));
|
||||||
|
else
|
||||||
|
log_error("Found duplicate PV %s: using %s not "
|
||||||
|
"%s", pvid, dev_name(dev),
|
||||||
|
dev_name(existing->dev));
|
||||||
|
}
|
||||||
info = existing;
|
info = existing;
|
||||||
/* Has labeller changed? */
|
/* Has labeller changed? */
|
||||||
if (info->label->labeller != labeller) {
|
if (info->label->labeller != labeller) {
|
||||||
|
Loading…
Reference in New Issue
Block a user