master - libdm: simplify stats nr_areas calculation (Coverity)
by Bryn Reeves
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=856f9cced83078...
Commit: 856f9cced83078a90ca2291eff0758d42775f195
Parent: ec87e88c5264511576341286b474b453a15594ba
Author: Bryn M. Reeves <bmr(a)redhat.com>
AuthorDate: Mon Aug 10 19:18:16 2015 +0100
Committer: Bryn M. Reeves <bmr(a)redhat.com>
CommitterDate: Mon Aug 10 20:26:07 2015 +0100
libdm: simplify stats nr_areas calculation (Coverity)
Remove an unneccessary conditional operator and simplify the logic
in _nr_areas:
libdm/libdm-stats.c: 501 in _nr_areas() - Control flow issues (DEADCODE)
---
libdm/libdm-stats.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/libdm/libdm-stats.c b/libdm/libdm-stats.c
index a672e05..192326e 100644
--- a/libdm/libdm-stats.c
+++ b/libdm/libdm-stats.c
@@ -503,8 +503,7 @@ static uint64_t _nr_areas(uint64_t len, uint64_t step)
* treat the entire region as a single area. Any partial area at the
* end of the region is treated as an additional complete area.
*/
- return (len && step)
- ? (len / (step ? step : len)) + !!(len % step) : 0;
+ return (len / (step ? : len)) + !!(len % step);
}
static uint64_t _nr_areas_region(struct dm_stats_region *region)
8 years, 8 months
master - dmsetup: don't free handle if dm_stats_create fails (Coverity)
by Bryn Reeves
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=ec87e88c526451...
Commit: ec87e88c5264511576341286b474b453a15594ba
Parent: f9f5aac123d2244daeff92a692a03da3fea6bd74
Author: Bryn M. Reeves <bmr(a)redhat.com>
AuthorDate: Mon Aug 10 19:05:10 2015 +0100
Committer: Bryn M. Reeves <bmr(a)redhat.com>
CommitterDate: Mon Aug 10 20:25:59 2015 +0100
dmsetup: don't free handle if dm_stats_create fails (Coverity)
The error path of _stats_list frees the task and stats objects:
don't try to branch to it before they have been allocated.
tools/dmsetup.c: 4589 in _stats_help() - Null pointer dereferences (FORWARD_NULL)
---
tools/dmsetup.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tools/dmsetup.c b/tools/dmsetup.c
index 2ee432b..ed3cbd1 100644
--- a/tools/dmsetup.c
+++ b/tools/dmsetup.c
@@ -4253,7 +4253,7 @@ static int _stats_list(CMD_ARGS)
return 1;
if (!(dms = dm_stats_create(DM_STATS_PROGRAM_ID)))
- goto_out;
+ return_0;
if (!_bind_stats_device(dms, name))
goto_out;
8 years, 8 months
master - libdm: fix stats handle leak in dm_stats_create (Coverity)
by Bryn Reeves
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f9f5aac123d224...
Commit: f9f5aac123d2244daeff92a692a03da3fea6bd74
Parent: 1134de3c89c5a07699365031d0cb88383e365929
Author: Bryn M. Reeves <bmr(a)redhat.com>
AuthorDate: Mon Aug 10 10:15:22 2015 +0100
Committer: Bryn M. Reeves <bmr(a)redhat.com>
CommitterDate: Mon Aug 10 20:20:30 2015 +0100
libdm: fix stats handle leak in dm_stats_create (Coverity)
Make sure the newly created handle is freed if we are unable to
also create the pool for it.
tools/dmsetup.c: 4255 in _stats_list() - Variable "dms" going out of scope leaks the storage it points to.
---
libdm/libdm-stats.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/libdm/libdm-stats.c b/libdm/libdm-stats.c
index 64ca23f..a672e05 100644
--- a/libdm/libdm-stats.c
+++ b/libdm/libdm-stats.c
@@ -94,10 +94,10 @@ struct dm_stats *dm_stats_create(const char *program_id)
{
struct dm_stats *dms = NULL;
- if (!(dms = dm_malloc(sizeof(*dms))))
+ if (!(dms = dm_zalloc(sizeof(*dms))))
return_NULL;
if (!(dms->mem = dm_pool_create("stats_pool", 4096)))
- return_NULL;
+ goto_out;
if (!program_id || !strlen(program_id))
dms->program_id = _program_id_from_proc();
@@ -117,6 +117,9 @@ struct dm_stats *dm_stats_create(const char *program_id)
dms->regions = NULL;
return dms;
+out:
+ dm_free(dms);
+ return NULL;
}
/**
8 years, 8 months
master - libdm: fix FILE leak in _program_id_from_proc() (Coverity)
by Bryn Reeves
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=1134de3c89c5a0...
Commit: 1134de3c89c5a07699365031d0cb88383e365929
Parent: 3b74824985f7e4e90f0ba9668724abd08d5fef74
Author: Bryn M. Reeves <bmr(a)redhat.com>
AuthorDate: Mon Aug 10 10:08:03 2015 +0100
Committer: Bryn M. Reeves <bmr(a)redhat.com>
CommitterDate: Mon Aug 10 20:20:26 2015 +0100
libdm: fix FILE leak in _program_id_from_proc() (Coverity)
Make sure comm is closed in the error path of _program_id_from_proc().
libdm/libdm-stats.c: 98 in dm_stats_create() - Variable "comm" going out of scope leaks the storage it points to.
---
libdm/libdm-stats.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/libdm/libdm-stats.c b/libdm/libdm-stats.c
index bf3cad0..64ca23f 100644
--- a/libdm/libdm-stats.c
+++ b/libdm/libdm-stats.c
@@ -79,11 +79,13 @@ static char *_program_id_from_proc(void)
if (!(comm = fopen(PROC_SELF_COMM, "r")))
return_NULL;
- if (!fgets(buf, sizeof(buf), comm))
- return_NULL;
+ if (!fgets(buf, sizeof(buf), comm)) {
+ log_error("Could not read from %s", PROC_SELF_COMM);
+ fclose(comm);
+ return NULL;
+ }
- if (fclose(comm))
- return_NULL;
+ fclose(comm);
return dm_strdup(buf);
}
8 years, 8 months
master - dmsetup: remove bogus !_report test in _stats_report (Coverity)
by Bryn Reeves
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=3b74824985f7e4...
Commit: 3b74824985f7e4e90f0ba9668724abd08d5fef74
Parent: 6bd5bf3cb5a1c01ec8be8bb714c7c0461d6bec58
Author: Bryn M. Reeves <bmr(a)redhat.com>
AuthorDate: Mon Aug 10 10:01:18 2015 +0100
Committer: Bryn M. Reeves <bmr(a)redhat.com>
CommitterDate: Mon Aug 10 20:12:53 2015 +0100
dmsetup: remove bogus !_report test in _stats_report (Coverity)
There's no point testing _report here in _stats_report: it's always
initialised before the function is called and if the check did fail
we'd end up freeing an uninitialized dm_task in the error path.
tools/dmsetup.c: 4389 in _stats_report() - Declaring variable "dmt" without initializer.
---
tools/dmsetup.c | 3 ---
1 files changed, 0 insertions(+), 3 deletions(-)
diff --git a/tools/dmsetup.c b/tools/dmsetup.c
index de67b03..2ee432b 100644
--- a/tools/dmsetup.c
+++ b/tools/dmsetup.c
@@ -4397,9 +4397,6 @@ static int _stats_report(CMD_ARGS)
name = argv[1];
}
- if (!_report)
- goto out;
-
if (!(dmt = dm_task_create(DM_DEVICE_INFO)))
return 0;
8 years, 8 months
master - lvmlockd: fix check for other sanlock lockspaces
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=6bd5bf3cb5a1c0...
Commit: 6bd5bf3cb5a1c01ec8be8bb714c7c0461d6bec58
Parent: 1aa7fa354e6ed3e468dc7966f5df0009627b2b97
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Mon Aug 10 13:16:04 2015 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Mon Aug 10 13:16:04 2015 -0500
lvmlockd: fix check for other sanlock lockspaces
The check for other sanlock lockspaces was not checking
that the lockspace type was sanlock, so if dlm lockspaces
were visible, they were wrongly included.
---
daemons/lvmlockd/lvmlockd-core.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/daemons/lvmlockd/lvmlockd-core.c b/daemons/lvmlockd/lvmlockd-core.c
index 7493d11..5e4e73f 100644
--- a/daemons/lvmlockd/lvmlockd-core.c
+++ b/daemons/lvmlockd/lvmlockd-core.c
@@ -1981,11 +1981,15 @@ static int other_sanlock_vgs_exist(struct lockspace *ls_rem)
struct lockspace *ls;
list_for_each_entry(ls, &lockspaces_inactive, list) {
+ if (ls->lm_type != LD_LM_SANLOCK)
+ continue;
log_debug("other sanlock vg exists inactive %s", ls->name);
return 1;
}
list_for_each_entry(ls, &lockspaces, list) {
+ if (ls->lm_type != LD_LM_SANLOCK)
+ continue;
if (!strcmp(ls->name, ls_rem->name))
continue;
log_debug("other sanlock vg exists %s", ls->name);
8 years, 8 months
master - vgremove: fix locking when lvmlockd global lock is removed
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=1aa7fa354e6ed3...
Commit: 1aa7fa354e6ed3e468dc7966f5df0009627b2b97
Parent: 5383697c784de5af5438bb09ea8ebb57b4a47418
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Mon Aug 10 13:04:11 2015 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Mon Aug 10 13:04:11 2015 -0500
vgremove: fix locking when lvmlockd global lock is removed
When vgremove is used to remove multiple VGs in one command,
e.g. vgremove foo bar, the first VG (foo) that is removed
may have held the sanlock global lock. In this case,
do not continue removing further VGs (bar) without the
global lock.
---
lib/commands/toolcontext.h | 1 +
lib/locking/lvmlockd.c | 28 +++++++++++++++++++++++++++-
2 files changed, 28 insertions(+), 1 deletions(-)
diff --git a/lib/commands/toolcontext.h b/lib/commands/toolcontext.h
index ec2242d..0440163 100644
--- a/lib/commands/toolcontext.h
+++ b/lib/commands/toolcontext.h
@@ -133,6 +133,7 @@ struct cmd_context {
unsigned lockd_gl_disable:1;
unsigned lockd_vg_disable:1;
unsigned lockd_lv_disable:1;
+ unsigned lockd_gl_removed:1;
unsigned lockd_vg_default_sh:1;
unsigned lockd_vg_enforce_sh:1;
diff --git a/lib/locking/lvmlockd.c b/lib/locking/lvmlockd.c
index 7f14a86..5918de3 100644
--- a/lib/locking/lvmlockd.c
+++ b/lib/locking/lvmlockd.c
@@ -739,6 +739,19 @@ static int _free_vg_sanlock(struct cmd_context *cmd, struct volume_group *vg)
if (!_lvmlockd_connected)
return 0;
+ /*
+ * vgremove originally held the global lock, but lost it because the
+ * vgremove command is removing multiple VGs, and removed the VG
+ * holding the global lock before attempting to remove this VG.
+ * To avoid this situation, the user should remove the VG holding
+ * the global lock in a command by itself, or as the last arg in a
+ * vgremove command that removes multiple VGs.
+ */
+ if (cmd->lockd_gl_removed) {
+ log_error("Global lock failed: global lock was lost by removing a previous VG.");
+ return 0;
+ }
+
if (!vg->lock_args || !strlen(vg->lock_args)) {
/* Shouldn't happen in general, but maybe in some error cases? */
log_debug("_free_vg_sanlock %s no lock_args", vg->name);
@@ -773,8 +786,21 @@ static int _free_vg_sanlock(struct cmd_context *cmd, struct volume_group *vg)
goto out;
}
- if (lockd_flags & LD_RF_WARN_GL_REMOVED)
+ /*
+ * If the global lock was been removed by removing this VG, then:
+ *
+ * Print a warning indicating that the global lock should be enabled
+ * in another remaining sanlock VG.
+ *
+ * Do not allow any more VGs to be removed by this command, e.g.
+ * if a command removes two sanlock VGs, like vgremove foo bar,
+ * and the global lock existed in foo, do not continue to remove
+ * VG bar without the global lock. See the corresponding check above.
+ */
+ if (lockd_flags & LD_RF_WARN_GL_REMOVED) {
log_warn("VG %s held the sanlock global lock, enable global lock in another VG.", vg->name);
+ cmd->lockd_gl_removed = 1;
+ }
/*
* The usleep delay gives sanlock time to close the lock lv,
8 years, 8 months
v2_02_127 annotated tag has been created
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=bc3d89c8c7a553...
Commit: bc3d89c8c7a5537bc603e16c74702ac65f5418ff
Parent: 0000000000000000000000000000000000000000
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: 2015-08-09 23:40 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: 2015-08-09 23:40 +0000
annotated tag: v2_02_127 has been created
at bc3d89c8c7a5537bc603e16c74702ac65f5418ff (tag)
tagging 0b05048341c6ededae7b271c08101decd7d0d184 (commit)
replaces v2_02_126
Release 2.02.127.
This release introduces a new command, dmstats, for reporting device
I/O statistics. This command is still undergoing active development
and we might still change any of the new interfaces in a subsequent
release (including command line options, output format and defaults,
field names, the new library functions etc.): they should not yet be
considered frozen.
82 files changed, 7353 insertions(+), 1330 deletions(-)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)
iEYEABECAAYFAlXH5qIACgkQIoGRwVZ+LBdKuACgllek9x0oxhiV2KUYoUgosFBl
l8wAmgNhmMxkyY9HJGP4NB4nnbcwghgC
=3Xgr
-----END PGP SIGNATURE-----
Alasdair G Kergon (22):
post-release
post-release
gitignore: Update for in-place build.
configure: Add missing checks.
configure: Enable realtime by default, if present.
lvmlockd: Drop -lrt now handled by configure.
libdm: Add dm_size_to_string to libdevmapper.
dmsetup: Accept vg/lv name format.
libdm: Add dm_timestamp functions.
libdm: Require librt for new dm_timestamp.
dmsetup: Rename _commands to _dmsetup_commands.
dmsetup: Add _dmsetup to help and usage fns.
dmsetup: _find_command returns const
dmsetup: Add subcommand parameter.
dmsetup: Allow commands to have subcommands.
dmsetup: Tidy whitespace.
libdm: Sort new exported symbols.
libdm: Whitespace.
libdm: Whitespace.
dmsetup: Report timestamps of ioctls with -vvv.
dmsetup: Also install dmstats.
pre-release
Bryn M. Reeves (9):
dmsetup: Add --count and --interval to reports.
dmsetup: Use argcp and argvp.
libdm: ensure new dm_timestamp objects are initialized
libdm: fix report rows and headings memory and state leaks
libdm: add dm_report_column_headings
libdm: remove report interval support
libdm: do not attempt to output column headings with --rows
WHATS_NEW_DM: Update for preliminary stats commits
dmstats: add libdm-stats library and 'dmsetup stats' command
David Teigland (13):
lvmcache: add lock_type to VG summary and info structs
vgcreate: improve checks for existing global lock
vgremove: warn when removing sanlock global lock
lvmlockd: small fixes and cleanup for lvmlockctl
lvmlockd: create sanlock lv large enough for existing lvs
vgchange/lvchange: allow deactivation without locking
lockd: remove ignorelockingfailure checks
lvmlockd: automatically remove the dlm global lockspace
lvmlockd: handle loss of sanlock lease storage
man lvmcache: mention LVs must be in the same VG
man lvmlockd: update
man: add lockd bits to relevant commands
man: mention system ID in vgexport and vgimport
Marian Csontos (2):
spec: lockd_dlm requires dlm-lib instead of dlm
test: Update Makefiles
Peter Rajnoha (19):
cache: fix regression causing some PVs to bypass filters
dmsetup: remove dead code that covered "info -c -o help" case once
refactor: toolcontext: add struct cmd_context_initialized_parts
refactor: toolcontext: move lvmetad and lvmpolld init into separate function
toolcontext: add switches to create_toolcontext for connections and filters init
commands: add new NO_METADATA_PROCESSING flag to selected commands
cleanup: toolcontext: make cmd_context more readable
cleanup: toolcontext: move report_list_item_separator into its group
toolcontext: use refresh_filters in refresh_toolcontext
toolcontext: do not set cmd->initialized_connections = 0 on destroy_toolcontext
report: recognize report field name variants without any underscores too
report: update comment for _is_same_field fn
report: also recognize variants without underscores for <prefix>_all fields
coverity: fix possible resource leak in lvmpolld-core
coverity: fix cppcheck warnings
coverity: return value check in lvmlockd-dlm
coverity: variable init must be done before its use
coverity: check vg->lvm1_system_id is not NULL before calling strncmp with that
man: document --nameprefixes
8 years, 8 months
master - post-release
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=5383697c784de5...
Commit: 5383697c784de5af5438bb09ea8ebb57b4a47418
Parent: 0b05048341c6ededae7b271c08101decd7d0d184
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Mon Aug 10 01:02:31 2015 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Mon Aug 10 01:02:31 2015 +0100
post-release
---
VERSION | 2 +-
VERSION_DM | 2 +-
WHATS_NEW | 3 +++
WHATS_NEW_DM | 3 +++
4 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/VERSION b/VERSION
index 2d1f7f0..c2c0786 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.02.127(2)-git (2015-08-10)
+2.02.128(2)-git (2015-08-10)
diff --git a/VERSION_DM b/VERSION_DM
index be3c65b..3f8be7a 100644
--- a/VERSION_DM
+++ b/VERSION_DM
@@ -1 +1 @@
-1.02.104-git (2015-08-10)
+1.02.105-git (2015-08-10)
diff --git a/WHATS_NEW b/WHATS_NEW
index 85288e0..71c41d2 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,3 +1,6 @@
+Version 2.02.128 -
+===================================
+
Version 2.02.127 - 10th August 2015
===================================
Do not init filters, locking, lvmetad, lvmpolld if command doesn't use it.
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index 59a559f..e857241 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,3 +1,6 @@
+Version 1.02.105 -
+===================================
+
Version 1.02.104 - 10th August 2015
===================================
Add dmstats.8 man page
8 years, 8 months
master - pre-release
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=0b05048341c6ed...
Commit: 0b05048341c6ededae7b271c08101decd7d0d184
Parent: 41001dbfdd54674ead6051d06a8b89701dce68c5
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Mon Aug 10 00:40:42 2015 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Mon Aug 10 00:40:42 2015 +0100
pre-release
---
VERSION | 2 +-
VERSION_DM | 2 +-
WHATS_NEW | 9 ++++++---
WHATS_NEW_DM | 20 +++++++++++---------
4 files changed, 19 insertions(+), 14 deletions(-)
diff --git a/VERSION b/VERSION
index 131a92a..2d1f7f0 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.02.127(2)-git (2015-07-24)
+2.02.127(2)-git (2015-08-10)
diff --git a/VERSION_DM b/VERSION_DM
index f28fdfe..be3c65b 100644
--- a/VERSION_DM
+++ b/VERSION_DM
@@ -1 +1 @@
-1.02.104-git (2015-07-24)
+1.02.104-git (2015-08-10)
diff --git a/WHATS_NEW b/WHATS_NEW
index 1e04acb..85288e0 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,8 +1,11 @@
-Version 2.02.127 -
-=================================
+Version 2.02.127 - 10th August 2015
+===================================
Do not init filters, locking, lvmetad, lvmpolld if command doesn't use it.
- Recognise vg/lv name format in dmsetup.
+ Order fields in struct cmd_context more logically.
+ Add lock_type to lvmcache VG summary and info structs.
Fix regression in cache causing some PVs to bypass filters (2.02.105).
+ Make configure --enable-realtime the default now.
+ Update .gitignore and configure.in files to reflect usage of current tree.
Version 2.02.126 - 24th July 2015
=================================
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index 1753322..59a559f 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,25 +1,27 @@
-Version 1.02.104 -
-=================================
+Version 1.02.104 - 10th August 2015
+===================================
Add dmstats.8 man page
+ Add dmstats --segments switch to create one region per device segment.
+ Add dmstats --regionid, --allregions to specify a single / all stats regions.
+ Add dmstats --allprograms for stats commands that filter by program ID.
+ Add dmstats --auxdata and --programid args to specify aux data and program ID.
Add report stats sub-command to provide repeating stats reports.
Add clear, delete, list, and print stats sub-commands.
- Add --segments switch to create one region per device segment.
Add create stats sub-command and --start, --length, --areas and --areasize.
Recognize 'dmstats' as an alias for 'dmsetup stats' when run with this name.
Add a 'stats' command to dmsetup to configure, manage and report stats data.
- Add --regionid, --allregions to specify a single stats region or all regions.
- Add --allprograms for stats commands that filter by program ID.
- Add --auxdata and --programid arguments to specify aux data and program ID.
- Add statistics fields to -o <field>
+ Add statistics fields to dmsetup -o.
Add libdm-stats library to allow management of device-mapper statistics.
- Add --nosuffix to suppress unit suffixes in report output.
- Add --units to control report field output units.
+ Add --nosuffix to suppress dmsetup unit suffixes in report output.
+ Add --units to control dmsetup report field output units.
Add support to redisplay column headings for repeating column reports.
Fix report header and row resource leaks.
Report timestamps of ioctls with dmsetup -vvv.
Recognize report field name variants without any underscores too.
Add dmsetup --interval and --count to repeat reports at specified intervals.
Add dm_timestamp functions to libdevmapper.
+ Recognise vg/lv name format in dmsetup.
+ Move size display code to libdevmapper as dm_size_to_string.
Version 1.02.103 - 24th July 2015
=================================
8 years, 8 months