From f5f3defc02c6cfd8a71cc7bd91255e0ff98e711a Mon Sep 17 00:00:00 2001 From: Alasdair Kergon Date: Wed, 6 Jul 2011 00:29:44 +0000 Subject: [PATCH] Cope with a PV only discovered missing when creating deptree. --- WHATS_NEW | 1 + lib/activate/dev_manager.c | 14 +++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/WHATS_NEW b/WHATS_NEW index dde1bdc48..bc74c18e1 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.86 - ================================= + Cope with a PV only discovered missing when creating deptree. Abort operation if dm_tree_node_add_target_area fails. Add activation/checks to lvm.conf to perform additional ioctl validation. When suspending, automatically preload newly-visible existing LVs. diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c index 6c037496b..90cf5a4f9 100644 --- a/lib/activate/dev_manager.c +++ b/lib/activate/dev_manager.c @@ -1194,13 +1194,21 @@ int add_areas_line(struct dev_manager *dm, struct lv_segment *seg, uint64_t extent_size = seg->lv->vg->extent_size; uint32_t s; char *dlid; + struct stat info; + const char *name; + /* FIXME Avoid repeating identical stat in dm_tree_node_add_target_area */ for (s = start_area; s < areas; s++) { if ((seg_type(seg, s) == AREA_PV && - (!seg_pvseg(seg, s) || - !seg_pv(seg, s) || - !seg_dev(seg, s))) || + (!seg_pvseg(seg, s) || !seg_pv(seg, s) || !seg_dev(seg, s) || + !(name = dev_name(seg_dev(seg, s))) || !*name || + stat(name, &info) < 0 || !S_ISBLK(info.st_mode))) || (seg_type(seg, s) == AREA_LV && !seg_lv(seg, s))) { + if (!seg->lv->vg->cmd->partial_activation) { + log_error("Aborting. LV %s is now incomplete " + "and --partial was not specified.", seg->lv->name); + return 0; + } if (!_add_error_area(dm, node, seg, s)) return_0; } else if (seg_type(seg, s) == AREA_PV) {