Version 2.02.28 -
================================
+ Introduce VG_GLOBAL lock type for vgscan/pvscan to trigger clvmd -R.
Fix clvmd -R, so it fully refreshes the caches.
Change lvconvert_mirrors to use mirror segtype not striped.
Fix lvconvert_mirrors detection of number of existing mirrors.
switch (flags & LCK_SCOPE_MASK) {
case LCK_VG:
/* If the VG name is empty then lock the unused PVs */
- if (!*resource)
+ if (!*resource) /* FIXME Deprecated */
dm_snprintf(lockname, sizeof(lockname), "P_orphans");
+ else if (*resource == '#')
+ dm_snprintf(lockname, sizeof(lockname), "P_%s", resource + 1);
else
dm_snprintf(lockname, sizeof(lockname), "V_%s",
resource);
switch (flags & LCK_SCOPE_MASK) {
case LCK_VG:
- if (!*resource)
+ if (!*resource) /* FIXME Deprecated */
dm_snprintf(lockfile, sizeof(lockfile),
"%s/P_orphans", _lock_dir);
+ else if (*resource == '#')
+ dm_snprintf(lockfile, sizeof(lockfile),
+ "%s/P_%s", _lock_dir, resource + 1);
else
dm_snprintf(lockfile, sizeof(lockfile),
"%s/V_%s", _lock_dir, resource);
/*
* LCK_VG:
* Lock/unlock on-disk volume group data
- * Use "" to lock orphan PVs
+ * Use VG_ORPHANS to lock orphan PVs
* char *vol holds volume group name
*
* LCK_LV:
#define LCK_MIRROR_NOSYNC_MODE 0x00000002U /* Mirrors don't require sync */
#define LCK_DMEVENTD_MONITOR_MODE 0x00000004U /* Register with dmeventd */
+/*
+ * Special cases of VG locks.
+ */
+#define VG_ORPHANS "#orphans"
+#define VG_GLOBAL "#global"
/*
* Common combinations
arg_count(cmd, exported_ARG) ?
"of exported volume group(s)" : "in no volume group");
+ if (!lock_vol(cmd, VG_GLOBAL, LCK_VG_WRITE)) {
+ log_error("Unable to obtain global lock.");
+ return ECMD_FAILED;
+ }
+
persistent_filter_wipe(cmd->filter);
lvmcache_destroy();
log_verbose("Walking through all physical volumes");
- if (!(pvslist = get_pvs(cmd)))
+ if (!(pvslist = get_pvs(cmd))) {
+ unlock_vg(cmd, VG_GLOBAL);
return ECMD_FAILED;
+ }
/* eliminate exported/new if required */
list_iterate_items(pvl, pvslist) {
if (!pvs_found) {
log_print("No matching physical volumes found");
+ unlock_vg(cmd, VG_GLOBAL);
return ECMD_PROCESSED;
}
display_size(cmd, (size_total - size_new)),
new_pvs_found, display_size(cmd, size_new));
+ unlock_vg(cmd, VG_GLOBAL);
+
return ECMD_PROCESSED;
}
return EINVALID_CMD_LINE;
}
+ if (!lock_vol(cmd, VG_GLOBAL, LCK_VG_WRITE)) {
+ log_error("Unable to obtain global lock.");
+ return ECMD_FAILED;
+ }
+
persistent_filter_wipe(cmd->filter);
lvmcache_destroy();
maxret = ret;
}
+ unlock_vg(cmd, VG_GLOBAL);
return maxret;
}