master - snapshot: fix check for snapshot-merge target presence
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=4f6c2951d6495e...
Commit: 4f6c2951d6495ee335ab69da44ae2647cd341276
Parent: f12d88f840474a75a58d1f7ae8d391ec5852b850
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu May 16 08:12:37 2013 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu May 16 08:17:18 2013 +0200
snapshot: fix check for snapshot-merge target presence
If calling _snap_target_present on 2nd and later call and for
a segment with MERGING flag set, we must return the status of
snapshot as well as snapshot-merge target presence, not just
the snapshot one.
---
lib/snapshot/snapshot.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/lib/snapshot/snapshot.c b/lib/snapshot/snapshot.c
index 3c03ea9..2bab9d2 100644
--- a/lib/snapshot/snapshot.c
+++ b/lib/snapshot/snapshot.c
@@ -162,9 +162,11 @@ static int _snap_target_present(struct cmd_context *cmd,
_snap_checked = 1;
}
- if (!_snap_merge_checked && seg && (seg->status & MERGING)) {
- _snap_merge_present = target_present(cmd, "snapshot-merge", 0);
- _snap_merge_checked = 1;
+ if (seg && (seg->status & MERGING)) {
+ if (!_snap_merge_checked) {
+ _snap_merge_present = target_present(cmd, "snapshot-merge", 0);
+ _snap_merge_checked = 1;
+ }
return _snap_present && _snap_merge_present;
}
10 years, 11 months
master - activation: fix lv_is_active regressions
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f12d88f840474a...
Commit: f12d88f840474a75a58d1f7ae8d391ec5852b850
Parent: 2fbe1e6e00fc59f54ae11c19d51f2d7fc8425b16
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Wed May 15 02:13:31 2013 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Wed May 15 02:13:31 2013 +0100
activation: fix lv_is_active regressions
Try to fix commit bf2741376d47411994d4065863acab8e405ff5c7.
lv_is_active is not the same as lv_info(cmd, org, 0, &info, 0, 0).
Introduce and use lv_is_active_locally.
---
WHATS_NEW | 2 +-
lib/activate/activate.c | 11 +++++++++++
lib/activate/activate.h | 1 +
lib/metadata/lv_manip.c | 12 +++++++++++-
lib/metadata/mirror.c | 5 +++--
lib/report/report.c | 2 +-
6 files changed, 28 insertions(+), 5 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 0c7db4b..aa1a1c0 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -115,7 +115,7 @@ Version 2.02.99 -
Support use of option --yes for lvchange --persistent.
Fix memory leak on error path for pvcreate with invalid uuid.
Implement ref-counting for parents in python lib.
- Use lv_is_active() instead of lv_info() call.
+ Add lv_is_active_locally and use instead of most local lv_info calls.
Reduce some log_error messages to log_warn where we don't fail.
Remove python liblvm object. systemdir can only be changed using env var now.
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index 05cfb66..1174ce2 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -274,6 +274,10 @@ int lv_is_active(const struct logical_volume *lv)
{
return 0;
}
+int lv_is_active_locally(const struct logical_volume *lv)
+{
+ return 0;
+}
int lv_is_active_but_not_locally(const struct logical_volume *lv)
{
return 0;
@@ -1252,6 +1256,13 @@ int lv_is_active(const struct logical_volume *lv)
return _lv_is_active(lv, NULL, NULL);
}
+int lv_is_active_locally(const struct logical_volume *lv)
+{
+ int l;
+
+ return _lv_is_active(lv, &l, NULL) && l;
+}
+
int lv_is_active_but_not_locally(const struct logical_volume *lv)
{
int l;
diff --git a/lib/activate/activate.h b/lib/activate/activate.h
index f7c312f..e80115a 100644
--- a/lib/activate/activate.h
+++ b/lib/activate/activate.h
@@ -134,6 +134,7 @@ int lvs_in_vg_activated(const struct volume_group *vg);
int lvs_in_vg_opened(const struct volume_group *vg);
int lv_is_active(const struct logical_volume *lv);
+int lv_is_active_locally(const struct logical_volume *lv);
int lv_is_active_but_not_locally(const struct logical_volume *lv);
int lv_is_active_exclusive(const struct logical_volume *lv);
int lv_is_active_exclusive_locally(const struct logical_volume *lv);
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 42e0fab..ae86472 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -4394,6 +4394,8 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg, struct l
struct logical_volume *pool_lv;
struct lv_list *lvl;
const char *thin_name = NULL;
+ int origin_active = 0;
+ struct lvinfo info;
if (new_lv_name && find_lv_in_vg(vg, new_lv_name)) {
log_error("Logical volume \"%s\" already exists in "
@@ -4523,7 +4525,15 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg, struct l
log_warn("WARNING: See global/mirror_segtype_default in lvm.conf.");
}
- if (vg_is_clustered(vg) && lv_is_active(org) &&
+ if (!lv_info(cmd, org, 0, &info, 0, 0)) {
+ log_error("Check for existence of active snapshot "
+ "origin '%s' failed.", org->name);
+ return NULL;
+ }
+
+ origin_active = info.exists;
+
+ if (vg_is_clustered(vg) &&
!lv_is_active_exclusive_locally(org)) {
log_error("%s must be active exclusively to"
" create snapshot", org->name);
diff --git a/lib/metadata/mirror.c b/lib/metadata/mirror.c
index 18d0d33..b93d73c 100644
--- a/lib/metadata/mirror.c
+++ b/lib/metadata/mirror.c
@@ -298,12 +298,13 @@ static int _init_mirror_log(struct cmd_context *cmd,
/* If the LV is active, deactivate it first. */
if (lv_is_active(log_lv)) {
+ (void) deactivate_lv(cmd, log_lv);
/*
* FIXME: workaround to fail early
* Ensure that log is really deactivated because deactivate_lv
* on cluster do not fail if there is log_lv with different UUID.
*/
- if (!deactivate_lv(cmd, log_lv)) {
+ if (lv_is_active(log_lv)) {
log_error("Aborting. Unable to deactivate mirror log.");
goto revert_new_lv;
}
@@ -1707,7 +1708,7 @@ int remove_mirror_log(struct cmd_context *cmd,
}
/* Had disk log, switch to core. */
- if (lv_is_active(lv)) {
+ if (lv_is_active_locally(lv)) {
if (!lv_mirror_percent(cmd, lv, 0, &sync_percent,
NULL)) {
log_error("Unable to determine mirror sync status.");
diff --git a/lib/report/report.c b/lib/report/report.c
index 27c9708..d661596 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -866,7 +866,7 @@ static int _snpercent_disp(struct dm_report *rh __attribute__((unused)), struct
}
if ((!lv_is_cow(lv) && !lv_is_merging_origin(lv)) ||
- !lv_is_active(lv)) {
+ !lv_is_active_locally(lv)) {
*sortval = UINT64_C(0);
dm_report_field_set_value(field, "", sortval);
return 1;
10 years, 11 months
master - rephrasing: miscellaneous changes
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=2fbe1e6e00fc59...
Commit: 2fbe1e6e00fc59f54ae11c19d51f2d7fc8425b16
Parent: 2e4a66a7617de57cbf8462bdd1e555aef0b13c47
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Wed May 15 01:50:42 2013 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Wed May 15 01:50:42 2013 +0100
rephrasing: miscellaneous changes
Miscellaneous changes to messages, man pages, comments and WHATS_NEW.
---
WHATS_NEW | 24 +++++++++++++-----------
daemons/clvmd/clvmd-singlenode.c | 1 -
lib/activate/dev_manager.c | 5 +++--
lib/commands/toolcontext.c | 2 +-
man/lvconvert.8.in | 11 +++++++----
man/lvm.conf.5.in | 2 +-
man/vgcfgrestore.8.in | 6 +++---
7 files changed, 28 insertions(+), 23 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 8f19310..0c7db4b 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -71,8 +71,8 @@ Version 2.02.99 -
Check for failing id_read_format() in _pv_populate_lvmcache.
Fix memleak on error path for lvmetad's pv_found.
Unlock vg mutex in error path when lvmetad tries to lock_vg.
- Add check for key string duplication in config_make_nodes_v.
- Add check for created fid in _scan_file.
+ Detect key string duplication failure in config_make_nodes_v in libdaemon.
+ Detect fid creation failure in _scan_file in format_text.
Log output also to syslog when abort_on_internal_error is set.
Add LV snapshot support to liblvm and python-lvm.
Avoid a global lock in pvs when lvmetad is in use.
@@ -85,37 +85,39 @@ Version 2.02.99 -
Add lvm.conf option global/thin_disabled_features.
Add lvconvert support to swap thin pool metadata volume.
Implement internal function detach_pool_metadata_lv().
- Fix lvm2app to return all property sizes in bytes.
+ Fix lvm2app to return all property sizes in bytes (not sectors).
Recognize DM_DISABLE_UDEV environment variable for a complete fallback.
Do not verify udev operations if --noudevsync command option is used.
Fix lvm2app and return lvseg discards property as string.
- Allow forced vgcfgrestore of lvm2 metadata with thin volumes.
+ Allow vgcfgrestore of lvm2 metadata with thin volumes if --force is used.
Recognise Storage Class Memory (IBM S/390) devices in filter.
Recognise STEC skd devices in filter.
Recognise Violin Memory vtms devices in filter.
- Add lvm.conf thin pool defs thin_pool_{chunk_size|discards|zero}.
+ Add lvm.conf thin pool allocation settings thin_pool_{chunk_size|discards|zero}.
Support discards for non-power-of-2 thin pool chunks.
Automatically restore MISSING PVs with no MDAs.
- When no '-i' argument is given for RAID10, default to 2 stripes.
- Do not allow --splitmirrors on RAID10 logical volumes.
+ When no --stripes argument is given when creating a RAID10 volume, default to 2 stripes.
+ Do not allow lvconvert --splitmirrors on RAID10 logical volumes.
Skip mlocking [vectors] on arm architecture.
Support allocation of pool metadata with lvconvert command.
Move common functionality for thin lvcreate and lvconvert to toollib.
- Mirrored log is now fixed before its mirror when double-fault occurs.
+ Repair a mirrored log before the mirror itself when both fail.
Add python-lvm unit test case
Exit pvscan --cache immediately if cluster locking used or lvmetad not used.
Don't use lvmetad in lvm2-monitor.service ExecStop to avoid a systemd issue.
Remove dependency on fedora-storage-init.service in lvm2 systemd units.
Depend on lvm2-lvmetad.socket in lvm2-monitor.service systemd unit.
Hardcode use_lvmetad=0 if cluster locking used and issue a warning msg.
- Avoid reading mirrors with failed devices in its mirrored log.
- Avoid reading from mirrors that have failed devices if they block I/O.
+ Avoid LVM from trying to read a mirror that has a failed device in its mirrored log.
+ Relax ignore_suspended_devices to read from mirrors that don't have a device marked failed.
Change lvs heading Copy% to Cpy%Sync and print RAID4/5/6 sync% there too.
Fix clvmd support for option -d and properly use its argument.
Support use of option --yes for lvchange --persistent.
Fix memory leak on error path for pvcreate with invalid uuid.
+ Implement ref-counting for parents in python lib.
Use lv_is_active() instead of lv_info() call.
- Cleanup some log_error message and use log_warn instead.
+ Reduce some log_error messages to log_warn where we don't fail.
+ Remove python liblvm object. systemdir can only be changed using env var now.
Version 2.02.98 - 15th October 2012
===================================
diff --git a/daemons/clvmd/clvmd-singlenode.c b/daemons/clvmd/clvmd-singlenode.c
index a79100f..756c589 100644
--- a/daemons/clvmd/clvmd-singlenode.c
+++ b/daemons/clvmd/clvmd-singlenode.c
@@ -284,7 +284,6 @@ static int _cluster_send_message(const void *buf, int msglen,
static int _get_cluster_name(char *buf, int buflen)
{
- /* FIXME - cluster_ops API is broken - swap 1/0 */
return dm_strncpy(buf, "localcluster", buflen) ? 0 : 1;
}
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index 8e3cbb7..cd50fa0 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -138,7 +138,8 @@ static int _info_run(const char *name, const char *dlid, struct dm_info *info,
* @mirror_status_string
* @image_health: return for allocated copy of image health characters
* @log_device: return for 'dev_t' of log device
- * @log_health: NULL if corelog, otherwise alloc'ed log health char
+ * @log_health: NULL if corelog, otherwise dm_malloc'ed log health char which
+ * the caller must free
*
* This function takes the mirror status string, breaks it up and returns
* its components. For now, we only return the health characters. This
@@ -184,7 +185,7 @@ static int _parse_mirror_status(char *mirror_status_str,
return 0;
}
if (sscanf(log_args[1], "%d:%d", &major, &minor) != 2) {
- log_error("Parsing of log's major minor failed.");
+ log_error("Failed to parse log's device number from %s.", log_args[1]);
goto out;
}
*log_dev = MKDEV((dev_t)major, minor);
diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c
index 2ea877a..5c1719b 100644
--- a/lib/commands/toolcontext.c
+++ b/lib/commands/toolcontext.c
@@ -428,7 +428,7 @@ static int _process_config(struct cmd_context *cmd)
if (find_config_tree_int(cmd, global_locking_type_CFG) == 3 &&
find_config_tree_bool(cmd, global_use_lvmetad_CFG)) {
- log_warn("WARNING: configuration setting use_lvmetad overriden to 0 due to locking_type 3. "
+ log_warn("WARNING: configuration setting use_lvmetad overridden to 0 due to locking_type 3. "
"Clustered environment not supported by lvmetad yet.");
lvmetad_set_active(0);
} else
diff --git a/man/lvconvert.8.in b/man/lvconvert.8.in
index d7300d8..d4faf27 100644
--- a/man/lvconvert.8.in
+++ b/man/lvconvert.8.in
@@ -210,12 +210,15 @@ For thin pools the value must be between 64KiB and
1GiB and the default value starts with 64 and scales
up to fit the pool metadata size within 128MiB,
if the pool metadata size is not specified.
-Thin pool target version <1.4 requires the value to be a power of 2.
-The newer target version relaxes limitation to be a multiple of 64KiB.
-For target version <1.5 discard is not supported for non power of 2 values.
+The value must be a multiple of 64KiB.
+(Early kernel support until thin target version 1.4 required the value
+to be a power of 2. Discards weren't supported for non-power of 2 values
+until thin target version 1.5.)
+Default unit is in kilobytes.
.TP
.BR \-\-discards " {" \fIignore | \fInopassdown | \fIpassdown }
-Sets discards behavior for thin pool.
+Specifies whether or not discards will be processed by the thin layer in the
+kernel and passed down to the Physical Volume.
Default is \fIpassdown\fP.
.TP
.BR \-Z ", " \-\-zero " {" \fIy | \fIn }
diff --git a/man/lvm.conf.5.in b/man/lvm.conf.5.in
index 5592f34..f47cc17 100644
--- a/man/lvm.conf.5.in
+++ b/man/lvm.conf.5.in
@@ -104,7 +104,7 @@ otherwise it is accepted. As an example, to ignore /dev/cdrom you could use:
.br
\fBdevices { filter=["r|cdrom|"] }\fP
.IP
-\fBglobal_filter\fP \(em Since "filter" is often overriden from command line, it
+\fBglobal_filter\fP \(em Since "filter" might get overridden from the command line, it
is not suitable for system-wide device filtering (udev rules, lvmetad). To hide
devices from LVM-specific udev processing and/or from lvmetad, you need to set
global_filter. The syntax is the same as for normal "filter" above. Devices that
diff --git a/man/vgcfgrestore.8.in b/man/vgcfgrestore.8.in
index 7b8dd59..a5c8194 100644
--- a/man/vgcfgrestore.8.in
+++ b/man/vgcfgrestore.8.in
@@ -36,10 +36,10 @@ VolumeGroupName. Often this file has been created with \fBvgcfgbackup\fP.
.TP
.B \-\-force
To restore metadata with thin pool volumes, user currently
-needs to use this flag. The tool DOES NOT make any validation.
+needs to use this flag. The tool DOES NOT perform any validation.
.br
-WARNING: Restoring lvm2 metadata that are not matching thin pool
-kernel metadata may lead to the destruction of the pool content.
+WARNING: Restoring lvm2 metadata that does not exactly match the
+thin pool kernel metadata may lead to the destruction of the pool content.
Use with extreme caution.
.SH REPLACING PHYSICAL VOLUMES
\fBvgdisplay \-\-partial \-\-verbose\fP will show you the UUIDs and sizes of
10 years, 11 months
master - make: fix exported symbols regex for non-GNU sed
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=2e4a66a7617de5...
Commit: 2e4a66a7617de57cbf8462bdd1e555aef0b13c47
Parent: c6cf2ed7fd29d1860df511ac897367af646a6fb3
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Tue May 14 19:29:26 2013 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Tue May 14 19:29:26 2013 +0100
make: fix exported symbols regex for non-GNU sed
Remove a couple of incorrect backslashes from expressions used to
generate lists of exported symbols so it works with busybox sed.
[John Spencer]
---
WHATS_NEW | 1 +
make.tmpl.in | 2 +-
2 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 626a354..8f19310 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.99 -
===================================
+ Fix exported symbols regex for non-GNU busybox sed.
Accept --yes in all commands so test scripts can be simpler.
Fix alignment of PV data area if detected alignment less than 1 MB (2.02.74).
Fix memory resource leak in memlocking error path.
diff --git a/make.tmpl.in b/make.tmpl.in
index b33ddb3..df7453d 100644
--- a/make.tmpl.in
+++ b/make.tmpl.in
@@ -392,7 +392,7 @@ distclean: cleandir $(SUBDIRS.distclean)
( cat $(srcdir)/.exported_symbols; \
if test x$(EXPORTED_HEADER) != x; then \
$(CC) -E -P $(INCLUDES) $(DEFS) $(EXPORTED_HEADER) | \
- $(SED) -ne "/^typedef|}/!s/.*[ \*]\(\$(EXPORTED_FN_PREFIX)_[a-z0-9_]*\)(.*/\1/p"; \
+ $(SED) -ne "/^typedef|}/!s/.*[ *]\($(EXPORTED_FN_PREFIX)_[a-z0-9_]*\)(.*/\1/p"; \
fi \
) > $@
10 years, 11 months
master - commands: accept --yes globally
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c6cf2ed7fd29d1...
Commit: c6cf2ed7fd29d1860df511ac897367af646a6fb3
Parent: 8ad7865b421459553a05e220f992ba2d26bd60e6
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Tue May 14 18:45:37 2013 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Tue May 14 18:45:37 2013 +0100
commands: accept --yes globally
Accept --yes on all commands, even ones that don't today have prompts,
so that test scripts that don't care about interactive prompts no
longer need to deal with them.
But continue to mention --yes only in the command prototypes that
actually use it.
---
WHATS_NEW | 1 +
man/lvm.8.in | 4 ++++
tools/commands.h | 22 ++++++++++++----------
tools/lvmcmdline.c | 1 +
4 files changed, 18 insertions(+), 10 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 513210c..626a354 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.99 -
===================================
+ Accept --yes in all commands so test scripts can be simpler.
Fix alignment of PV data area if detected alignment less than 1 MB (2.02.74).
Fix memory resource leak in memlocking error path.
Fix premature DM version checking which caused useless mapper/control access.
diff --git a/man/lvm.8.in b/man/lvm.8.in
index d15e86b..37a60e4 100644
--- a/man/lvm.8.in
+++ b/man/lvm.8.in
@@ -171,6 +171,10 @@ Overrides config file setting.
Suppress output and log messages.
Overrides \fB\-d\fP and \fB\-v\fP.
.TP
+.BR \-\-yes
+Don't prompt for confirmation interactively but instead always assume the
+answer is 'yes'. Take great care if you use this!
+.TP
.BR \-t ", " \-\-test
Run in test mode. Commands will not update metadata.
This is implemented by disabling all metadata writing but nevertheless
diff --git a/tools/commands.h b/tools/commands.h
index ace077f..8950243 100644
--- a/tools/commands.h
+++ b/tools/commands.h
@@ -94,10 +94,10 @@ xx(lvchange,
"\t[--sysinit]\n"
"\t[-t|--test]\n"
"\t[-v|--verbose]\n"
- "\t[-y|--yes]\n"
"\t[--version]\n"
"\t[--writebehind BehindCount\n"
"\t[--writemostly PhysicalVolume]\n"
+ "\t[-y|--yes]\n"
"\t[-Z|--zero {y|n}]\n"
"\tLogicalVolume[Path] [LogicalVolume[Path]...]\n",
@@ -106,7 +106,7 @@ xx(lvchange,
major_ARG, minor_ARG, monitor_ARG, noudevsync_ARG, partial_ARG,
permission_ARG, persistent_ARG, poll_ARG, readahead_ARG, resync_ARG,
refresh_ARG, addtag_ARG, deltag_ARG, syncaction_ARG, sysinit_ARG, test_ARG,
- yes_ARG, writebehind_ARG, writemostly_ARG, zero_ARG)
+ writebehind_ARG, writemostly_ARG, zero_ARG)
xx(lvconvert,
"Change logical volume layout",
@@ -174,7 +174,7 @@ xx(lvconvert,
trackchanges_ARG, type_ARG, stripes_long_ARG, stripesize_ARG, test_ARG,
chunksize_ARG, discards_ARG, poolmetadata_ARG, poolmetadatasize_ARG,
originname_ARG, thin_ARG, thinpool_ARG,
- use_policies_ARG, yes_ARG, force_ARG, zero_ARG)
+ use_policies_ARG, force_ARG, zero_ARG)
xx(lvcreate,
"Create a logical volume",
@@ -380,12 +380,12 @@ xx(lvreduce,
"\t[-r|--resizefs]\n"
"\t[-t|--test]\n"
"\t[-v|--verbose]\n"
- "\t[-y|--yes]\n"
"\t[--version]" "\n"
+ "\t[-y|--yes]\n"
"\tLogicalVolume[Path]\n",
autobackup_ARG, force_ARG, extents_ARG, nofsck_ARG, noudevsync_ARG,
- resizefs_ARG, size_ARG, test_ARG, yes_ARG)
+ resizefs_ARG, size_ARG, test_ARG)
xx(lvremove,
"Remove logical volume(s) from the system",
@@ -568,7 +568,7 @@ xx(pvcreate,
force_ARG, test_ARG, labelsector_ARG, metadatatype_ARG,
metadatacopies_ARG, metadatasize_ARG, metadataignore_ARG,
norestorefile_ARG, physicalvolumesize_ARG, pvmetadatacopies_ARG,
- restorefile_ARG, uuidstr_ARG, yes_ARG, zero_ARG)
+ restorefile_ARG, uuidstr_ARG, zero_ARG)
xx(pvdata,
"Display the on-disk metadata for physical volume(s)",
@@ -658,11 +658,11 @@ xx(pvremove,
"\t[-h|-?|--help] " "\n"
"\t[-t|--test] " "\n"
"\t[-v|--verbose] " "\n"
- "\t[-y|--yes]" "\n"
"\t[--version] " "\n"
+ "\t[-y|--yes]" "\n"
"\tPhysicalVolume [PhysicalVolume...]\n",
- force_ARG, test_ARG, yes_ARG)
+ force_ARG, test_ARG)
xx(pvs,
"Display information about physical volumes",
@@ -838,12 +838,13 @@ xx(vgcreate,
"\t[-t|--test] " "\n"
"\t[-v|--verbose]" "\n"
"\t[--version] " "\n"
+ "\t[-y|--yes]" "\n"
"\t[ PHYSICAL DEVICE OPTIONS ] " "\n"
"\tVolumeGroupName PhysicalDevicePath [PhysicalDevicePath...]\n",
addtag_ARG, alloc_ARG, autobackup_ARG, clustered_ARG, maxlogicalvolumes_ARG,
maxphysicalvolumes_ARG, metadatatype_ARG, physicalextentsize_ARG, test_ARG,
- force_ARG, yes_ARG, zero_ARG, labelsector_ARG, metadatasize_ARG,
+ force_ARG, zero_ARG, labelsector_ARG, metadatasize_ARG,
pvmetadatacopies_ARG, metadatacopies_ARG, vgmetadatacopies_ARG,
dataalignment_ARG, dataalignmentoffset_ARG)
@@ -908,11 +909,12 @@ xx(vgextend,
"\t[-t|--test]\n"
"\t[-v|--verbose]\n"
"\t[--version]" "\n"
+ "\t[-y|--yes]\n"
"\t[ PHYSICAL DEVICE OPTIONS ] " "\n"
"\tVolumeGroupName PhysicalDevicePath [PhysicalDevicePath...]\n",
autobackup_ARG, test_ARG,
- force_ARG, yes_ARG, zero_ARG, labelsector_ARG, metadatatype_ARG,
+ force_ARG, zero_ARG, labelsector_ARG, metadatatype_ARG,
metadatasize_ARG, pvmetadatacopies_ARG, metadatacopies_ARG,
metadataignore_ARG, dataalignment_ARG, dataalignmentoffset_ARG,
restoremissing_ARG)
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index c03e9ef..0b64ed8 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -615,6 +615,7 @@ void lvm_register_commands(void)
driverloaded_ARG, \
debug_ARG, help_ARG, help2_ARG, \
version_ARG, verbose_ARG, \
+ yes_ARG, \
quiet_ARG, config_ARG, -1);
#include "commands.h"
#undef xx
10 years, 11 months
master - Fix alignment of PV data area if detected alignment less than 1 MB
by Mike Snitzer
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=8ad7865b421459...
Commit: 8ad7865b421459553a05e220f992ba2d26bd60e6
Parent: 6fc67f5509fda25a91536fbeeb7099f8327ff3d8
Author: Mike Snitzer <snitzer(a)redhat.com>
AuthorDate: Mon May 13 15:56:47 2013 -0400
Committer: Mike Snitzer <snitzer(a)redhat.com>
CommitterDate: Mon May 13 15:56:47 2013 -0400
Fix alignment of PV data area if detected alignment less than 1 MB
This fixes a long standing regression since LVM2 2.02.74 (commit 4efb1d9c,
"Update heuristic used for default and detected data alignment.")
The default PE alignment could be used (via MAX()) even if it was
determined that the device's MD stripe width, or minimal_io_size or
optimal_io_size were not factors of the default PE alignment (either 64K
or the newer default of 1MB, etc). This bug would manifest if the
default PE alignment was larger than the overriding hint that the
device provided (e.g. default of 1MB vs optimal_io_size of 768K).
Signed-off-by: Mike Snitzer <snitzer(a)redhat.com>
---
WHATS_NEW | 1 +
lib/metadata/metadata.c | 6 +++---
test/shell/topology-support.sh | 27 +++++++++++++++++++++++++++
3 files changed, 31 insertions(+), 3 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 11d3e6f..513210c 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.99 -
===================================
+ Fix alignment of PV data area if detected alignment less than 1 MB (2.02.74).
Fix memory resource leak in memlocking error path.
Fix premature DM version checking which caused useless mapper/control access.
Add "active" LV reporting field to show activation state.
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index bde1cb0..357e849 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -86,7 +86,7 @@ unsigned long set_pe_align(struct physical_volume *pv, unsigned long data_alignm
if (find_config_tree_bool(pv->fmt->cmd, devices_md_chunk_alignment_CFG)) {
temp_pe_align = dev_md_stripe_width(pv->fmt->cmd->sysfs_dir, pv->dev);
if (_alignment_overrides_default(temp_pe_align, default_pe_align))
- pv->pe_align = MAX(pv->pe_align, temp_pe_align);
+ pv->pe_align = temp_pe_align;
}
/*
@@ -99,11 +99,11 @@ unsigned long set_pe_align(struct physical_volume *pv, unsigned long data_alignm
if (find_config_tree_bool(pv->fmt->cmd, devices_data_alignment_detection_CFG)) {
temp_pe_align = dev_minimum_io_size(pv->fmt->cmd->sysfs_dir, pv->dev);
if (_alignment_overrides_default(temp_pe_align, default_pe_align))
- pv->pe_align = MAX(pv->pe_align, temp_pe_align);
+ pv->pe_align = temp_pe_align;
temp_pe_align = dev_optimal_io_size(pv->fmt->cmd->sysfs_dir, pv->dev);
if (_alignment_overrides_default(temp_pe_align, default_pe_align))
- pv->pe_align = MAX(pv->pe_align, temp_pe_align);
+ pv->pe_align = temp_pe_align;
}
out:
diff --git a/test/shell/topology-support.sh b/test/shell/topology-support.sh
index e952dc0..df73c6a 100644
--- a/test/shell/topology-support.sh
+++ b/test/shell/topology-support.sh
@@ -23,6 +23,16 @@ check_logical_block_size() {
fi
}
+check_optimal_io_size() {
+ local DEV_=$(cat SCSI_DEBUG_DEV)
+ # Verify optimal_io_size
+ SYSFS_OPTIMAL_IO_SIZE=$(echo /sys/block/$(basename $DEV_)/queue/optimal_io_size)
+ if [ -f "$SYSFS_OPTIMAL_IO_SIZE" ] ; then
+ ACTUAL_OPTIMAL_IO_SIZE=$(cat $SYSFS_OPTIMAL_IO_SIZE)
+ test $ACTUAL_OPTIMAL_IO_SIZE = $1
+ fi
+}
+
lvdev_() {
echo "$DM_DEV_DIR/$1/$2"
}
@@ -103,3 +113,20 @@ aux prepare_pvs $NUM_DEVS $PER_DEV_SIZE
vgcreate -c n $vg $(cat DEVICES)
test_snapshot_mount
vgremove $vg
+
+aux cleanup_scsi_debug_dev
+
+# ---------------------------------------------
+# Create "enterprise-class" 512 drive w/ HW raid stripe_size = 768K
+# (logical_block_size=512, physical_block_size=512, alignment_offset=0):
+# - tests case where optimal_io_size=768k < default PE alignment=1MB
+LOGICAL_BLOCK_SIZE=512
+aux prepare_scsi_debug_dev $DEV_SIZE \
+ sector_size=$LOGICAL_BLOCK_SIZE opt_blks=1536
+check_logical_block_size $LOGICAL_BLOCK_SIZE
+check_optimal_io_size 786432
+
+aux prepare_pvs 1 $PER_DEV_SIZE
+check pv_field $(cat DEVICES) pe_start 768.00k
+
+aux cleanup_scsi_debug_dev
10 years, 11 months
master - thin: limited support for -l%FREE allocation
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=6fc67f5509fda2...
Commit: 6fc67f5509fda25a91536fbeeb7099f8327ff3d8
Parent: 55fe07ad98315d9471a86affd0680749e349a0a6
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon May 13 13:03:04 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon May 13 13:13:22 2013 +0200
thin: limited support for -l%FREE allocation
This is just a temporary fix to support allocation of -l%FREE.
The number of free extent serves to calculate estimated metadata
size. This value is then substracted twice to keep some
free space for recover.
---
tools/lvcreate.c | 8 ++++++++
1 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/tools/lvcreate.c b/tools/lvcreate.c
index df05cbb..7580155 100644
--- a/tools/lvcreate.c
+++ b/tools/lvcreate.c
@@ -321,6 +321,14 @@ static int _update_extents_params(struct volume_group *vg,
if (!(lp->poolmetadataextents =
extents_from_size(vg->cmd, lp->poolmetadatasize, vg->extent_size)))
return_0;
+ if (lcp->percent == PERCENT_FREE) {
+ if (lp->extents <= (2 * lp->poolmetadataextents)) {
+ log_error("Not enough space for thin pool creation.");
+ return 0;
+ }
+ /* FIXME: persistent hidden space in VG wanted */
+ lp->extents -= (2 * lp->poolmetadataextents);
+ }
}
return 1;
10 years, 11 months
master - mm: fix leak in fail path
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=55fe07ad98315d...
Commit: 55fe07ad98315d9471a86affd0680749e349a0a6
Parent: e926f22457774596d6051aa9e8ee22b884f2299d
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon May 13 12:59:38 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon May 13 13:13:20 2013 +0200
mm: fix leak in fail path
If the dm_realloc would fail, the already allocate _maps_buffer
memory would have been lost (overwritten with NULL).
Fix this by using temporary line buffer.
Also add a minor cleanup to set end of buffer to '\0',
only when we really know the file size fits the preallocated buffer.
---
WHATS_NEW | 1 +
lib/mm/memlock.c | 19 +++++++++++--------
2 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 2cdd0cd..11d3e6f 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.99 -
===================================
+ Fix memory resource leak in memlocking error path.
Fix premature DM version checking which caused useless mapper/control access.
Add "active" LV reporting field to show activation state.
Add "monitor" segment reporting field to show dmevent monitoring status.
diff --git a/lib/mm/memlock.c b/lib/mm/memlock.c
index 098de9e..08876b0 100644
--- a/lib/mm/memlock.c
+++ b/lib/mm/memlock.c
@@ -270,23 +270,26 @@ static int _memlock_maps(struct cmd_context *cmd, lvmlock_t lock, size_t *mstats
if (!_maps_buffer || len >= _maps_len) {
if (_maps_buffer)
_maps_len *= 2;
- if (!(_maps_buffer = dm_realloc(_maps_buffer, _maps_len))) {
- log_error("Allocation of maps buffer failed");
+ if (!(line = dm_realloc(_maps_buffer, _maps_len))) {
+ log_error("Allocation of maps buffer failed.");
return 0;
}
+ _maps_buffer = line;
}
if (lseek(_maps_fd, 0, SEEK_SET))
log_sys_error("lseek", _procselfmaps);
for (len = 0 ; len < _maps_len; len += n) {
- if (!(n = read(_maps_fd, _maps_buffer + len, _maps_len - len))) {
- _maps_buffer[len] = '\0';
+ if (!(n = read(_maps_fd, _maps_buffer + len, _maps_len - len)))
break; /* EOF */
+ if (n == -1) {
+ log_sys_error("read", _procselfmaps);
+ return 0;
}
- if (n == -1)
- return_0;
}
- if (len < _maps_len) /* fits in buffer */
+ if (len < _maps_len) { /* fits in buffer */
+ _maps_buffer[len] = '\0';
break;
+ }
}
line = _maps_buffer;
@@ -315,7 +318,7 @@ static void _lock_mem(struct cmd_context *cmd)
* so even future adition of thread which may not even use lvm lib
* will not block memory locked thread
* Note: assuming _memlock_count_daemon is updated before _memlock_count
- */
+ */
_use_mlockall = _memlock_count_daemon ? 1 :
find_config_tree_bool(cmd, activation_use_mlockall_CFG);
10 years, 11 months
master - man: updates
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e926f224577745...
Commit: e926f22457774596d6051aa9e8ee22b884f2299d
Parent: 44071331138a7ca3a7d775d8a091933404ee7509
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sun May 5 21:38:44 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon May 13 13:09:30 2013 +0200
man: updates
---
man/dmsetup.8.in | 35 ++++++++++++++++++-----------------
man/lvcreate.8.in | 8 +++++---
man/lvdisplay.8.in | 1 +
man/lvmetad.8.in | 8 ++++++--
man/pvdisplay.8.in | 1 +
5 files changed, 31 insertions(+), 22 deletions(-)
diff --git a/man/dmsetup.8.in b/man/dmsetup.8.in
index a4eac1e..93621a5 100644
--- a/man/dmsetup.8.in
+++ b/man/dmsetup.8.in
@@ -54,6 +54,7 @@ dmsetup \- low level logical volume management
.RB [ \-\-exec
.IR command ]
.RB [ \-\-tree ]
+.RS
.RB [ \-o
.IR options ]
.RE
@@ -279,7 +280,7 @@ Destroys the table in the inactive table slot for device_name.
.br
Creates a device with the given name.
If table_file or <table> is supplied, the table is loaded and made live.
-Otherwise a table is read from standard input unless \-\-notable is used.
+Otherwise a table is read from standard input unless \fB\-\-notable\fP is used.
The optional uuid can be used in place of
device_name in subsequent dmsetup commands.
If successful a device will appear as
@@ -357,7 +358,7 @@ each device. The device name is appended to the supplied command.
Device names on output can be customised by following options: devno (major
and minor pair, used by default), blkdevname (block device name),
devname (map name for device-mapper devices, equal to blkdevname otherwise).
---tree displays dependencies between devices as a tree.
+\fB\-\-tree\fP displays dependencies between devices as a tree.
It accepts a comma-separate list of options.
Some specify the information displayed against each node:
device/nodevice; blkdevname; active, open, rw, uuid.
@@ -404,11 +405,11 @@ driver, adding, changing or removing nodes as necessary.
Ensure existing device-mapper device name and UUID is in the correct mangled
form containing only whitelisted characters (supported by udev) and do
a rename if necessary. Any character not on the whitelist will be mangled
-based on the --manglename setting. Automatic rename works only for device
+based on the \fB\-\-manglename\fP setting. Automatic rename works only for device
names and not for device UUIDs because the kernel does not allow changing
the UUID of active devices. Any incorrect UUIDs are reported only and they
must be manually corrected by deactivating the device first and then
-reactivating it with proper mangling mode used (see also --manglename).
+reactivating it with proper mangling mode used (see also \fB\-\-manglename\fP).
.br
.HP
.B remove
@@ -483,12 +484,12 @@ Default subsystem is LVM.
.B status
.RB [ \-\-target
.IR target_type ]
-.RB [ \-\-noflush ]
+.RB [ \-\-\noflush ]
.RI [ device_name ]
.br
Outputs status information for each of the device's targets.
With \-\-target, only information relating to the specified target type
-any is displayed. With \-\-noflush, the thin target (from version 1.3.0)
+any is displayed. With \fB\-\-noflush\fP, the thin target (from version 1.3.0)
doesn't commit any outstanding changes to disk before reporting its statistics.
.br
.HP
@@ -501,9 +502,9 @@ Suspends a device. Any I/O that has already been mapped by the device
but has not yet completed will be flushed. Any further I/O to that
device will be postponed for as long as the device is suspended.
If there's a filesystem on the device which supports the operation,
-an attempt will be made to sync it first unless \-\-nolockfs is specified.
+an attempt will be made to sync it first unless \fB\-\-nolockfs\fP is specified.
Some targets such as recent (October 2006) versions of multipath may support
-the \-\-noflush option. This lets outstanding I/O that has not yet reached the
+the \fB\-\-noflush\fP option. This lets outstanding I/O that has not yet reached the
device to remain unflushed.
.br
.TP
@@ -515,10 +516,10 @@ device to remain unflushed.
.br
Outputs the current table for the device in a format that can be fed
back in using the create or load commands.
-With \-\-target, only information relating to the specified target type
+With \fB\-\-target\fP, only information relating to the specified target type
is displayed.
Encryption keys are suppressed in the table output for the crypt
-target unless the \-\-showkeys parameter is supplied.
+target unless the \fB\-\-showkeys\fP parameter is supplied.
.br
.TP
.B targets
@@ -552,8 +553,8 @@ The output is a cookie value. Normally we don't need to create cookies since
dmsetup creates and destroys them for each action automatically. However, we can
generate one explicitly to group several actions together and use only one
cookie instead. We can define a cookie to use for each relevant command by using
-\-\-udevcookie option. Alternatively, we can export this value into the environment
-of the dmsetup process as DM_UDEV_COOKIE variable and it will be used automatically
+\fB\-\-udevcookie\fP option. Alternatively, we can export this value into the environment
+of the dmsetup process as \fBDM_UDEV_COOKIE\fP variable and it will be used automatically
with all subsequent commands until it is unset.
Invoking this command will create system-wide semaphore that needs to be cleaned
up explicitly by calling udevreleasecookie command.
@@ -576,7 +577,7 @@ always reported as DM_SUBSYSTEM_UDEV_FLAG<flag_position>='1'. There are
.br
Waits for all pending udev processing bound to given cookie value and clean up
the cookie with underlying semaphore. If the cookie is not given directly,
-the command will try to use a value defined by DM_UDEV_COOKIE environment variable.
+the command will try to use a value defined by \fBDM_UDEV_COOKIE\fP environment variable.
.br
.TP
.B version
@@ -590,10 +591,10 @@ Outputs version information.
.RI [ event_nr ]
.br
Sleeps until the event counter for device_name exceeds event_nr.
-Use \-v to see the event number returned.
+Use \fB\-v\fP to see the event number returned.
To wait until the next event is triggered, use \fBinfo\fP to find
the last event number.
-With \-\-noflush, the thin target (from version 1.3.0) doesn't commit
+With \fB\-\-noflush\fP, the thin target (from version 1.3.0) doesn't commit
any outstanding changes to disk before reporting its statistics.
.SH TABLE FORMAT
Each line of the table specifies a single target and is of the form:
@@ -637,7 +638,7 @@ for creating devices with holes in them.
.br
Returns blocks of zeroes on reads. Any data written is discarded silently.
This is a block-device equivalent of the /dev/zero character-device data sink
-described in \fBnull(4)\fP.
+described in \fBnull\fP(4).
.P
More complex targets include:
.TP
@@ -708,7 +709,7 @@ A cookie to use for all relevant commands to synchronize with udev processing.
It is an alternative to using \-\-udevcookie option.
.SH AUTHORS
-Original version: Joe Thornber (thornber(a)sistina.com)
+Original version: Joe Thornber (thornber(a)redhat.com)
.SH SEE ALSO
Device-mapper resource page: http://sources.redhat.com/dm/
diff --git a/man/lvcreate.8.in b/man/lvcreate.8.in
index 47c0a72..92cf1e7 100644
--- a/man/lvcreate.8.in
+++ b/man/lvcreate.8.in
@@ -128,8 +128,9 @@ activated only if it matches an item in the
set in \fBlvm.conf\fP(5).
For autoactivated logical volumes, \fB\-\-zero\fP \fIn\fP is always assumed
and it can't be overridden. If the clustered locking is enabled,
-\fB\-a\fIey\fR will activate exclusively on one node and \fB\-a\fIly\fR will
-activate only on the local node.
+\fB\-a\fIey\fR will activate exclusively on one node and
+.IR \fB\-a { a | l } y
+will activate only on the local node.
.TP
.BR \-c ", " \-\-chunksize " " \fIChunkSize [ \fIbBsSkKmMgG ]
Gives the size of chunk for snapshot and thin pool logical volumes.
@@ -189,7 +190,8 @@ suffix \fI%ORIGIN\fR.
.TP
.IR \fB\-L ", " \fB\-\-size " " LogicalVolumeSize [ bBsSkKmMgGtTpPeE ]
Gives the size to allocate for the new logical volume.
-A size suffix of \fIK\fR for kilobytes, \fIM\fR for megabytes,
+A size suffix of \fIB\fR for bytes, \fIS\fR for sectors as 512 bytes,
+\fIK\fR for kilobytes, \fIM\fR for megabytes,
\fIG\fR for gigabytes, \fIT\fR for terabytes, \fIP\fR for petabytes
or \fIE\fR for exabytes is optional.
.br
diff --git a/man/lvdisplay.8.in b/man/lvdisplay.8.in
index 9999849..84f21d3 100644
--- a/man/lvdisplay.8.in
+++ b/man/lvdisplay.8.in
@@ -112,5 +112,6 @@ original logical volume it is associated with:
.SH SEE ALSO
.BR lvm (8),
.BR lvcreate (8),
+.BR lvs (8),
.BR lvscan (8),
.BR pvs (8)
diff --git a/man/lvmetad.8.in b/man/lvmetad.8.in
index ef1096d..7110877 100644
--- a/man/lvmetad.8.in
+++ b/man/lvmetad.8.in
@@ -41,10 +41,14 @@ Show help information.
.B \-s \fIpath
Path to the socket file to use. The option overrides both the built-in default
(#DEFAULT_RUN_DIR#/lvmetad.socket) and the environment variable
-LVM_LVMETAD_SOCKET.
+\fBLVM_LVMETAD_SOCKET\fP.
.TP
.B \-V
-Show version of dmeventd.
+Display the version of lvmetad daemon.
+.SH ENVIRONMENT VARIABLES
+.TP
+.B LVM_LVMETAD_SOCKET
+override path for socket file to use.
.SH SEE ALSO
.BR lvm (8),
diff --git a/man/pvdisplay.8.in b/man/pvdisplay.8.in
index 342c45b..6a8a0d0 100644
--- a/man/pvdisplay.8.in
+++ b/man/pvdisplay.8.in
@@ -89,6 +89,7 @@ Display output in columns, the equivalent of \fBpvs\fP(8). See
\fBpvdisplay\fP.
.SH SEE ALSO
.BR lvm (8),
+.BR pvs (8),
.BR pvcreate (8),
.BR lvcreate (8),
.BR vgcreate (8)
10 years, 11 months
master - toolcontext: check dm version lazily for udev_fallback setting
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=44071331138a7c...
Commit: 44071331138a7ca3a7d775d8a091933404ee7509
Parent: 3d0cb0611e5e68fc4d865102f8339552a907ff4b
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Mon May 13 11:46:24 2013 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Mon May 13 11:53:53 2013 +0200
toolcontext: check dm version lazily for udev_fallback setting
Setting the cmd->default_settings.udev_fallback also requires DM
driver version check. However, this caused useless mapper/control
access with ioctl if not needed actually. For example if we're not
using activation code, we don't need to know the udev_fallback as
there's no node and symlink processing.
For example, this premature mapper/control access caused problems
when using lvm2app even when no activation happens - there are
situations in which we don't need to use mapper/control, but still
need some of the lvm2app functionality. This is also the case for
lvm2-activation systemd generator which just needs to look at the
lvm2 configuration, but it shouldn't touch mapper/control.
---
WHATS_NEW | 1 +
lib/activate/dev_manager.c | 57 +++++++++++++++++++++++++++++++++++++++++--
lib/commands/toolcontext.c | 46 ++++++-----------------------------
3 files changed, 63 insertions(+), 41 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index bad183c..2cdd0cd 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.99 -
===================================
+ Fix premature DM version checking which caused useless mapper/control access.
Add "active" LV reporting field to show activation state.
Add "monitor" segment reporting field to show dmevent monitoring status.
Document lvextend --use-policies option in man.
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index 150bb35..8e3cbb7 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -1309,6 +1309,57 @@ int dev_manager_mknodes(const struct logical_volume *lv)
return r;
}
+#ifdef UDEV_SYNC_SUPPORT
+/*
+ * Until the DM_UEVENT_GENERATED_FLAG was introduced in kernel patch
+ * 856a6f1dbd8940e72755af145ebcd806408ecedd
+ * some operations could not be performed by udev, requiring our fallback code.
+ */
+static int _dm_driver_has_stable_udev_support(void)
+{
+ char vsn[80];
+ unsigned maj, min, patchlevel;
+
+ return driver_version(vsn, sizeof(vsn)) &&
+ (sscanf(vsn, "%u.%u.%u", &maj, &min, &patchlevel) == 3) &&
+ (maj == 4 ? min >= 18 : maj > 4);
+}
+
+static int _check_udev_fallback(struct cmd_context *cmd)
+{
+ struct config_info *settings = &cmd->current_settings;
+
+ if (settings->udev_fallback != -1)
+ goto out;
+
+ /*
+ * Use udev fallback automatically in case udev
+ * is disabled via DM_DISABLE_UDEV environment
+ * variable or udev rules are switched off.
+ */
+ settings->udev_fallback = !settings->udev_rules ? 1 :
+ find_config_tree_bool(cmd, activation_verify_udev_operations_CFG);
+
+ /* Do not rely fully on udev if the udev support is known to be incomplete. */
+ if (!settings->udev_fallback && !_dm_driver_has_stable_udev_support()) {
+ log_very_verbose("Kernel driver has incomplete udev support so "
+ "LVM will check and perform some operations itself.");
+ settings->udev_fallback = 1;
+ }
+out:
+ return settings->udev_fallback;
+}
+
+#else /* UDEV_SYNC_SUPPORT */
+
+static int _check_udev_fallback(struct cmd_context *cmd)
+{
+ /* We must use old node/symlink creation code if not compiled with udev support at all! */
+ return cmd->current_settings.udev_fallback = 1;
+}
+
+#endif /* UDEV_SYNC_SUPPORT */
+
static uint16_t _get_udev_flags(struct dev_manager *dm, struct logical_volume *lv,
const char *layer)
{
@@ -1318,7 +1369,7 @@ static uint16_t _get_udev_flags(struct dev_manager *dm, struct logical_volume *l
* Instruct also libdevmapper to disable udev
* fallback in accordance to LVM2 settings.
*/
- if (!dm->cmd->current_settings.udev_fallback)
+ if (!_check_udev_fallback(dm->cmd))
udev_flags |= DM_UDEV_DISABLE_LIBRARY_FALLBACK;
/*
@@ -2399,7 +2450,7 @@ static int _create_lv_symlinks(struct dev_manager *dm, struct dm_tree_node *root
int r = 1;
/* Nothing to do if udev fallback is disabled. */
- if (!dm->cmd->current_settings.udev_fallback) {
+ if (!_check_udev_fallback(dm->cmd)) {
fs_set_create();
return 1;
}
@@ -2447,7 +2498,7 @@ static int _remove_lv_symlinks(struct dev_manager *dm, struct dm_tree_node *root
int r = 1;
/* Nothing to do if udev fallback is disabled. */
- if (!dm->cmd->current_settings.udev_fallback)
+ if (!_check_udev_fallback(dm->cmd))
return 1;
while ((child = dm_tree_next_child(&handle, root, 0))) {
diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c
index 8f06285..2ea877a 100644
--- a/lib/commands/toolcontext.c
+++ b/lib/commands/toolcontext.c
@@ -262,23 +262,6 @@ static int _check_disable_udev(const char *msg) {
return 0;
}
-#ifdef UDEV_SYNC_SUPPORT
-/*
- * Until the DM_UEVENT_GENERATED_FLAG was introduced in kernel patch
- * 856a6f1dbd8940e72755af145ebcd806408ecedd
- * some operations could not be performed by udev, requiring our fallback code.
- */
-static int _dm_driver_has_stable_udev_support(void)
-{
- char vsn[80];
- unsigned maj, min, patchlevel;
-
- return driver_version(vsn, sizeof(vsn)) &&
- (sscanf(vsn, "%u.%u.%u", &maj, &min, &patchlevel) == 3) &&
- (maj == 4 ? min >= 18 : maj > 4);
-}
-#endif
-
static int _process_config(struct cmd_context *cmd)
{
mode_t old_umask;
@@ -372,30 +355,17 @@ static int _process_config(struct cmd_context *cmd)
cmd->default_settings.udev_sync = udev_disabled ? 0 :
find_config_tree_bool(cmd, activation_udev_sync_CFG);
- init_retry_deactivation(find_config_tree_bool(cmd, activation_retry_deactivation_CFG));
-
- init_activation_checks(find_config_tree_bool(cmd, activation_checks_CFG));
-
-#ifdef UDEV_SYNC_SUPPORT
/*
- * Use udev fallback automatically in case udev
- * is disabled via DM_DISABLE_UDEV environment
- * variable or udev rules are switched off.
+ * Set udev_fallback lazily on first use since it requires
+ * checking DM driver version which is an extra ioctl!
+ * This also prevents unnecessary use of mapper/control.
+ * If udev is disabled globally, set fallback mode immediately.
*/
- cmd->default_settings.udev_fallback = !cmd->default_settings.udev_rules || udev_disabled ? 1 :
- find_config_tree_bool(cmd, activation_verify_udev_operations_CFG);
+ cmd->default_settings.udev_fallback = udev_disabled ? 1 : -1;
- /* Do not rely fully on udev if the udev support is known to be incomplete. */
- if (!cmd->default_settings.udev_fallback && !_dm_driver_has_stable_udev_support()) {
- log_very_verbose("Kernel driver has incomplete udev support so "
- "LVM will check and perform some operations itself.");
- cmd->default_settings.udev_fallback = 1;
- }
+ init_retry_deactivation(find_config_tree_bool(cmd, activation_retry_deactivation_CFG));
-#else
- /* We must use old node/symlink creation code if not compiled with udev support at all! */
- cmd->default_settings.udev_fallback = 1;
-#endif
+ init_activation_checks(find_config_tree_bool(cmd, activation_checks_CFG));
cmd->use_linear_target = find_config_tree_bool(cmd, activation_use_linear_target_CFG);
10 years, 11 months