master - man: More /dev/vg and /dev/mapper documentation.
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=867b92b031b491...
Commit: 867b92b031b4913213c335bd0bf7363e934f379d
Parent: 9c3c35787423b3b3d29fdb6a86cf796a1847cce4
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Mon Jun 23 14:01:31 2014 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Mon Jun 23 14:01:31 2014 +0100
man: More /dev/vg and /dev/mapper documentation.
---
man/dmsetup.8.in | 8 +++++++-
man/lvchange.8.in | 13 ++++++++++++-
man/lvm.8.in | 9 +++++++++
man/vgchange.8.in | 9 +++++++++
4 files changed, 37 insertions(+), 2 deletions(-)
diff --git a/man/dmsetup.8.in b/man/dmsetup.8.in
index b545dcf..b18b0b0 100644
--- a/man/dmsetup.8.in
+++ b/man/dmsetup.8.in
@@ -502,7 +502,13 @@ Sets the device geometry to C/H/S.
.RI [ subsystem ]
.br
Splits given device name into subsystem constituents.
-Default subsystem is LVM.
+The default subsystem is LVM.
+LVM currently generates device names by concatenating the names of the Volume
+Group, Logical Volume and any internal Layer with a hyphen as separator.
+Any hyphens within the names are doubled to escape them.
+The precise encoding might change without notice in any future
+release, so we recommend you always decode using the current version of
+this command.
.br
.TP
.B status
diff --git a/man/lvchange.8.in b/man/lvchange.8.in
index 5c896e0..f7aee8f 100644
--- a/man/lvchange.8.in
+++ b/man/lvchange.8.in
@@ -72,7 +72,18 @@ See \fBlvm\fP(8) for common options.
Controls the availability of the logical volumes for use.
Communicates with the kernel device-mapper driver via
libdevmapper to activate (\-ay) or deactivate (\-an) the
-logical volumes. If autoactivation option is used (\-aay),
+logical volumes.
+.IP
+Activation of a logical volume creates a symbolic link
+/dev/VolumeGroupName/LogicalVolumeName pointing to the device node.
+This link is removed on deactivation.
+All software and scripts should access the device through
+this symbolic link and present this as the name of the device.
+The location and name of the underlying device node may depend on
+the distribution and configuration (e.g. udev) and might change
+from release to release.
+.IP
+If autoactivation option is used (\-aay),
the logical volume is activated only if it matches an item in
the activation/auto_activation_volume_list set in lvm.conf.
If this list is not set, then all volumes are considered for
diff --git a/man/lvm.8.in b/man/lvm.8.in
index 0a5c69c..76d1237 100644
--- a/man/lvm.8.in
+++ b/man/lvm.8.in
@@ -347,6 +347,14 @@ There are also various reserved names that are used internally by lvm that can n
A VG cannot be called anything that exists in /dev/ at the time of creation, nor can it be called '.' or '..'.
A LV cannot be called '.' '..' 'snapshot' or 'pvmove'. The LV name may also not contain
the strings '_mlog', '_mimage', '_rimage', '_tdata', '_tmeta'.
+A directory bearing the name of each Volume Group is created under /dev when any of its Logical Volumes are activated.
+Each active Logical Volume is accessible from this directory as a symbolic link leading to a device node.
+Links or nodes in /dev/mapper are intended only for internal use and the precise format and escaping might change between releases and distributions.
+Other software and scripts should use the
+/dev/VolumeGroupName/LogicalVolumeName format to reduce the chance of needing
+amendment when the software is updated. Should you need to process the node
+names in /dev/mapper, you may use \fBdmsetup splitname\fP to separate out the
+original VG, LV and internal layer names.
.SH ALLOCATION
When an operation needs to allocate Physical Extents for one or more
Logical Volumes, the tools proceed as follows:
@@ -500,6 +508,7 @@ All tools return a status code of zero on success or non-zero on failure.
.BR lvmthin (7),
.BR lvm\ dumpconfig (8),
.BR clvmd (8),
+.BR dmsetup (8),
.BR lvchange (8),
.BR lvcreate (8),
.BR lvdisplay (8),
diff --git a/man/vgchange.8.in b/man/vgchange.8.in
index 284a655..9ea2f65 100644
--- a/man/vgchange.8.in
+++ b/man/vgchange.8.in
@@ -83,6 +83,15 @@ The \-aay option should be also used during system boot so it's
possible to select which volumes to activate using the
activation/auto_activation_volume_list settting.
.IP
+Activation of a logical volume creates a symbolic link
+/dev/VolumeGroupName/LogicalVolumeName pointing to the device node.
+This link is removed on deactivation.
+All software and scripts should access the device through
+this symbolic link and present this as the name of the device.
+The location and name of the underlying device node may depend on
+the distribution and configuration (e.g. udev) and might change
+from release to release.
+.IP
If clustered locking is enabled, add 'e' to activate/deactivate
exclusively on one node or 'l' to activate/deactivate only
on the local node.
9 years, 10 months
master - select: add message about 'help' field to get more help on each error hit during selection parsing
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=9c3c35787423b3...
Commit: 9c3c35787423b3b3d29fdb6a86cf796a1847cce4
Parent: 69075d0b4386f0bd112efc237c86c340872b022f
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Mon Jun 23 12:12:01 2014 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Mon Jun 23 12:21:17 2014 +0200
select: add message about 'help' field to get more help on each error hit during selection parsing
Inform about 'help' to get more help about selection fields and operators
after each syntax error hit:
"Use 'help' for selection to get more help."
---
libdm/libdm-report.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/libdm/libdm-report.c b/libdm/libdm-report.c
index 67f63d5..957a4c9 100644
--- a/libdm/libdm-report.c
+++ b/libdm/libdm-report.c
@@ -2396,7 +2396,8 @@ out_reserved_values:
log_warn(" ");
}
-static char _sel_syntax_error_at_msg[] = "Selection syntax error at '%s'.";
+static const char _sel_syntax_error_at_msg[] = "Selection syntax error at '%s'.";
+static const char _sel_help_ref_msg[] = "Use \'help\' for selection to get more help.";
/*
* Selection parser
@@ -2460,6 +2461,8 @@ static struct selection_node *_parse_selection(struct dm_report *rh,
c = we[0];
tmp = (char *) we;
tmp[0] = '\0';
+ _display_fields(rh, 0, 1);
+ log_warn(" ");
log_error("Selection field is uncomparable: %s.", ws);
tmp[0] = c;
goto bad;
@@ -2522,6 +2525,7 @@ static struct selection_node *_parse_selection(struct dm_report *rh,
return sn;
bad:
log_error(_sel_syntax_error_at_msg, s);
+ log_error(_sel_help_ref_msg);
*next = s;
return NULL;
}
@@ -2695,6 +2699,7 @@ struct dm_report *dm_report_init_with_selection(uint32_t *report_types,
if (*next) {
log_error("Expecting logical operator");
log_error(_sel_syntax_error_at_msg, next);
+ log_error(_sel_help_ref_msg);
goto error;
}
9 years, 10 months
master - select: also mark uncomparable/unselectable fields in field/selection help
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=69075d0b4386f0...
Commit: 69075d0b4386f0bd112efc237c86c340872b022f
Parent: 2d48ef7f04e0b3b14d7a9bf622979e42141f34f2
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Mon Jun 23 10:46:45 2014 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Mon Jun 23 12:20:49 2014 +0200
select: also mark uncomparable/unselectable fields in field/selection help
---
libdm/libdm-report.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/libdm/libdm-report.c b/libdm/libdm-report.c
index 3d16e5a..67f63d5 100644
--- a/libdm/libdm-report.c
+++ b/libdm/libdm-report.c
@@ -633,8 +633,9 @@ static void _display_fields_more(struct dm_report *rh,
}
}
/* FIXME Add line-wrapping at terminal width (or 80 cols) */
- log_warn(" %-*s - %s%s%s%s", (int) id_len, fields[f].id, fields[f].desc,
+ log_warn(" %-*s - %s%s%s%s%s", (int) id_len, fields[f].id, fields[f].desc,
display_field_types ? " [" : "",
+ display_field_types ? fields[f].flags & FLD_CMP_UNCOMPARABLE ? "unselectable " : "" : "",
display_field_types ? _get_field_type_name(fields[f].flags & DM_REPORT_FIELD_TYPE_MASK) : "",
display_field_types ? "]" : "");
last_desc = desc;
9 years, 10 months
master - select: add FLD_UNCOMPARABLE flag for fields which can't be compared
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=2d48ef7f04e0b3...
Commit: 2d48ef7f04e0b3b14d7a9bf622979e42141f34f2
Parent: c1c2e838e88c56ef38d590007ca3b588ca06f1fd
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Mon Jun 23 09:57:46 2014 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Mon Jun 23 10:09:58 2014 +0200
select: add FLD_UNCOMPARABLE flag for fields which can't be compared
A field where it has no meaning to do any type of comparison is the
implicit "help" or "?" field. The error given was a bit cryptic
before this patch, the FLD_UNCOMPARABLE flag makes it easier to identify
this situation anywhere in the code and provide much better error message.
This flag can be applied to other fields that may appear in the future -
mostly usable for implicit fields as they always have special purpose
(so we're not exporting it in libdevmapper for now - usual reporting
fields don't need this).
Before this patch:
$ vgs -S help=1
dm_report_object: no data assigned to field help
dm_report_object: no data assigned to field help
(...which is true actually, but let's provide something better...)
With this patch applied:
$vgs -S help=1
Selection field is uncomparable: help.
Selection syntax error at 'help=1'.
$vgs -S '(name=vg && help=1) || vg_size > 1g'
Selection field is uncomparable: help.
Selection syntax error at 'help=1) || vg_size > 1g'.
---
libdm/libdm-report.c | 37 ++++++++++++++++++++++++-------------
1 files changed, 24 insertions(+), 13 deletions(-)
diff --git a/libdm/libdm-report.c b/libdm/libdm-report.c
index fd03052..3d16e5a 100644
--- a/libdm/libdm-report.c
+++ b/libdm/libdm-report.c
@@ -84,13 +84,14 @@ struct op_def {
const char *desc;
};
-#define FLD_CMP_MASK 0x00FF0000
-#define FLD_CMP_EQUAL 0x00010000
-#define FLD_CMP_NOT 0x00020000
-#define FLD_CMP_GT 0x00040000
-#define FLD_CMP_LT 0x00080000
-#define FLD_CMP_REGEX 0x00100000
-#define FLD_CMP_NUMBER 0x00200000
+#define FLD_CMP_MASK 0x00FF0000
+#define FLD_CMP_UNCOMPARABLE 0x00010000
+#define FLD_CMP_EQUAL 0x00020000
+#define FLD_CMP_NOT 0x00040000
+#define FLD_CMP_GT 0x00080000
+#define FLD_CMP_LT 0x00100000
+#define FLD_CMP_REGEX 0x00200000
+#define FLD_CMP_NUMBER 0x00400000
/*
* #define FLD_CMP_STRING 0x00400000
* We could defined FLD_CMP_STRING here for completeness here,
@@ -227,15 +228,15 @@ static const struct dm_report_object_type _implicit_common_report_types[] = {
};
static const struct dm_report_field_type _implicit_common_report_fields[] = {
- { COMMON_REPORT_TYPE, DM_REPORT_FIELD_TYPE_NUMBER, 0, 8, COMMON_FIELD_HELP_ID, "Help", _no_report_fn, "Show help." },
- { COMMON_REPORT_TYPE, DM_REPORT_FIELD_TYPE_NUMBER, 0, 8, COMMON_FIELD_HELP_ALT_ID, "Help", _no_report_fn, "Show help." },
+ { COMMON_REPORT_TYPE, DM_REPORT_FIELD_TYPE_NUMBER | FLD_CMP_UNCOMPARABLE, 0, 8, COMMON_FIELD_HELP_ID, "Help", _no_report_fn, "Show help." },
+ { COMMON_REPORT_TYPE, DM_REPORT_FIELD_TYPE_NUMBER | FLD_CMP_UNCOMPARABLE, 0, 8, COMMON_FIELD_HELP_ALT_ID, "Help", _no_report_fn, "Show help." },
{ 0, 0, 0, 0, "", "", 0, 0}
};
static const struct dm_report_field_type _implicit_common_report_fields_with_selection[] = {
{ COMMON_REPORT_TYPE, DM_REPORT_FIELD_TYPE_NUMBER, 0, 8, COMMON_FIELD_SELECTED_ID, "Selected", _selected_disp, "Item passes selection criteria." },
- { COMMON_REPORT_TYPE, DM_REPORT_FIELD_TYPE_NUMBER, 0, 8, COMMON_FIELD_HELP_ID, "Help", _no_report_fn, "Show help." },
- { COMMON_REPORT_TYPE, DM_REPORT_FIELD_TYPE_NUMBER, 0, 8, COMMON_FIELD_HELP_ALT_ID, "Help", _no_report_fn, "Show help." },
+ { COMMON_REPORT_TYPE, DM_REPORT_FIELD_TYPE_NUMBER | FLD_CMP_UNCOMPARABLE, 0, 8, COMMON_FIELD_HELP_ID, "Help", _no_report_fn, "Show help." },
+ { COMMON_REPORT_TYPE, DM_REPORT_FIELD_TYPE_NUMBER | FLD_CMP_UNCOMPARABLE, 0, 8, COMMON_FIELD_HELP_ALT_ID, "Help", _no_report_fn, "Show help." },
{ 0, 0, 0, 0, "", "", 0, 0}
};
@@ -2452,8 +2453,18 @@ static struct selection_node *_parse_selection(struct dm_report *rh,
goto bad;
}
- ft = implicit ? &_implicit_report_fields[field_num]
- : &rh->fields[field_num];
+ if (implicit) {
+ ft = &_implicit_report_fields[field_num];
+ if (ft->flags & FLD_CMP_UNCOMPARABLE) {
+ c = we[0];
+ tmp = (char *) we;
+ tmp[0] = '\0';
+ log_error("Selection field is uncomparable: %s.", ws);
+ tmp[0] = c;
+ goto bad;
+ }
+ } else
+ ft = &rh->fields[field_num];
/* comparison operator */
if (!(flags = _tok_op_cmp(we, &last))) {
9 years, 10 months
master - locking: fix cluster locking
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c1c2e838e88c56...
Commit: c1c2e838e88c56ef38d590007ca3b588ca06f1fd
Parent: 78533f72d30f6e840f66e0aae89126ef139c1f2c
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Fri Jun 20 16:38:48 2014 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Fri Jun 20 16:38:48 2014 +0100
locking: fix cluster locking
Hunk missed from last commit 78533f72d30f6e840f66e0aae89126ef139c1f2c.
---
lib/locking/cluster_locking.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/lib/locking/cluster_locking.c b/lib/locking/cluster_locking.c
index 86e6c77..8070014 100644
--- a/lib/locking/cluster_locking.c
+++ b/lib/locking/cluster_locking.c
@@ -425,6 +425,8 @@ static int _lock_resource(struct cmd_context *cmd, const char *resource,
assert(resource);
switch (flags & LCK_SCOPE_MASK) {
+ case LCK_ACTIVATION:
+ return 1;
case LCK_VG:
if (!strcmp(resource, VG_SYNC_NAMES)) {
log_very_verbose("Requesting sync names.");
9 years, 10 months
master - locking: Introduce LCK_ACTIVATION.
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=78533f72d30f6e...
Commit: 78533f72d30f6e840f66e0aae89126ef139c1f2c
Parent: f29ae59a4d88ff0f76cfd84a6061222ae178438b
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Fri Jun 20 13:24:02 2014 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Fri Jun 20 13:24:02 2014 +0100
locking: Introduce LCK_ACTIVATION.
Take a local file lock to prevent concurrent activation/deactivation of LVs.
Thin/cache types and an extension for cluster support are excluded for
now.
'lvchange -ay $lv' and 'lvchange -an $lv' should no longer cause trouble
if issued concurrently: the new lock should make sure they
activate/deactivate $lv one-after-the-other, instead of overlapping.
(If anyone wants to experiment with the cluster patch, please get in touch.)
---
WHATS_NEW | 1 +
lib/locking/file_locking.c | 10 +++++++
lib/locking/locking.c | 2 +
lib/locking/locking.h | 65 ++++++++++++++++++++++++++++++++++++-------
lib/locking/no_locking.c | 2 +
5 files changed, 69 insertions(+), 11 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 44cef74..c2b443c 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.107 -
==================================
+ Introduce LCK_ACTIVATION to avoid concurrent activation of basic LV types.
Fix open_count test for lvchange --refresh or mirrors and raids.
Update pvs,vgs,lvs and lvm man page for selection support.
Add -S/--select to lvm devtypes for report selection.
diff --git a/lib/locking/file_locking.c b/lib/locking/file_locking.c
index d332101..e6def3f 100644
--- a/lib/locking/file_locking.c
+++ b/lib/locking/file_locking.c
@@ -49,6 +49,16 @@ static int _file_lock_resource(struct cmd_context *cmd, const char *resource,
unsigned revert = (flags & LCK_REVERT) ? 1 : 0;
switch (flags & LCK_SCOPE_MASK) {
+ case LCK_ACTIVATION:
+ if (dm_snprintf(lockfile, sizeof(lockfile),
+ "%s/A_%s", _lock_dir, resource + 1) < 0) {
+ log_error("Too long locking filename %s/A_%s.", _lock_dir, resource + 1);
+ return 0;
+ }
+
+ if (!lock_file(lockfile, flags))
+ return_0;
+ break;
case LCK_VG:
/* Skip cache refresh for VG_GLOBAL - the caller handles it */
if (strcmp(resource, VG_GLOBAL))
diff --git a/lib/locking/locking.c b/lib/locking/locking.c
index 673713a..9432f84 100644
--- a/lib/locking/locking.c
+++ b/lib/locking/locking.c
@@ -318,6 +318,8 @@ int lock_vol(struct cmd_context *cmd, const char *vol, uint32_t flags, struct lo
}
switch (flags & LCK_SCOPE_MASK) {
+ case LCK_ACTIVATION:
+ break;
case LCK_VG:
if (!_blocking_supported)
flags |= LCK_NONBLOCK;
diff --git a/lib/locking/locking.h b/lib/locking/locking.h
index 0945aa0..284ce7a 100644
--- a/lib/locking/locking.h
+++ b/lib/locking/locking.h
@@ -86,9 +86,10 @@ int check_lvm1_vg_inactive(struct cmd_context *cmd, const char *vgname);
/*
* Lock scope
*/
-#define LCK_SCOPE_MASK 0x00000008U
-#define LCK_VG 0x00000000U
-#define LCK_LV 0x00000008U
+#define LCK_SCOPE_MASK 0x00001008U
+#define LCK_VG 0x00000000U /* Volume Group */
+#define LCK_LV 0x00000008U /* Logical Volume */
+#define LCK_ACTIVATION 0x00001000U /* Activation */
/*
* Lock bits.
@@ -131,6 +132,9 @@ int check_lvm1_vg_inactive(struct cmd_context *cmd, const char *vgname);
*/
#define LCK_NONE (LCK_VG | LCK_NULL)
+#define LCK_ACTIVATE_LOCK (LCK_ACTIVATION | LCK_WRITE | LCK_HOLD)
+#define LCK_ACTIVATE_UNLOCK (LCK_ACTIVATION | LCK_UNLOCK)
+
#define LCK_VG_READ (LCK_VG | LCK_READ | LCK_HOLD)
#define LCK_VG_WRITE (LCK_VG | LCK_WRITE | LCK_HOLD)
#define LCK_VG_UNLOCK (LCK_VG | LCK_UNLOCK)
@@ -161,6 +165,33 @@ int check_lvm1_vg_inactive(struct cmd_context *cmd, const char *vgname);
lock_vol(cmd, (lv)->lvid.s, flags | LCK_LV_CLUSTERED(lv), lv) : \
0)
+/*
+ * Activation locks are wrapped around activation commands that have to
+ * be processed atomically one-at-a-time.
+ * If a VG WRITE lock is held, an activation lock is redundant.
+ *
+ * FIXME Test and support this for thin and cache types.
+ * FIXME Add cluster support.
+ */
+#define lv_supports_activation_locking(lv) (!vg_is_clustered((lv)->vg) && !lv_is_thin_type(lv) && !lv_is_cache_type(lv))
+#define lock_activation(cmd, lv) (vg_write_lock_held() && lv_supports_activation_locking(lv) ? 1 : lock_vol(cmd, (lv)->lvid.s, LCK_ACTIVATE_LOCK, lv))
+#define unlock_activation(cmd, lv) (vg_write_lock_held() && lv_supports_activation_locking(lv) ? 1 : lock_vol(cmd, (lv)->lvid.s, LCK_ACTIVATE_UNLOCK, lv))
+
+/*
+ * Place temporary exclusive 'activation' lock around an LV locking operation
+ * to serialise it.
+ */
+#define lock_lv_vol_serially(cmd, lv, flags) \
+({ \
+ int rr = 0; \
+\
+ if (lock_activation((cmd), (lv))) { \
+ rr = lock_lv_vol((cmd), (lv), (flags)); \
+ unlock_activation((cmd), (lv)); \
+ } \
+ rr; \
+})
+
#define unlock_vg(cmd, vol) \
do { \
if (is_real_vg(vol)) \
@@ -173,16 +204,28 @@ int check_lvm1_vg_inactive(struct cmd_context *cmd, const char *vgname);
release_vg(vg); \
} while (0)
-#define resume_lv(cmd, lv) lock_lv_vol(cmd, lv, LCK_LV_RESUME)
+#define resume_lv(cmd, lv) \
+({ \
+ int rr = lock_lv_vol((cmd), (lv), LCK_LV_RESUME); \
+ unlock_activation((cmd), (lv)); \
+ rr; \
+})
#define resume_lv_origin(cmd, lv) lock_lv_vol(cmd, lv, LCK_LV_RESUME | LCK_ORIGIN_ONLY)
-#define revert_lv(cmd, lv) lock_lv_vol(cmd, lv, LCK_LV_RESUME | LCK_REVERT)
-#define suspend_lv(cmd, lv) lock_lv_vol(cmd, lv, LCK_LV_SUSPEND | LCK_HOLD)
+#define revert_lv(cmd, lv) \
+({ \
+ int rr = lock_lv_vol((cmd), (lv), LCK_LV_RESUME | LCK_REVERT); \
+\
+ unlock_activation((cmd), (lv)); \
+ rr; \
+})
+#define suspend_lv(cmd, lv) \
+ (lock_activation((cmd), (lv)) ? lock_lv_vol((cmd), (lv), LCK_LV_SUSPEND | LCK_HOLD) : 0)
#define suspend_lv_origin(cmd, lv) lock_lv_vol(cmd, lv, LCK_LV_SUSPEND | LCK_HOLD | LCK_ORIGIN_ONLY)
-#define deactivate_lv(cmd, lv) lock_lv_vol(cmd, lv, LCK_LV_DEACTIVATE)
+#define deactivate_lv(cmd, lv) lock_lv_vol_serially(cmd, lv, LCK_LV_DEACTIVATE)
-#define activate_lv(cmd, lv) lock_lv_vol(cmd, lv, LCK_LV_ACTIVATE | LCK_HOLD)
+#define activate_lv(cmd, lv) lock_lv_vol_serially(cmd, lv, LCK_LV_ACTIVATE | LCK_HOLD)
#define activate_lv_excl_local(cmd, lv) \
- lock_lv_vol(cmd, lv, LCK_LV_EXCLUSIVE | LCK_HOLD | LCK_LOCAL)
+ lock_lv_vol_serially(cmd, lv, LCK_LV_EXCLUSIVE | LCK_HOLD | LCK_LOCAL)
#define activate_lv_excl_remote(cmd, lv) \
lock_lv_vol(cmd, lv, LCK_LV_EXCLUSIVE | LCK_HOLD | LCK_REMOTE)
@@ -190,9 +233,9 @@ struct logical_volume;
int activate_lv_excl(struct cmd_context *cmd, struct logical_volume *lv);
#define activate_lv_local(cmd, lv) \
- lock_lv_vol(cmd, lv, LCK_LV_ACTIVATE | LCK_HOLD | LCK_LOCAL)
+ lock_lv_vol_serially(cmd, lv, LCK_LV_ACTIVATE | LCK_HOLD | LCK_LOCAL)
#define deactivate_lv_local(cmd, lv) \
- lock_lv_vol(cmd, lv, LCK_LV_DEACTIVATE | LCK_LOCAL)
+ lock_lv_vol_serially(cmd, lv, LCK_LV_DEACTIVATE | LCK_LOCAL)
#define drop_cached_metadata(vg) \
lock_vol((vg)->cmd, (vg)->name, LCK_VG_DROP_CACHE, NULL)
#define remote_commit_cached_metadata(vg) \
diff --git a/lib/locking/no_locking.c b/lib/locking/no_locking.c
index f7718be..ab95933 100644
--- a/lib/locking/no_locking.c
+++ b/lib/locking/no_locking.c
@@ -37,6 +37,8 @@ static int _no_lock_resource(struct cmd_context *cmd, const char *resource,
uint32_t flags, struct logical_volume *lv)
{
switch (flags & LCK_SCOPE_MASK) {
+ case LCK_ACTIVATION:
+ break;
case LCK_VG:
if (!strcmp(resource, VG_SYNC_NAMES))
fs_unlock();
9 years, 10 months
master - pvvmove: add a few comments
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f29ae59a4d88ff...
Commit: f29ae59a4d88ff0f76cfd84a6061222ae178438b
Parent: f96a499c8d4ad784ccd7a15061e71b16342de104
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Fri Jun 20 11:41:20 2014 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Fri Jun 20 11:41:20 2014 +0100
pvvmove: add a few comments
---
lib/metadata/lv_manip.c | 8 +++++---
lib/metadata/merge.c | 5 +++++
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 44f94f4..069e5a6 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -2737,8 +2737,9 @@ int lv_add_segmented_mirror_image(struct alloc_handle *ah,
}
/*
- * Perform any necessary segment splitting before creating
- * the mirror layer.
+ * If the allocator provided two or more PV allocations for any
+ * single segment of the original LV, that LV segment must be
+ * split up to match.
*/
dm_list_iterate_items(aa, &ah->alloced_areas[0]) {
if (!(seg = find_seg_by_le(lv, current_le))) {
@@ -2757,6 +2758,7 @@ int lv_add_segmented_mirror_image(struct alloc_handle *ah,
}
current_le += seg->area_len;
}
+
current_le = le;
if (!insert_layer_for_lv(lv->vg->cmd, lv, PVMOVE, "_mimage_0")) {
@@ -5222,7 +5224,7 @@ int remove_layers_for_segments(struct cmd_context *cmd,
layer_lv->name, lseg->le);
return 0;
}
- if (((lseg->status & status_mask) != status_mask)) {
+ if ((lseg->status & status_mask) != status_mask) {
log_error("Layer status does not match: "
"%s:%" PRIu32 " status: 0x%" PRIx64 "/0x%" PRIx64,
layer_lv->name, lseg->le,
diff --git a/lib/metadata/merge.c b/lib/metadata/merge.c
index 142d4d8..5aa7d00 100644
--- a/lib/metadata/merge.c
+++ b/lib/metadata/merge.c
@@ -40,6 +40,11 @@ int lv_merge_segments(struct logical_volume *lv)
struct dm_list *segh, *t;
struct lv_segment *seg, *current, *prev = NULL;
+ /*
+ * Don't interfere with pvmoves as they rely upon two LVs
+ * having a matching segment structure.
+ */
+
if (lv->status & LOCKED || lv->status & PVMOVE)
return 1;
9 years, 10 months
master - lv: fix lv_is_raid
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f96a499c8d4ad7...
Commit: f96a499c8d4ad784ccd7a15061e71b16342de104
Parent: 93597bcbdc791daf7308c839f245f6951900d7a7
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Jun 20 11:37:45 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Jun 20 11:37:45 2014 +0200
lv: fix lv_is_raid
---
lib/metadata/lv.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/metadata/lv.c b/lib/metadata/lv.c
index 6cbab19..f1d93a9 100644
--- a/lib/metadata/lv.c
+++ b/lib/metadata/lv.c
@@ -777,7 +777,7 @@ char *lv_host_dup(struct dm_pool *mem, const struct logical_volume *lv)
static int _lv_is_exclusive(struct logical_volume *lv)
{
/* Some devices require exlusiveness */
- return lv_is_is_raid(lv) ||
+ return lv_is_raid(lv) ||
lv_is_origin(lv) ||
lv_is_thin_type(lv) ||
lv_is_cache_type(lv);
9 years, 10 months
master - tests: add udev sync point
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=93597bcbdc791d...
Commit: 93597bcbdc791daf7308c839f245f6951900d7a7
Parent: 548269a1ddeb8fa2cfc6a9fd95c5fb2c398914a7
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Jun 20 11:11:39 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Jun 20 11:14:29 2014 +0200
tests: add udev sync point
Missed synchronization with udev may lead to error on vgcreate,
if previous vgremove was not handled fast enough by udev.
---
test/shell/snapshot-usage.sh | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/test/shell/snapshot-usage.sh b/test/shell/snapshot-usage.sh
index c0a14c6..dcf2886 100644
--- a/test/shell/snapshot-usage.sh
+++ b/test/shell/snapshot-usage.sh
@@ -213,6 +213,12 @@ vgremove -ff $vg1
# Can't test >= 16T devices on 32bit
test "$TSIZE" = 15P || exit 0
+# synchronize with udev activity
+# FIXME - otherwise sequence of vgremove followed by vgcreate may fail...
+# as there could be still remaing links in /dev
+# Unusure if 'vgcreate' should do this type of detection in udev mode.
+aux udev_wait
+
# Check usability with largest extent size
pvcreate "$DM_DEV_DIR/$vg/$lv"
vgcreate -s 4G $vg1 "$DM_DEV_DIR/$vg/$lv"
9 years, 10 months
master - cleanup: use simplier test
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=548269a1ddeb8f...
Commit: 548269a1ddeb8fa2cfc6a9fd95c5fb2c398914a7
Parent: 32ad8ab5a4a6cd00f15beb947568a7a5b702f545
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Jun 19 21:08:05 2014 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Jun 20 11:14:11 2014 +0200
cleanup: use simplier test
Just like all other tests - use direct LV function test
---
lib/metadata/lv.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/metadata/lv.c b/lib/metadata/lv.c
index a1211a8..6cbab19 100644
--- a/lib/metadata/lv.c
+++ b/lib/metadata/lv.c
@@ -776,8 +776,8 @@ char *lv_host_dup(struct dm_pool *mem, const struct logical_volume *lv)
static int _lv_is_exclusive(struct logical_volume *lv)
{
- /* Some devices require exlusivness */
- return seg_is_raid(first_seg(lv)) ||
+ /* Some devices require exlusiveness */
+ return lv_is_is_raid(lv) ||
lv_is_origin(lv) ||
lv_is_thin_type(lv) ||
lv_is_cache_type(lv);
9 years, 10 months