Version 2.02.66 -
===============================
+ Validate orphan and VG_GLOBAL lock order too.
Accept orphan VG names as parameters to lock_vol() and related functions.
Use is_orphan_vg in place of hard-coded prefix tests.
/*
* Ensure vgname2 comes after vgname1 alphabetically.
- * Orphans don't count.
+ * Orphan locks come last.
+ * VG_GLOBAL comes first.
*/
static int _vgname_order_correct(const char *vgname1, const char *vgname2)
{
- if (is_orphan_vg(vgname1) || is_orphan_vg(vgname2))
+ if (is_global_vg(vgname1))
+ return 1;
+
+ if (is_global_vg(vgname2))
+ return 0;
+
+ if (is_orphan_vg(vgname1))
+ return 0;
+
+ if (is_orphan_vg(vgname2))
return 1;
if (strcmp(vgname1, vgname2) < 0)
if (is_orphan_vg(vol))
vol = VG_ORPHANS;
/* VG locks alphabetical, ORPHAN lock last */
- else if (((flags & LCK_TYPE_MASK) != LCK_UNLOCK) &&
+ if (((flags & LCK_TYPE_MASK) != LCK_UNLOCK) &&
!(flags & LCK_CACHE) &&
!lvmcache_verify_lock_order(vol))
return 0;
int move_pvs_used_by_lv(struct volume_group *vg_from,
struct volume_group *vg_to,
const char *lv_name);
+int is_global_vg(const char *vg_name);
int is_orphan_vg(const char *vg_name);
int is_orphan(const struct physical_volume *pv);
int is_missing_pv(const struct physical_volume *pv);
return 1;
}
+int is_global_vg(const char *vg_name)
+{
+ return (vg_name && !strcmp(vg_name, VG_GLOBAL)) ? 1 : 0;
+}
+
/**
* is_orphan_vg - Determine whether a vg_name is an orphan
* @vg_name: pointer to the vg_name