diff --git a/.gitignore b/.gitignore
index bd1506b..1f38794 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1 @@
-SOURCES/LVM2.2.02.115.tgz
+SOURCES/LVM2.2.02.130.tgz
diff --git a/.lvm2.metadata b/.lvm2.metadata
index 0ed8558..1faaa1c 100644
--- a/.lvm2.metadata
+++ b/.lvm2.metadata
@@ -1 +1 @@
-bc229c7790b796051a8e45c58bd97ab57eadf360 SOURCES/LVM2.2.02.115.tgz
+9503a12881cb408aec6b774f0c92384c814d9684 SOURCES/LVM2.2.02.130.tgz
diff --git a/SOURCES/lvm2-2_02_116-fix-lvm2app-to-properly-handle-info-status-properties.patch b/SOURCES/lvm2-2_02_116-fix-lvm2app-to-properly-handle-info-status-properties.patch
deleted file mode 100644
index 4d9cccd..0000000
--- a/SOURCES/lvm2-2_02_116-fix-lvm2app-to-properly-handle-info-status-properties.patch
+++ /dev/null
@@ -1,52 +0,0 @@
- WHATS_NEW               | 2 ++
- lib/metadata/lv.c       | 2 +-
- lib/report/properties.c | 4 ++--
- 3 files changed, 5 insertions(+), 3 deletions(-)
-
-diff --git a/WHATS_NEW b/WHATS_NEW
-index ef5cc83..7c77c68 100644
---- a/WHATS_NEW
-+++ b/WHATS_NEW
-@@ -1,5 +1,7 @@
- Version 2.02.116 - 
- ====================================
-+  Fix lvm2app lvm_lv_get_property return value for fields with info/status ioctl.
-+  Fix lvm2app regression in lvm_lv_get_attr causing unknown values (2.02.115).
-   Preserve chunk size with repair and metadata swap of a thin pool.
-   Fix raid --splitmirror 1 functionality (2.02.112).
-   Fix tree preload to handle splitting raid images.
-diff --git a/lib/metadata/lv.c b/lib/metadata/lv.c
-index 9052e63..c3c5d4a 100644
---- a/lib/metadata/lv.c
-+++ b/lib/metadata/lv.c
-@@ -831,7 +831,7 @@ char *lv_attr_dup(struct dm_pool *mem, const struct logical_volume *lv)
- 	if (!(status.seg_status.mem = dm_pool_create("reporter_pool", 1024)))
- 		return_0;
- 
--	if (!lv_info_with_seg_status(lv->vg->cmd, lv, first_seg(lv), 1, &status, 1, 1))
-+	if (!(status.info_ok = lv_info_with_seg_status(lv->vg->cmd, lv, first_seg(lv), 1, &status, 1, 1)))
- 		goto_bad;
- 
- 	ret = lv_attr_dup_with_info_and_seg_status(mem, &status);
-diff --git a/lib/report/properties.c b/lib/report/properties.c
-index 8866928..c1c9563 100644
---- a/lib/report/properties.c
-+++ b/lib/report/properties.c
-@@ -476,7 +476,7 @@ int lvseg_get_property(const struct lv_segment *lvseg,
- int lv_get_property(const struct logical_volume *lv,
- 		    struct lvm_property_type *prop)
- {
--	return prop_get_property(_properties, lv, prop, LVS);
-+	return prop_get_property(_properties, lv, prop, LVS | LVSINFO | LVSSTATUS | LVSINFOSTATUS);
- }
- 
- int vg_get_property(const struct volume_group *vg,
-@@ -500,7 +500,7 @@ int pv_get_property(const struct physical_volume *pv,
- int lv_set_property(struct logical_volume *lv,
- 		    struct lvm_property_type *prop)
- {
--	return prop_set_property(_properties, lv, prop, LVS);
-+	return prop_set_property(_properties, lv, prop, LVS | LVSINFO | LVSSTATUS | LVSINFOSTATUS);
- }
- 
- int vg_set_property(struct volume_group *vg,
diff --git a/SOURCES/lvm2-2_02_116-fix-raid-image-splitting.patch b/SOURCES/lvm2-2_02_116-fix-raid-image-splitting.patch
deleted file mode 100644
index e94b45d..0000000
--- a/SOURCES/lvm2-2_02_116-fix-raid-image-splitting.patch
+++ /dev/null
@@ -1,201 +0,0 @@
- WHATS_NEW                           |  6 ++++++
- lib/activate/activate.c             | 21 +++++++++++++++++++++
- lib/activate/dev_manager.c          |  2 +-
- lib/metadata/lv.c                   |  4 ++++
- lib/metadata/raid_manip.c           | 30 ++++++++++--------------------
- test/shell/lvconvert-raid.sh        |  6 ++++++
- test/shell/lvconvert-repair-thin.sh |  9 ++++++++-
- tools/lvconvert.c                   |  1 +
- 8 files changed, 57 insertions(+), 22 deletions(-)
-
-diff --git a/WHATS_NEW b/WHATS_NEW
-index 75c4569..ef5cc83 100644
---- a/WHATS_NEW
-+++ b/WHATS_NEW
-@@ -1,3 +1,9 @@
-+Version 2.02.116 - 
-+====================================
-+  Preserve chunk size with repair and metadata swap of a thin pool.
-+  Fix raid --splitmirror 1 functionality (2.02.112).
-+  Fix tree preload to handle splitting raid images.
-+
- Version 2.02.115 - 21st January 2015
- ====================================
-   Report segment types without monitoring support as undefined.
-diff --git a/lib/activate/activate.c b/lib/activate/activate.c
-index 424786c..00d3a10 100644
---- a/lib/activate/activate.c
-+++ b/lib/activate/activate.c
-@@ -1760,6 +1760,22 @@ static int _preload_detached_lv(struct logical_volume *lv, void *data)
- 	struct detached_lv_data *detached = data;
- 	struct lv_list *lvl_pre;
- 
-+        /* Check and preload removed raid image leg */
-+	if (lv_is_raid_image(lv)) {
-+		if ((lvl_pre = find_lv_in_vg_by_lvid(detached->lv_pre->vg, &lv->lvid)) &&
-+		    !lv_is_raid_image(lvl_pre->lv) &&
-+		    !_lv_preload(lvl_pre->lv, detached->laopts, detached->flush_required))
-+			return_0;
-+	}
-+
-+        /* Check and preload removed of raid metadata */
-+	if (lv_is_raid_metadata(lv)) {
-+		if ((lvl_pre = find_lv_in_vg_by_lvid(detached->lv_pre->vg, &lv->lvid)) &&
-+		    !lv_is_raid_metadata(lvl_pre->lv) &&
-+		    !_lv_preload(lvl_pre->lv, detached->laopts, detached->flush_required))
-+			return_0;
-+	}
-+
- 	if ((lvl_pre = find_lv_in_vg(detached->lv_pre->vg, lv->name))) {
- 		if (lv_is_visible(lvl_pre->lv) && lv_is_active(lv) &&
- 		    (!lv_is_cow(lv) || !lv_is_cow(lvl_pre->lv)) &&
-@@ -1863,6 +1879,11 @@ static int _lv_suspend(struct cmd_context *cmd, const char *lvid_s,
- 		if (!for_each_sub_lv((struct logical_volume *)ondisk_lv, &_preload_detached_lv, &detached))
- 			goto_out;
- 
-+		/* ATM cache/thin pool is not scanned in  'for_each_sub_lv()', TODO explore better way */
-+		if (lv_is_cache(ondisk_lv) &&
-+		    !for_each_sub_lv(first_seg(ondisk_lv)->pool_lv, &_preload_detached_lv, &detached))
-+			goto_out;
-+
- 		/*
- 		 * Preload any snapshots that are being removed.
- 		 */
-diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
-index 015af5b..dcb2c5d 100644
---- a/lib/activate/dev_manager.c
-+++ b/lib/activate/dev_manager.c
-@@ -2295,7 +2295,7 @@ int add_areas_line(struct dev_manager *dm, struct lv_segment *seg,
- 			 * is used in the CTR table.
- 			 */
- 			if ((seg_type(seg, s) == AREA_UNASSIGNED) ||
--			    ((seg_lv(seg, s)->status & VISIBLE_LV) &&
-+			    (lv_is_visible(seg_lv(seg, s)) &&
- 			     !(seg_lv(seg, s)->status & LVM_WRITE))) {
- 				/* One each for metadata area and data area */
- 				if (!dm_tree_node_add_null_area(node, 0) ||
-diff --git a/lib/metadata/lv.c b/lib/metadata/lv.c
-index 683ec47..9052e63 100644
---- a/lib/metadata/lv.c
-+++ b/lib/metadata/lv.c
-@@ -1018,6 +1018,10 @@ const struct logical_volume *lv_lock_holder(const struct logical_volume *lv)
- 				return sl->seg->lv;
- 			}
- 
-+	/* RAID changes visibility of splitted LVs but references them still as leg/meta */
-+	if ((lv_is_raid_image(lv) || lv_is_raid_metadata(lv)) && lv_is_visible(lv))
-+		return lv;
-+
- 	/* For other types, by default look for the first user */
- 	dm_list_iterate_items(sl, &lv->segs_using_this_lv) {
- 		/* FIXME: complete this exception list */
-diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
-index d502379..22f71c7 100644
---- a/lib/metadata/raid_manip.c
-+++ b/lib/metadata/raid_manip.c
-@@ -1149,12 +1149,6 @@ int lv_raid_split(struct logical_volume *lv, const char *split_name,
- 		return 0;
- 	}
- 
--	if (!resume_lv(lv->vg->cmd, lv_lock_holder(lv))) {
--		log_error("Failed to resume %s/%s after committing changes",
--			  lv->vg->name, lv->name);
--		return 0;
--	}
--
- 	/*
- 	 * First activate the newly split LV and LVs on the removal list.
- 	 * This is necessary so that there are no name collisions due to
-@@ -1164,26 +1158,22 @@ int lv_raid_split(struct logical_volume *lv, const char *split_name,
- 	if (!activate_lv_excl_local(cmd, lvl->lv))
- 		return_0;
- 
-+	dm_list_iterate_items(lvl, &removal_list)
-+		if (!activate_lv_excl_local(cmd, lvl->lv))
-+			return_0;
-+
-+	if (!resume_lv(cmd, lv_lock_holder(lv))) {
-+		log_error("Failed to resume %s/%s after committing changes",
-+			  lv->vg->name, lv->name);
-+		return 0;
-+	}
-+
- 	/*
- 	 * Since newly split LV is typically already active - we need to call
- 	 * suspend() and resume() to also rename it.
- 	 *
- 	 * TODO: activate should recognize it and avoid these 2 calls
- 	 */
--	if (!suspend_lv(cmd, lvl->lv)) {
--		log_error("Failed to suspend %s.", lvl->lv->name);
--		return 0;
--	}
--
--	if (!resume_lv(cmd, lvl->lv)) {
--		log_error("Failed to reactivate %s.", lvl->lv->name);
--		return 0;
--	}
--
--	dm_list_iterate_items(lvl, &removal_list)
--		if (!activate_lv_excl_local(cmd, lvl->lv))
--			return_0;
--
- 
- 	/*
- 	 * Eliminate the residual LVs
-diff --git a/test/shell/lvconvert-raid.sh b/test/shell/lvconvert-raid.sh
-index 8621311..12e0420 100644
---- a/test/shell/lvconvert-raid.sh
-+++ b/test/shell/lvconvert-raid.sh
-@@ -121,6 +121,12 @@ check active $vg $lv2
- # FIXME: ensure no residual devices
- lvremove -ff $vg
- 
-+# 4-way
-+lvcreate --type raid1 -m 4 -l 2 -n $lv1 $vg
-+aux wait_for_sync $vg $lv1
-+lvconvert --yes --splitmirrors 1 --name $lv2 $vg/$lv1 "$dev2"
-+lvremove -ff $vg
-+
- ###########################################
- # RAID1 split + trackchanges / merge
- ###########################################
-diff --git a/test/shell/lvconvert-repair-thin.sh b/test/shell/lvconvert-repair-thin.sh
-index 0e9534b..73f061c 100644
---- a/test/shell/lvconvert-repair-thin.sh
-+++ b/test/shell/lvconvert-repair-thin.sh
-@@ -24,7 +24,9 @@ aux have_thin 1 0 0 || skip
- aux prepare_vg 4
- 
- # Create LV
--lvcreate -T -L20 -V10 -n $lv1 $vg/pool  "$dev1" "$dev2"
-+# TODO: investigate problem with --zero n and my repairable damage trick
-+#lvcreate -T -L20 -V10 -n $lv1 $vg/pool --discards ignore --zero n --chunksize 128 "$dev1" "$dev2"
-+lvcreate -T -L20 -V10 -n $lv1 $vg/pool --chunksize 128 --discards ignore "$dev1" "$dev2"
- lvcreate -T -V10 -n $lv2 $vg/pool
- 
- mkfs.ext2 "$DM_DEV_DIR/$vg/$lv1"
-@@ -71,6 +73,11 @@ lvchange -an $vg
- # Swap repaired metadata back
- lvconvert -y -f --poolmetadata $vg/fixed --thinpool $vg/pool
- 
-+# Check pool still preserves its original settings
-+check lv_field $vg/pool chunksize "128.00k"
-+check lv_field $vg/pool discards "ignore"
-+check lv_field $vg/pool zero "zero"
-+
- # Activate pool - this should now work
- vgchange -ay $vg
- 
-diff --git a/tools/lvconvert.c b/tools/lvconvert.c
-index c7acd5d..20f017a 100644
---- a/tools/lvconvert.c
-+++ b/tools/lvconvert.c
-@@ -2956,6 +2956,7 @@ static int _lvconvert_pool(struct cmd_context *cmd,
- 			return 0;
- 		}
- 
-+		lp->passed_args |= PASS_ARG_CHUNK_SIZE | PASS_ARG_DISCARDS | PASS_ARG_ZERO;
- 		seg = first_seg(pool_lv);
- 
- 		/* Normally do NOT change chunk size when swapping */
diff --git a/SOURCES/lvm2-2_02_131-disallow-usage-of-stripe-and-stripesize-when-creating-cache-pool.patch b/SOURCES/lvm2-2_02_131-disallow-usage-of-stripe-and-stripesize-when-creating-cache-pool.patch
new file mode 100644
index 0000000..6dcfefd
--- /dev/null
+++ b/SOURCES/lvm2-2_02_131-disallow-usage-of-stripe-and-stripesize-when-creating-cache-pool.patch
@@ -0,0 +1,38 @@
+ WHATS_NEW        | 1 +
+ tools/lvcreate.c | 5 ++++-
+ 2 files changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/WHATS_NEW b/WHATS_NEW
+index 5260321..1147dad 100644
+--- a/WHATS_NEW
++++ b/WHATS_NEW
+@@ -1,5 +1,6 @@
+ Version 2.02.131 - 
+ =====================================
++  Disallow usage of --stripe and --stripesize when creating cache pool.
+   Swapping of LV identifiers handles more complex LVs.
+   Fix VG metadata comparison failure while scanning the VG for lvmetad.
+   Ignore persistent cache if configuration changed. (2.02.127)
+diff --git a/tools/lvcreate.c b/tools/lvcreate.c
+index 364a16a..7bba761 100644
+--- a/tools/lvcreate.c
++++ b/tools/lvcreate.c
+@@ -770,7 +770,8 @@ static int _lvcreate_params(struct cmd_context *cmd,
+ 					    CACHE_POOL_ARGS,
+ 					    LVCREATE_ARGS,
+ 					    POOL_ARGS,
+-					    SIZE_ARGS,
++					    extents_ARG,
++					    size_ARG,
+ 					    cache_ARG,
+ 					    chunksize_ARG,
+ 					    -1))
+@@ -1096,6 +1097,8 @@ static int _determine_cache_argument(struct volume_group *vg,
+ 		}
+ 		/* FIXME How to handle skip flag? */
+ 		if (arg_from_list_is_set(cmd, "is unsupported with cache conversion",
++					 stripes_ARG,
++					 stripesize_ARG,
+ 					 setactivationskip_ARG,
+ 					 ignoreactivationskip_ARG,
+ 					 -1))
diff --git a/SOURCES/lvm2-2_02_131-dmstats-fixups.patch b/SOURCES/lvm2-2_02_131-dmstats-fixups.patch
new file mode 100644
index 0000000..be12a79
--- /dev/null
+++ b/SOURCES/lvm2-2_02_131-dmstats-fixups.patch
@@ -0,0 +1,521 @@
+ libdm/libdm-stats.c | 223 ++++++++++++++++++++++++++++++----------------------
+ tools/dmsetup.c     |   1 +
+ 2 files changed, 131 insertions(+), 93 deletions(-)
+
+diff --git a/libdm/libdm-stats.c b/libdm/libdm-stats.c
+index 93c7760..ee62fe6 100644
+--- a/libdm/libdm-stats.c
++++ b/libdm/libdm-stats.c
+@@ -144,17 +144,24 @@ struct dm_stats *dm_stats_create(const char *program_id)
+ 		return_NULL;
+ 
+ 	/* FIXME: better hint. */
+-	if (!(dms->mem = dm_pool_create("stats_pool", 4096)))
+-		goto_bad;
++	if (!(dms->mem = dm_pool_create("stats_pool", 4096))) {
++		dm_free(dms);
++		return_NULL;
++	}
+ 
+ 	if (!(dms->hist_mem = dm_pool_create("histogram_pool", hist_hint)))
+-		return_0;
++		goto_bad;
+ 
+ 	if (!program_id || !strlen(program_id))
+ 		dms->program_id = _program_id_from_proc();
+ 	else
+ 		dms->program_id = dm_strdup(program_id);
+ 
++	if (!dms->program_id) {
++		dm_pool_destroy(dms->hist_mem);
++		goto_bad;
++	}
++
+ 	dms->major = -1;
+ 	dms->minor = -1;
+ 	dms->name = NULL;
+@@ -171,6 +178,7 @@ struct dm_stats *dm_stats_create(const char *program_id)
+ 	return dms;
+ 
+ bad:
++	dm_pool_destroy(dms->mem);
+ 	dm_free(dms);
+ 	return NULL;
+ }
+@@ -186,15 +194,15 @@ static int _stats_region_present(const struct dm_stats_region *region)
+ static void _stats_histograms_destroy(struct dm_pool *mem,
+ 				      struct dm_stats_region *region)
+ {
+-	uint64_t n;
+-
+ 	/* Unpopulated handle. */
+ 	if (!region->counters)
+ 		return;
+ 
+-	for (n = _nr_areas_region(region) - 1; n; n--)
+-		if (region->counters[n].histogram)
+-			dm_pool_free(mem, region->counters[n].histogram);
++	/*
++	 * Only the first histogram needs to be freed explicitly.
++	 */
++	if (region->counters[0].histogram)
++		dm_pool_free(mem, region->counters[0].histogram);
+ }
+ 
+ static void _stats_region_destroy(struct dm_stats_region *region)
+@@ -316,11 +324,54 @@ int dm_stats_driver_supports_histogram(void)
+ 	return _stats_check_precise_timestamps(NULL);
+ }
+ 
++static int _fill_hist_arg(char *hist_arg, size_t hist_len, uint64_t scale,
++			  struct dm_histogram *bounds)
++{
++	int i, l, len = 0, nr_bins;
++	char *arg = hist_arg;
++	uint64_t value;
++
++	nr_bins = bounds->nr_bins;
++
++	for (i = 0; i < nr_bins; i++) {
++		value = bounds->bins[i].upper / scale;
++		if ((l = dm_snprintf(arg, hist_len - len, FMTu64"%s", value,
++				     (i == (nr_bins - 1)) ? "" : ",")) < 0)
++			return_0;
++		len += l;
++		arg += l;
++	}
++	return 1;
++}
++
++static void *_get_hist_arg(struct dm_histogram *bounds, uint64_t scale,
++			   size_t *len)
++{
++	struct dm_histogram_bin *entry, *bins;
++	size_t hist_len = 1; /* terminating '\0' */
++	double value;
++
++	entry = bins = bounds->bins;
++
++	entry += bounds->nr_bins - 1;
++	while(entry >= bins) {
++		value = (double) (entry--)->upper;
++		/* Use lround to avoid size_t -> double cast warning. */
++		hist_len += 1 + (size_t) lround(log10(value / scale));
++		if (entry != bins)
++			hist_len++; /* ',' */
++	}
++
++	*len = hist_len;
++
++	return dm_zalloc(hist_len);
++}
++
+ static char *_build_histogram_arg(struct dm_histogram *bounds, int *precise)
+ {
+ 	struct dm_histogram_bin *entry, *bins;
+-	size_t hist_len = 1, len = 0;
+-	char *hist_arg, *arg = NULL;
++	size_t hist_len;
++	char *hist_arg;
+ 	uint64_t scale;
+ 
+ 	entry = bins = bounds->bins;
+@@ -331,53 +382,37 @@ static char *_build_histogram_arg(struct dm_histogram *bounds, int *precise)
+ 		return NULL;
+ 	}
+ 
++	/* Validate entries and set *precise if precision < 1ms. */
+ 	entry += bounds->nr_bins - 1;
+-	while(entry >= bins) {
+-		double value;
++	while (entry >= bins) {
+ 		if (entry != bins) {
+ 			if (entry->upper < (entry - 1)->upper) {
+ 				log_error("Histogram boundaries must be in "
+ 					  "order of increasing magnitude.");
+ 				return 0;
+ 			}
+-			hist_len++; /* ',' */
+ 		}
+ 
+ 		/*
+ 		 * Only enable precise_timestamps automatically if any
+ 		 * value in the histogram bounds uses precision < 1ms.
+ 		 */
+-		if (!*precise && (entry->upper % NSEC_PER_MSEC))
++		if (((entry--)->upper % NSEC_PER_MSEC) && !*precise)
+ 			*precise = 1;
+-
+-		value = (double) (entry--)->upper;
+-		/* Use lround to avoid size_t -> double cast warning. */
+-		hist_len += 1 + (size_t) lround(log10(value));
+ 	}
+ 
+-	if (!(hist_arg = dm_zalloc(hist_len))) {
++	scale = (*precise) ? 1 : NSEC_PER_MSEC;
++
++	/* Calculate hist_len and allocate a character buffer. */
++	if (!(hist_arg = _get_hist_arg(bounds, scale, &hist_len))) {
+ 		log_error("Could not allocate memory for histogram argument.");
+ 		return 0;
+ 	}
+ 
+-	arg = hist_arg;
+-
+-	if (*precise)
+-		scale = 1;
+-	else
+-		scale = (*precise) ? 1 : NSEC_PER_MSEC;
++	/* Fill hist_arg with boundary strings. */
++	if (!_fill_hist_arg(hist_arg, hist_len, scale, bounds))
++		goto_bad;
+ 
+-	for (entry = bins; entry < (bins + bounds->nr_bins); entry++) {
+-		uint64_t value;
+-		ssize_t l = 0;
+-		int last = !(entry < (bins + bounds->nr_bins - 1));
+-		value = entry->upper / scale;
+-		if ((l = dm_snprintf(arg, hist_len - len, FMTu64"%s", value,
+-				     (last) ? "" : ",")) < 0)
+-			goto_bad;
+-		len += (size_t) l;
+-		arg += (size_t) l;
+-	}
+ 	return hist_arg;
+ 
+ bad:
+@@ -419,13 +454,13 @@ static int _stats_parse_histogram_spec(struct dm_stats *dms,
+ 				       const char *histogram)
+ {
+ 	static const char *_valid_chars = "0123456789,";
+-	uint64_t scale = region->timescale;
++	uint64_t scale = region->timescale, this_val = 0;
+ 	struct dm_pool *mem = dms->hist_mem;
+ 	struct dm_histogram_bin cur;
+ 	struct dm_histogram hist;
+ 	int nr_bins = 1;
+-	const char *c, *v;
+-	char *p;
++	const char *c, *v, *val_start;
++	char *p, *endptr = NULL;
+ 
+ 	/* Advance past "histogram:". */
+ 	histogram = strchr(histogram, ':');
+@@ -466,9 +501,8 @@ static int _stats_parse_histogram_spec(struct dm_stats *dms,
+ 				  histogram);
+ 			goto bad;
+ 		} else {
+-			const char *val_start = c;
+-			char *endptr = NULL;
+-			uint64_t this_val = 0;
++			val_start = c;
++			endptr = NULL;
+ 
+ 			this_val = strtoull(val_start, &endptr, 10);
+ 			if (!endptr) {
+@@ -592,11 +626,11 @@ static int _stats_parse_list_region(struct dm_stats *dms,
+ 
+ static int _stats_parse_list(struct dm_stats *dms, const char *resp)
+ {
+-	struct dm_pool *mem = dms->mem;
+-	struct dm_stats_region cur;
+ 	uint64_t max_region = 0, nr_regions = 0;
++	struct dm_stats_region cur, fill;
++	struct dm_pool *mem = dms->mem;
+ 	FILE *list_rows;
+-	/* FIXME: determine correct maximum line length based on kernel format */
++	/* FIXME: use correct maximum line length for kernel format */
+ 	char line[256];
+ 
+ 	if (!resp) {
+@@ -631,7 +665,6 @@ static int _stats_parse_list(struct dm_stats *dms, const char *resp)
+ 
+ 		/* handle holes in the list of region_ids */
+ 		if (cur.region_id > max_region) {
+-			struct dm_stats_region fill;
+ 			memset(&fill, 0, sizeof(fill));
+ 			fill.region_id = DM_STATS_REGION_NOT_PRESENT;
+ 			do {
+@@ -707,54 +740,51 @@ static int _stats_parse_histogram(struct dm_pool *mem, char *hist_str,
+ 				  struct dm_histogram **histogram,
+ 				  struct dm_stats_region *region)
+ {
++	struct dm_histogram hist, *bounds = region->bounds;
+ 	static const char *_valid_chars = "0123456789:";
+ 	int nr_bins = region->bounds->nr_bins;
+-	struct dm_histogram hist, *bounds = region->bounds;
++	const char *c, *v, *val_start;
+ 	struct dm_histogram_bin cur;
+-	uint64_t sum = 0;
+-	const char *c, *v;
++	uint64_t sum = 0, this_val;
++	char *endptr = NULL;
+ 	int bin = 0;
+ 
+ 	c = hist_str;
+ 
+-	dm_pool_begin_object(mem, sizeof(cur));
++	if (!dm_pool_begin_object(mem, sizeof(cur)))
++		return_0;
+ 
+ 	hist.nr_bins = nr_bins;
+ 
+-	dm_pool_grow_object(mem, &hist, sizeof(hist));
++	if (!dm_pool_grow_object(mem, &hist, sizeof(hist)))
++		goto_bad;
+ 
+ 	do {
+ 		memset(&cur, 0, sizeof(cur));
+ 		for (v = _valid_chars; *v; v++)
+ 			if (*c == *v)
+ 				break;
+-		if (!*v) {
+-			stack;
++		if (!*v)
+ 			goto badchar;
+-		}
+ 
+-		if (*c == ',') {
+-			log_error("Invalid histogram: %s", hist_str);
+-			return 0;
+-		} else {
+-			const char *val_start = c;
+-			char *endptr = NULL;
+-			uint64_t this_val = 0;
++		if (*c == ',')
++			goto badchar;
++		else {
++			val_start = c;
++			endptr = NULL;
+ 
+ 			this_val = strtoull(val_start, &endptr, 10);
+ 			if (!endptr) {
+ 				log_error("Could not parse histogram value.");
+-				return 0;
++				goto bad;
+ 			}
+ 			c = endptr; /* Advance to colon, or end. */
+ 
+ 			if (*c == ':')
+ 				c++;
+-			else if (*c & (*c != '\n')) {
++			else if (*c & (*c != '\n'))
+ 				/* Expected ':', '\n', or NULL. */
+-				stack;
+ 				goto badchar;
+-			}
+ 
+ 			if (*c == ':')
+ 				c++;
+@@ -763,7 +793,8 @@ static int _stats_parse_histogram(struct dm_pool *mem, char *hist_str,
+ 			cur.count = this_val;
+ 			sum += this_val;
+ 
+-			dm_pool_grow_object(mem, &cur, sizeof(cur));
++			if (!dm_pool_grow_object(mem, &cur, sizeof(cur)))
++				goto_bad;
+ 
+ 			bin++;
+ 		}
+@@ -778,6 +809,8 @@ static int _stats_parse_histogram(struct dm_pool *mem, char *hist_str,
+ 
+ badchar:
+ 	log_error("Invalid character in histogram data: '%c' (0x%x)", *c, *c);
++bad:
++	dm_pool_abandon_object(mem);
+ 	return 0;
+ }
+ 
+@@ -786,8 +819,8 @@ static int _stats_parse_region(struct dm_stats *dms, const char *resp,
+ 			       uint64_t timescale)
+ {
+ 	struct dm_histogram *hist = NULL;
+-	struct dm_stats_counters cur;
+ 	struct dm_pool *mem = dms->mem;
++	struct dm_stats_counters cur;
+ 	FILE *stats_rows = NULL;
+ 	uint64_t start, len;
+ 	char row[256];
+@@ -1040,12 +1073,12 @@ static int _stats_create_region(struct dm_stats *dms, uint64_t *region_id,
+ 				int precise, const char *hist_arg,
+ 				const char *program_id,	const char *aux_data)
+ {
+-	struct dm_task *dmt = NULL;
+-	char msg[1024], range[64];
+ 	const char *err_fmt = "Could not prepare @stats_create %s.";
+ 	const char *precise_str = PRECISE_ARG;
+ 	const char *resp, *opt_args = NULL;
+-	int r = 0, nr_opt = 0; /* number of optional args. */
++	char msg[1024], range[64], *endptr = NULL;
++	struct dm_task *dmt = NULL;
++	int r = 0, nr_opt = 0;
+ 
+ 	if (!_stats_bound(dms))
+ 		return_0;
+@@ -1105,7 +1138,6 @@ static int _stats_create_region(struct dm_stats *dms, uint64_t *region_id,
+ 	}
+ 
+ 	if (region_id) {
+-		char *endptr = NULL;
+ 		*region_id = strtoull(resp, &endptr, 10);
+ 		if (resp == endptr)
+ 			goto_out;
+@@ -1195,11 +1227,11 @@ static struct dm_task *_stats_print_region(struct dm_stats *dms,
+ 				    uint64_t region_id, unsigned start_line,
+ 				    unsigned num_lines, unsigned clear)
+ {
+-	struct dm_task *dmt = NULL;
+ 	/* @stats_print[_clear] <region_id> [<start_line> <num_lines>] */
+ 	const char *clear_str = "_clear", *lines_fmt = "%u %u";
+ 	const char *msg_fmt = "@stats_print%s " FMTu64 " %s";
+ 	const char *err_fmt = "Could not prepare @stats_print %s.";
++	struct dm_task *dmt = NULL;
+ 	char msg[1024], lines[64];
+ 
+ 	if (start_line || num_lines)
+@@ -1292,6 +1324,8 @@ int dm_stats_populate(struct dm_stats *dms, const char *program_id,
+ 		      uint64_t region_id)
+ {
+ 	int all_regions = (region_id == DM_STATS_REGIONS_ALL);
++	struct dm_task *dmt = NULL; /* @stats_print task */
++	const char *resp;
+ 
+ 	if (!_stats_bound(dms))
+ 		return_0;
+@@ -1311,9 +1345,6 @@ int dm_stats_populate(struct dm_stats *dms, const char *program_id,
+ 
+ 	dm_stats_walk_start(dms);
+ 	do {
+-		struct dm_task *dmt = NULL; /* @stats_print task */
+-		const char *resp;
+-
+ 		region_id = (all_regions)
+ 			     ? dm_stats_get_current_region(dms) : region_id;
+ 
+@@ -1967,10 +1998,12 @@ static struct dm_histogram *_alloc_dm_histogram(int nr_bins)
+ struct dm_histogram *dm_histogram_bounds_from_string(const char *bounds_str)
+ {
+ 	static const char *_valid_chars = "0123456789,muns";
+-	struct dm_histogram *dmh;
++	uint64_t this_val = 0, mult = 1;
++	const char *c, *v, *val_start;
+ 	struct dm_histogram_bin *cur;
+-	const char *c, *v;
++	struct dm_histogram *dmh;
+ 	int nr_entries = 1;
++	char *endptr;
+ 
+ 	c = bounds_str;
+ 
+@@ -2003,9 +2036,8 @@ struct dm_histogram *dm_histogram_bounds_from_string(const char *bounds_str)
+ 				  bounds_str);
+ 			goto bad;
+ 		} else {
+-			const char *val_start = c;
+-			char *endptr = NULL;
+-			uint64_t this_val = 0, mult = 1;
++			val_start = c;
++			endptr = NULL;
+ 
+ 			this_val = strtoull(val_start, &endptr, 10);
+ 			if (!endptr) {
+@@ -2058,10 +2090,10 @@ bad:
+ 
+ struct dm_histogram *dm_histogram_bounds_from_uint64(const uint64_t *bounds)
+ {
+-	struct dm_histogram *dmh;
++	const uint64_t *entry = bounds;
+ 	struct dm_histogram_bin *cur;
++	struct dm_histogram *dmh;
+ 	int nr_entries = 1;
+-	const uint64_t *entry = bounds;
+ 
+ 	if (!bounds || !bounds[0]) {
+ 		log_error("Could not parse empty histogram bounds array");
+@@ -2113,6 +2145,7 @@ void dm_histogram_bounds_destroy(struct dm_histogram *bounds)
+  */
+ static void _scale_bound_value_to_suffix(uint64_t *bound, const char **suffix)
+ {
++	*suffix = "ns";
+ 	if (!(*bound % NSEC_PER_SEC)) {
+ 		*bound /= NSEC_PER_SEC;
+ 		*suffix = "s";
+@@ -2191,12 +2224,14 @@ const char *dm_histogram_to_string(const struct dm_histogram *dmh, int bin,
+ 				   int width, int flags)
+ {
+ 	int minwidth, bounds, values, start, last;
+-	uint64_t lower, upper; /* bounds of the current bin. */
++	uint64_t lower, upper, val_u64; /* bounds of the current bin. */
+ 	/* Use the histogram pool for string building. */
+ 	struct dm_pool *mem = dmh->dms->hist_mem;
+ 	char buf[64], bounds_buf[64];
+ 	const char *sep = "";
++	int bounds_width;
+ 	ssize_t len = 0;
++	float val_flt;
+ 
+ 	bounds = flags & DM_HISTOGRAM_BOUNDS_MASK;
+ 	values = flags & DM_HISTOGRAM_VALUES;
+@@ -2222,12 +2257,11 @@ const char *dm_histogram_to_string(const struct dm_histogram *dmh, int bin,
+ 	/* Set bounds string to the empty string. */
+ 	bounds_buf[0] = '\0';
+ 
+-	dm_pool_begin_object(mem, 64);
++	if (!dm_pool_begin_object(mem, 64))
++		return_0;
+ 
+ 	for (bin = start; bin <= last; bin++) {
+ 		if (bounds) {
+-			int bounds_width;
+-
+ 			/* Default bounds width depends on time suffixes. */
+ 			bounds_width = (!(flags & DM_HISTOGRAM_SUFFIX))
+ 					? BOUND_WIDTH_NOSUFFIX
+@@ -2260,15 +2294,14 @@ const char *dm_histogram_to_string(const struct dm_histogram *dmh, int bin,
+ 
+ 		if (flags & DM_HISTOGRAM_PERCENT) {
+ 			dm_percent_t pr;
+-			float value;
+ 			pr = dm_histogram_get_bin_percent(dmh, bin);
+-			value = dm_percent_to_float(pr);
++			val_flt = dm_percent_to_float(pr);
+ 			len = dm_snprintf(buf, sizeof(buf), "%s%*.2f%%%s",
+-					  bounds_buf, width, value, sep);
++					  bounds_buf, width, val_flt, sep);
+ 		} else if (values) {
+-			uint64_t value = dmh->bins[bin].count;
++			val_u64 = dmh->bins[bin].count;
+ 			len = dm_snprintf(buf, sizeof(buf), "%s%*"PRIu64"%s",
+-					  bounds_buf, width, value, sep);
++					  bounds_buf, width, val_u64, sep);
+ 		} else if (bounds)
+ 			len = dm_snprintf(buf, sizeof(buf), "%s%s", bounds_buf,
+ 					  sep);
+@@ -2277,9 +2310,13 @@ const char *dm_histogram_to_string(const struct dm_histogram *dmh, int bin,
+ 			goto_bad;
+ 
+ 		width = minwidth; /* re-set histogram column width. */
+-		dm_pool_grow_object(mem, buf, (size_t) len);
++		if (!dm_pool_grow_object(mem, buf, (size_t) len))
++			goto_bad;
+ 	}
+-	dm_pool_grow_object(mem, "\0", 1);
++
++	if (!dm_pool_grow_object(mem, "\0", 1))
++		goto_bad;
++
+ 	return (const char *) dm_pool_end_object(mem);
+ 
+ bad:
+diff --git a/tools/dmsetup.c b/tools/dmsetup.c
+index 61ad5a9..8b7ad74 100644
+--- a/tools/dmsetup.c
++++ b/tools/dmsetup.c
+@@ -4674,6 +4674,7 @@ static int _do_stats_create_regions(struct dm_stats *dms,
+ 		return_0;
+ 
+ 	if (!(dmt = dm_task_create(DM_DEVICE_TABLE))) {
++		dm_histogram_bounds_destroy(bounds);
+ 		dm_stats_destroy(dms);
+ 		return_0;
+ 	}
diff --git a/SOURCES/lvm2-2_02_131-do-not-check-for-full-thin-pool-when-activating-without-messages.patch b/SOURCES/lvm2-2_02_131-do-not-check-for-full-thin-pool-when-activating-without-messages.patch
new file mode 100644
index 0000000..42cd4ec
--- /dev/null
+++ b/SOURCES/lvm2-2_02_131-do-not-check-for-full-thin-pool-when-activating-without-messages.patch
@@ -0,0 +1,29 @@
+ WHATS_NEW_DM          | 4 ++++
+ libdm/libdm-deptree.c | 2 +-
+ 2 files changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
+index b509d68..9e30786 100644
+--- a/WHATS_NEW_DM
++++ b/WHATS_NEW_DM
+@@ -1,3 +1,7 @@
++Version 1.02.108 - 
++=====================================
++  Do not check for full thin pool when activating without messages (1.02.107).
++
+ Version 1.02.107 - 5th September 2015
+ =====================================
+   Parse thin-pool status with one single routine internally.
+diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c
+index d40362d..7b7ca5b 100644
+--- a/libdm/libdm-deptree.c
++++ b/libdm/libdm-deptree.c
+@@ -1633,7 +1633,7 @@ static int _node_send_messages(struct dm_tree_node *dnode,
+ 		return 0;
+ 	}
+ 
+-	if (!send)
++	if (!have_messages || !send)
+ 		return 1; /* transaction_id is matching */
+ 
+ 	dm_list_iterate_items(tmsg, &seg->thin_messages) {
diff --git a/SOURCES/lvm2-2_02_131-fix-vg-metadata-comparison-failure-while-scanning-the-vg-for-lvmetad.patch b/SOURCES/lvm2-2_02_131-fix-vg-metadata-comparison-failure-while-scanning-the-vg-for-lvmetad.patch
new file mode 100644
index 0000000..b5374a9
--- /dev/null
+++ b/SOURCES/lvm2-2_02_131-fix-vg-metadata-comparison-failure-while-scanning-the-vg-for-lvmetad.patch
@@ -0,0 +1,28 @@
+ WHATS_NEW           | 1 +
+ lib/cache/lvmetad.c | 2 +-
+ 2 files changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/WHATS_NEW b/WHATS_NEW
+index 5de648c..9ddecbc 100644
+--- a/WHATS_NEW
++++ b/WHATS_NEW
+@@ -1,5 +1,6 @@
+ Version 2.02.131 - 
+ =====================================
++  Fix VG metadata comparison failure while scanning the VG for lvmetad.
+   Ignore persistent cache if configuration changed. (2.02.127)
+ 
+ Version 2.02.130 - 5th September 2015
+diff --git a/lib/cache/lvmetad.c b/lib/cache/lvmetad.c
+index b2e2f55..0fff65a 100644
+--- a/lib/cache/lvmetad.c
++++ b/lib/cache/lvmetad.c
+@@ -1174,7 +1174,7 @@ static struct volume_group *lvmetad_pvscan_vg(struct cmd_context *cmd, struct vo
+ 		if (!vgmeta_ret) {
+ 			vgmeta_ret = vgmeta;
+ 		} else {
+-			if (!compare_config(vgmeta_ret->root, vgmeta->root)) {
++			if (compare_config(vgmeta_ret->root, vgmeta->root)) {
+ 				log_error("VG metadata comparison failed");
+ 				dm_config_destroy(vgmeta);
+ 				dm_config_destroy(vgmeta_ret);
diff --git a/SOURCES/lvm2-2_02_131-fix-vgimportclone-cache_dir-path-name.patch b/SOURCES/lvm2-2_02_131-fix-vgimportclone-cache_dir-path-name.patch
new file mode 100644
index 0000000..cdc432d
--- /dev/null
+++ b/SOURCES/lvm2-2_02_131-fix-vgimportclone-cache_dir-path-name.patch
@@ -0,0 +1,37 @@
+ WHATS_NEW                | 1 +
+ scripts/vgimportclone.sh | 4 ++--
+ 2 files changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/WHATS_NEW b/WHATS_NEW
+index f41475c..1718c29 100644
+--- a/WHATS_NEW
++++ b/WHATS_NEW
+@@ -1,5 +1,6 @@
+ Version 2.02.131 - 
+ =====================================
++  Fix vgimportclone cache_dir path name (2.02.115).
+   Disallow usage of --stripe and --stripesize when creating cache pool.
+   Swapping of LV identifiers handles more complex LVs.
+   Fix VG metadata comparison failure while scanning the VG for lvmetad.
+diff --git a/scripts/vgimportclone.sh b/scripts/vgimportclone.sh
+index 388d14c..af8cf5c 100755
+--- a/scripts/vgimportclone.sh
++++ b/scripts/vgimportclone.sh
+@@ -1,7 +1,7 @@
+ #!/bin/bash
+ 
+ # Copyright (C) 2009 Chris Procter All rights reserved.
+-# Copyright (C) 2009 Red Hat, Inc. All rights reserved.
++# Copyright (C) 2009-2015 Red Hat, Inc. All rights reserved.
+ #
+ # This file is part of LVM2.
+ #
+@@ -239,7 +239,7 @@ LVMCONF=${TMP_LVM_SYSTEM_DIR}/lvm.conf
+ 
+ CMD_CONFIG_LINE="devices { \
+                    scan = [ \"${TMP_LVM_SYSTEM_DIR}\" ] \
+-                   cache_dir = \"$TMP_LVM_SYSTEM_DIR}/cache\"
++                   cache_dir = \"${TMP_LVM_SYSTEM_DIR}/cache\"
+                    global_filter = [ \"a|.*|\" ] \
+                    ${FILTER}
+                  } \
diff --git a/SOURCES/lvm2-2_02_131-ignore-persistent-cache-if-configuration-changed.patch b/SOURCES/lvm2-2_02_131-ignore-persistent-cache-if-configuration-changed.patch
new file mode 100644
index 0000000..05ae6f8
--- /dev/null
+++ b/SOURCES/lvm2-2_02_131-ignore-persistent-cache-if-configuration-changed.patch
@@ -0,0 +1,49 @@
+ WHATS_NEW          | 4 ++++
+ tools/lvmcmdline.c | 8 +++++++-
+ 2 files changed, 11 insertions(+), 1 deletion(-)
+
+diff --git a/WHATS_NEW b/WHATS_NEW
+index e74fd55..5de648c 100644
+--- a/WHATS_NEW
++++ b/WHATS_NEW
+@@ -1,3 +1,7 @@
++Version 2.02.131 - 
++=====================================
++  Ignore persistent cache if configuration changed. (2.02.127)
++
+ Version 2.02.130 - 5th September 2015
+ =====================================
+   Fix use of uninitialized device status if reading outdated .cache record.
+diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
+index b7809c7..d3bace7 100644
+--- a/tools/lvmcmdline.c
++++ b/tools/lvmcmdline.c
+@@ -1478,6 +1478,7 @@ int lvm_run_command(struct cmd_context *cmd, int argc, char **argv)
+ 	char *arg_new, *arg;
+ 	int i;
+ 	int skip_hyphens;
++	int refresh_done = 0;
+ 
+ 	init_error_message_produced(0);
+ 
+@@ -1554,6 +1555,7 @@ int lvm_run_command(struct cmd_context *cmd, int argc, char **argv)
+ 			log_error("Updated config file invalid. Aborting.");
+ 			return ECMD_FAILED;
+ 		}
++		refresh_done = 1;
+ 	}
+ 
+ 	if (!_prepare_profiles(cmd))
+@@ -1562,7 +1564,11 @@ int lvm_run_command(struct cmd_context *cmd, int argc, char **argv)
+ 	if (!cmd->initialized.connections && !_cmd_no_meta_proc(cmd) && !init_connections(cmd))
+ 		return_ECMD_FAILED;
+ 
+-	if (!cmd->initialized.filters && !_cmd_no_meta_proc(cmd) && !init_filters(cmd, 1))
++	/* Note: Load persistent cache only if we haven't refreshed toolcontext!
++	 *       If toolcontext has been refreshed, it means config has changed
++	 *       and we can't rely on persistent cache anymore.
++	 */
++	if (!cmd->initialized.filters && !_cmd_no_meta_proc(cmd) && !init_filters(cmd, !refresh_done))
+ 		return_ECMD_FAILED;
+ 
+ 	if (arg_count(cmd, readonly_ARG))
diff --git a/SOURCES/lvm2-2_02_131-standardise-error-paths.patch b/SOURCES/lvm2-2_02_131-standardise-error-paths.patch
new file mode 100644
index 0000000..72485e7
--- /dev/null
+++ b/SOURCES/lvm2-2_02_131-standardise-error-paths.patch
@@ -0,0 +1,2169 @@
+commit fb8220fb6961e563d6a760a70bd1e1b27a62bde0
+Author: Alasdair G Kergon <agk@redhat.com>
+Date:   Sat Sep 5 23:56:30 2015 +0100
+
+    style: Standardise some error paths.
+---
+ daemons/cmirrord/functions.c   |   4 +-
+ daemons/lvmetad/lvmetad-core.c |   2 +-
+ lib/metadata/metadata.c        |   3 +-
+ libdm/libdm-file.c             |   4 +-
+ libdm/libdm-report.c           |   2 +-
+ libdm/libdm-stats.c            | 197 +++++++++--------
+ liblvm/lvm_pv.c                |   5 +-
+ tools/dmsetup.c                | 475 +++++++++++++++++++++--------------------
+ 8 files changed, 355 insertions(+), 337 deletions(-)
+
+diff --git a/daemons/cmirrord/functions.c b/daemons/cmirrord/functions.c
+index 61b3e11..4f36cc6 100644
+--- a/daemons/cmirrord/functions.c
++++ b/daemons/cmirrord/functions.c
+@@ -1445,7 +1445,7 @@ static int disk_status_info(struct log_c *lc, struct dm_ulog_request *rq)
+ 	char *data = (char *)rq->data;
+ 	struct stat statbuf;
+ 
+-	if(fstat(lc->disk_fd, &statbuf)) {
++	if (fstat(lc->disk_fd, &statbuf)) {
+ 		rq->error = -errno;
+ 		return -errno;
+ 	}
+@@ -1508,7 +1508,7 @@ static int disk_status_table(struct log_c *lc, struct dm_ulog_request *rq)
+ 	char *data = (char *)rq->data;
+ 	struct stat statbuf;
+ 
+-	if(fstat(lc->disk_fd, &statbuf)) {
++	if (fstat(lc->disk_fd, &statbuf)) {
+ 		rq->error = -errno;
+ 		return -errno;
+ 	}
+diff --git a/daemons/lvmetad/lvmetad-core.c b/daemons/lvmetad/lvmetad-core.c
+index 19e8723..89aaaf8 100644
+--- a/daemons/lvmetad/lvmetad-core.c
++++ b/daemons/lvmetad/lvmetad-core.c
+@@ -578,7 +578,7 @@ static void mark_outdated_pv(lvmetad_state *s, const char *vgid, const char *pvi
+ 		    !(cft_vgid = make_text_node(outdated_pvs, "vgid", dm_pool_strdup(outdated_pvs->mem, vgid),
+ 						outdated_pvs->root, NULL)))
+ 			abort();
+-		if(!dm_hash_insert(s->vgid_to_outdated_pvs, cft_vgid->v->v.str, outdated_pvs))
++		if (!dm_hash_insert(s->vgid_to_outdated_pvs, cft_vgid->v->v.str, outdated_pvs))
+ 			abort();
+ 		DEBUGLOG(s, "created outdated_pvs list for VG %s", vgid);
+ 	}
+diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
+index 8757331..b45f850 100644
+--- a/lib/metadata/metadata.c
++++ b/lib/metadata/metadata.c
+@@ -319,10 +319,11 @@ static struct pv_list *_copy_pvl(struct dm_pool *pvmem, struct pv_list *pvl_from
+ 	if (!(pvl_to->pv = dm_pool_alloc(pvmem, sizeof(*pvl_to->pv))))
+ 		goto_bad;
+ 
+-	if(!_copy_pv(pvmem, pvl_to->pv, pvl_from->pv))
++	if (!_copy_pv(pvmem, pvl_to->pv, pvl_from->pv))
+ 		goto_bad;
+ 
+ 	return pvl_to;
++
+ bad:
+ 	dm_pool_free(pvmem, pvl_to);
+ 	return NULL;
+diff --git a/libdm/libdm-file.c b/libdm/libdm-file.c
+index 52f9d45..e4beddd 100644
+--- a/libdm/libdm-file.c
++++ b/libdm/libdm-file.c
+@@ -119,8 +119,8 @@ int dm_create_lockfile(const char *lockfile)
+ 	char buffer[50];
+ 	int retries = 0;
+ 
+-	if((fd = open(lockfile, O_CREAT | O_WRONLY,
+-		      (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH))) < 0) {
++	if ((fd = open(lockfile, O_CREAT | O_WRONLY,
++		       (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH))) < 0) {
+ 		log_error("Cannot open lockfile [%s], error was [%s]",
+ 			  lockfile, strerror(errno));
+ 		return 0;
+diff --git a/libdm/libdm-report.c b/libdm/libdm-report.c
+index 6416f18..10ab7df 100644
+--- a/libdm/libdm-report.c
++++ b/libdm/libdm-report.c
+@@ -4195,7 +4195,7 @@ static void _destroy_rows(struct dm_report *rh)
+ 	 * pool allocation this will also free all subsequently allocated
+ 	 * rows from the report and any associated string data.
+ 	 */
+-	if(rh->first_row)
++	if (rh->first_row)
+ 		dm_pool_free(rh->mem, rh->first_row);
+ 	rh->first_row = NULL;
+ 	dm_list_init(&rh->rows);
+diff --git a/libdm/libdm-stats.c b/libdm/libdm-stats.c
+index 736aae5..93c7760 100644
+--- a/libdm/libdm-stats.c
++++ b/libdm/libdm-stats.c
+@@ -105,7 +105,7 @@ static char *_program_id_from_proc(void)
+ 
+ 	if (!fgets(buf, sizeof(buf), comm)) {
+ 		log_error("Could not read from %s", PROC_SELF_COMM);
+-		if(fclose(comm))
++		if (fclose(comm))
+ 			stack;
+ 		return NULL;
+ 	}
+@@ -145,7 +145,7 @@ struct dm_stats *dm_stats_create(const char *program_id)
+ 
+ 	/* FIXME: better hint. */
+ 	if (!(dms->mem = dm_pool_create("stats_pool", 4096)))
+-		goto_out;
++		goto_bad;
+ 
+ 	if (!(dms->hist_mem = dm_pool_create("histogram_pool", hist_hint)))
+ 		return_0;
+@@ -169,7 +169,8 @@ struct dm_stats *dm_stats_create(const char *program_id)
+ 	dms->regions = NULL;
+ 
+ 	return dms;
+-out:
++
++bad:
+ 	dm_free(dms);
+ 	return NULL;
+ }
+@@ -354,7 +355,7 @@ static char *_build_histogram_arg(struct dm_histogram *bounds, int *precise)
+ 		hist_len += 1 + (size_t) lround(log10(value));
+ 	}
+ 
+-	if(!(hist_arg = dm_zalloc(hist_len))) {
++	if (!(hist_arg = dm_zalloc(hist_len))) {
+ 		log_error("Could not allocate memory for histogram argument.");
+ 		return 0;
+ 	}
+@@ -373,14 +374,16 @@ static char *_build_histogram_arg(struct dm_histogram *bounds, int *precise)
+ 		value = entry->upper / scale;
+ 		if ((l = dm_snprintf(arg, hist_len - len, FMTu64"%s", value,
+ 				     (last) ? "" : ",")) < 0)
+-			goto out;
++			goto_bad;
+ 		len += (size_t) l;
+ 		arg += (size_t) l;
+ 	}
+ 	return hist_arg;
+-out:
++
++bad:
+ 	log_error("Could not build histogram arguments.");
+ 	dm_free(hist_arg);
++
+ 	return NULL;
+ }
+ 
+@@ -392,16 +395,17 @@ static struct dm_task *_stats_send_message(struct dm_stats *dms, char *msg)
+ 		return_0;
+ 
+ 	if (!_set_stats_device(dms, dmt))
+-		goto_out;
++		goto_bad;
+ 
+ 	if (!dm_task_set_message(dmt, msg))
+-		goto_out;
++		goto_bad;
+ 
+ 	if (!dm_task_run(dmt))
+-		goto_out;
++		goto_bad;
+ 
+ 	return dmt;
+-out:
++
++bad:
+ 	dm_task_destroy(dmt);
+ 	return NULL;
+ }
+@@ -425,7 +429,7 @@ static int _stats_parse_histogram_spec(struct dm_stats *dms,
+ 
+ 	/* Advance past "histogram:". */
+ 	histogram = strchr(histogram, ':');
+-	if(!histogram) {
++	if (!histogram) {
+ 		log_error("Could not parse histogram description.");
+ 		return 0;
+ 	}
+@@ -444,21 +448,23 @@ static int _stats_parse_histogram_spec(struct dm_stats *dms,
+ 	hist.region = region;
+ 	hist.dms = dms;
+ 
+-	if(!dm_pool_grow_object(mem, &hist, sizeof(hist)))
+-		goto_out;
++	if (!dm_pool_grow_object(mem, &hist, sizeof(hist)))
++		goto_bad;
+ 
+ 	c = histogram;
+ 	do {
+-		for(v = _valid_chars; *v; v++)
++		for (v = _valid_chars; *v; v++)
+ 			if (*c == *v)
+ 				break;
+-		if(!*v)
++		if (!*v) {
++			stack;
+ 			goto badchar;
++		}
+ 
+ 		if (*c == ',') {
+ 			log_error("Invalid histogram description: %s",
+ 				  histogram);
+-			goto out;
++			goto bad;
+ 		} else {
+ 			const char *val_start = c;
+ 			char *endptr = NULL;
+@@ -467,15 +473,17 @@ static int _stats_parse_histogram_spec(struct dm_stats *dms,
+ 			this_val = strtoull(val_start, &endptr, 10);
+ 			if (!endptr) {
+ 				log_error("Could not parse histogram boundary.");
+-				goto out;
++				goto bad;
+ 			}
+ 
+ 			c = endptr; /* Advance to units, comma, or end. */
+ 
+ 			if (*c == ',')
+ 				c++;
+-			else if (*c || (*c == ' ')) /* Expected ',' or NULL. */
++			else if (*c || (*c == ' ')) { /* Expected ',' or NULL. */
++				stack;
+ 				goto badchar;
++			}
+ 
+ 			if (*c == ',')
+ 				c++;
+@@ -484,7 +492,7 @@ static int _stats_parse_histogram_spec(struct dm_stats *dms,
+ 			cur.count = 0;
+ 
+ 			if (!dm_pool_grow_object(mem, &cur, sizeof(cur)))
+-				goto_out;
++				goto_bad;
+ 
+ 			nr_bins++;
+ 		}
+@@ -493,7 +501,7 @@ static int _stats_parse_histogram_spec(struct dm_stats *dms,
+ 	/* final upper bound. */
+ 	cur.upper = UINT64_MAX;
+ 	if (!dm_pool_grow_object(mem, &cur, sizeof(cur)))
+-		goto_out;
++		goto_bad;
+ 
+ 	region->bounds = dm_pool_end_object(mem);
+ 
+@@ -507,7 +515,7 @@ static int _stats_parse_histogram_spec(struct dm_stats *dms,
+ 
+ badchar:
+ 	log_error("Invalid character in histogram: '%c' (0x%x)", *c, *c);
+-out:
++bad:
+ 	dm_pool_abandon_object(mem);
+ 	return 0;
+ }
+@@ -614,12 +622,12 @@ static int _stats_parse_list(struct dm_stats *dms, const char *resp)
+ 		return_0;
+ 
+ 	if (!dm_pool_begin_object(mem, 1024))
+-		goto_out;
++		goto_bad;
+ 
+ 	while(fgets(line, sizeof(line), list_rows)) {
+ 
+ 		if (!_stats_parse_list_region(dms, &cur, line))
+-			goto_out;
++			goto_bad;
+ 
+ 		/* handle holes in the list of region_ids */
+ 		if (cur.region_id > max_region) {
+@@ -628,12 +636,12 @@ static int _stats_parse_list(struct dm_stats *dms, const char *resp)
+ 			fill.region_id = DM_STATS_REGION_NOT_PRESENT;
+ 			do {
+ 				if (!dm_pool_grow_object(mem, &fill, sizeof(fill)))
+-					goto_out;
++					goto_bad;
+ 			} while (max_region++ < (cur.region_id - 1));
+ 		}
+ 
+ 		if (!dm_pool_grow_object(mem, &cur, sizeof(cur)))
+-			goto_out;
++			goto_bad;
+ 
+ 		max_region++;
+ 		nr_regions++;
+@@ -647,10 +655,12 @@ static int _stats_parse_list(struct dm_stats *dms, const char *resp)
+ 		stack;
+ 
+ 	return 1;
+-out:
+-	if(fclose(list_rows))
++
++bad:
++	if (fclose(list_rows))
+ 		stack;
+ 	dm_pool_abandon_object(mem);
++
+ 	return 0;
+ }
+ 
+@@ -675,17 +685,17 @@ int dm_stats_list(struct dm_stats *dms, const char *program_id)
+ 	}
+ 
+ 	if (!(dmt = _stats_send_message(dms, msg)))
+-		return 0;
++		return_0;
+ 
+ 	if (!_stats_parse_list(dms, dm_task_get_message_response(dmt))) {
+ 		log_error("Could not parse @stats_list response.");
+-		goto out;
++		goto bad;
+ 	}
+ 
+ 	dm_task_destroy(dmt);
+ 	return 1;
+ 
+-out:
++bad:
+ 	dm_task_destroy(dmt);
+ 	return 0;
+ }
+@@ -715,15 +725,17 @@ static int _stats_parse_histogram(struct dm_pool *mem, char *hist_str,
+ 
+ 	do {
+ 		memset(&cur, 0, sizeof(cur));
+-		for(v = _valid_chars; *v; v++)
++		for (v = _valid_chars; *v; v++)
+ 			if (*c == *v)
+ 				break;
+-		if(!*v)
++		if (!*v) {
++			stack;
+ 			goto badchar;
++		}
+ 
+ 		if (*c == ',') {
+ 			log_error("Invalid histogram: %s", hist_str);
+-			goto out;
++			return 0;
+ 		} else {
+ 			const char *val_start = c;
+ 			char *endptr = NULL;
+@@ -732,15 +744,17 @@ static int _stats_parse_histogram(struct dm_pool *mem, char *hist_str,
+ 			this_val = strtoull(val_start, &endptr, 10);
+ 			if (!endptr) {
+ 				log_error("Could not parse histogram value.");
+-				goto out;
++				return 0;
+ 			}
+ 			c = endptr; /* Advance to colon, or end. */
+ 
+ 			if (*c == ':')
+ 				c++;
+-			else if (*c & (*c != '\n'))
++			else if (*c & (*c != '\n')) {
+ 				/* Expected ':', '\n', or NULL. */
++				stack;
+ 				goto badchar;
++			}
+ 
+ 			if (*c == ':')
+ 				c++;
+@@ -764,7 +778,6 @@ static int _stats_parse_histogram(struct dm_pool *mem, char *hist_str,
+ 
+ badchar:
+ 	log_error("Invalid character in histogram data: '%c' (0x%x)", *c, *c);
+-out:
+ 	return 0;
+ }
+ 
+@@ -788,7 +801,7 @@ static int _stats_parse_region(struct dm_stats *dms, const char *resp,
+ 	region->start = UINT64_MAX;
+ 
+ 	if (!dm_pool_begin_object(mem, 512))
+-		goto_out;
++		goto_bad;
+ 
+ 	/*
+ 	 * dm_task_get_message_response() returns a 'const char *' but
+@@ -796,7 +809,7 @@ static int _stats_parse_region(struct dm_stats *dms, const char *resp,
+ 	 */
+ 	stats_rows = fmemopen((char *)resp, strlen(resp), "r");
+ 	if (!stats_rows)
+-		goto_out;
++		goto_bad;
+ 
+ 	/*
+ 	 * Output format for each step-sized area of a region:
+@@ -844,7 +857,7 @@ static int _stats_parse_region(struct dm_stats *dms, const char *resp,
+ 			   &cur.total_read_nsecs, &cur.total_write_nsecs);
+ 		if (r != 15) {
+ 			log_error("Could not parse @stats_print row.");
+-			goto out;
++			goto bad;
+ 		}
+ 
+ 		/* scale time values up if needed */
+@@ -862,7 +875,7 @@ static int _stats_parse_region(struct dm_stats *dms, const char *resp,
+ 			char *hist_str = strchr(row, ':');
+ 			if (!hist_str) {
+ 				log_error("Could not parse histogram value.");
+-				goto out;
++				goto bad;
+ 			}
+ 			/* Find space preceding histogram. */
+ 			while (hist_str && *(hist_str - 1) != ' ')
+@@ -874,15 +887,15 @@ static int _stats_parse_region(struct dm_stats *dms, const char *resp,
+ 			 */
+ 			if (!_stats_parse_histogram(dms->hist_mem, hist_str,
+ 						    &hist, region))
+-				goto out;
++				goto_bad;
+ 			hist->dms = dms;
+ 			hist->region = region;
+ 		}
+ 
+ 		cur.histogram = hist;
+ 
+-		if(!dm_pool_grow_object(mem, &cur, sizeof(cur)))
+-			goto_out;
++		if (!dm_pool_grow_object(mem, &cur, sizeof(cur)))
++			goto_bad;
+ 
+ 		if (region->start == UINT64_MAX) {
+ 			region->start = start;
+@@ -899,12 +912,12 @@ static int _stats_parse_region(struct dm_stats *dms, const char *resp,
+ 
+ 	return 1;
+ 
+-out:
+-
++bad:
+ 	if (stats_rows)
+-		if(fclose(stats_rows))
++		if (fclose(stats_rows))
+ 			stack;
+ 	dm_pool_abandon_object(mem);
++
+ 	return 0;
+ }
+ 
+@@ -1017,7 +1030,7 @@ int dm_stats_get_region_nr_histogram_bins(const struct dm_stats *dms,
+ 		     ? dms->cur_region : region_id ;
+ 
+ 	if (!dms->regions[region_id].bounds)
+-		return 0;
++		return_0;
+ 
+ 	return dms->regions[region_id].bounds->nr_bins;
+ }
+@@ -1083,7 +1096,7 @@ static int _stats_create_region(struct dm_stats *dms, uint64_t *region_id,
+ 	}
+ 
+ 	if (!(dmt = _stats_send_message(dms, msg)))
+-		goto out;
++		goto_out;
+ 
+ 	resp = dm_task_get_message_response(dmt);
+ 	if (!resp) {
+@@ -1101,9 +1114,10 @@ static int _stats_create_region(struct dm_stats *dms, uint64_t *region_id,
+ 	r = 1;
+ 
+ out:
+-	if(dmt)
++	if (dmt)
+ 		dm_task_destroy(dmt);
+ 	dm_free((void *) opt_args);
++
+ 	return r;
+ }
+ 
+@@ -1116,9 +1130,8 @@ int dm_stats_create_region(struct dm_stats *dms, uint64_t *region_id,
+ 	int r = 0;
+ 
+ 	/* Nanosecond counters and histograms both need precise_timestamps. */
+-	if ((precise || bounds)
+-	    && !_stats_check_precise_timestamps(dms))
+-		return 0;
++	if ((precise || bounds) && !_stats_check_precise_timestamps(dms))
++		return_0;
+ 
+ 	if (bounds) {
+ 		/* _build_histogram_arg enables precise if vals < 1ms. */
+@@ -1129,6 +1142,7 @@ int dm_stats_create_region(struct dm_stats *dms, uint64_t *region_id,
+ 	r = _stats_create_region(dms, region_id, start, len, step,
+ 				 precise, hist_arg, program_id, aux_data);
+ 	dm_free(hist_arg);
++
+ out:
+ 	return r;
+ }
+@@ -1143,17 +1157,15 @@ int dm_stats_delete_region(struct dm_stats *dms, uint64_t region_id)
+ 
+ 	if (!dm_snprintf(msg, sizeof(msg), "@stats_delete " FMTu64, region_id)) {
+ 		log_error("Could not prepare @stats_delete message.");
+-		goto out;
++		return 0;
+ 	}
+ 
+ 	dmt = _stats_send_message(dms, msg);
+ 	if (!dmt)
+-		goto_out;
++		return_0;
+ 	dm_task_destroy(dmt);
+-	return 1;
+ 
+-out:
+-	return 0;
++	return 1;
+ }
+ 
+ int dm_stats_clear_region(struct dm_stats *dms, uint64_t region_id)
+@@ -1166,17 +1178,17 @@ int dm_stats_clear_region(struct dm_stats *dms, uint64_t region_id)
+ 
+ 	if (!dm_snprintf(msg, sizeof(msg), "@stats_clear " FMTu64, region_id)) {
+ 		log_error("Could not prepare @stats_clear message.");
+-		goto out;
++		return 0;
+ 	}
+ 
+ 	dmt = _stats_send_message(dms, msg);
++
+ 	if (!dmt)
+-		goto_out;
++		return_0;
++
+ 	dm_task_destroy(dmt);
+-	return 1;
+ 
+-out:
+-	return 0;
++	return 1;
+ }
+ 
+ static struct dm_task *_stats_print_region(struct dm_stats *dms,
+@@ -1194,22 +1206,19 @@ static struct dm_task *_stats_print_region(struct dm_stats *dms,
+ 		if (!dm_snprintf(lines, sizeof(lines),
+ 				 lines_fmt, start_line, num_lines)) {
+ 			log_error(err_fmt, "row specification");
+-			goto out;
++			return NULL;
+ 		}
+ 
+ 	if (!dm_snprintf(msg, sizeof(msg), msg_fmt, (clear) ? clear_str : "",
+ 			 region_id, (start_line || num_lines) ? lines : "")) {
+ 		log_error(err_fmt, "message");
+-		goto out;
++		return NULL;
+ 	}
+ 
+ 	if (!(dmt = _stats_send_message(dms, msg)))
+-		goto out;
++		return_NULL;
+ 
+ 	return dmt;
+-
+-out:
+-	return NULL;
+ }
+ 
+ char *dm_stats_print_region(struct dm_stats *dms, uint64_t region_id,
+@@ -1226,7 +1235,7 @@ char *dm_stats_print_region(struct dm_stats *dms, uint64_t region_id,
+ 				  start_line, num_lines, clear);
+ 
+ 	if (!dmt)
+-		return 0;
++		return_0;
+ 
+ 	resp = dm_pool_strdup(dms->mem, dm_task_get_message_response(dmt));
+ 	dm_task_destroy(dmt);
+@@ -1245,7 +1254,7 @@ void dm_stats_buffer_destroy(struct dm_stats *dms, char *buffer)
+ uint64_t dm_stats_get_nr_regions(const struct dm_stats *dms)
+ {
+ 	if (!dms || !dms->regions)
+-		return 0;
++		return_0;
+ 	return dms->nr_regions;
+ }
+ 
+@@ -1255,10 +1264,10 @@ uint64_t dm_stats_get_nr_regions(const struct dm_stats *dms)
+ int dm_stats_region_present(const struct dm_stats *dms, uint64_t region_id)
+ {
+ 	if (!dms->regions)
+-		return 0;
++		return_0;
+ 
+ 	if (region_id > dms->max_region)
+-		return 0;
++		return_0;
+ 
+ 	return _stats_region_present(&dms->regions[region_id]);
+ }
+@@ -1293,12 +1302,12 @@ int dm_stats_populate(struct dm_stats *dms, const char *program_id,
+ 
+ 	if (all_regions && !dm_stats_list(dms, program_id)) {
+ 		log_error("Could not parse @stats_list response.");
+-		goto out;
++		goto bad;
+ 	}
+ 
+ 	/* successful list but no regions registered */
+ 	if (!dms->nr_regions)
+-		return 0;
++		return_0;
+ 
+ 	dm_stats_walk_start(dms);
+ 	do {
+@@ -1310,12 +1319,12 @@ int dm_stats_populate(struct dm_stats *dms, const char *program_id,
+ 
+ 		/* obtain all lines and clear counter values */
+ 		if (!(dmt = _stats_print_region(dms, region_id, 0, 0, 1)))
+-			goto_out;
++			goto_bad;
+ 
+ 		resp = dm_task_get_message_response(dmt);
+ 		if (!_dm_stats_populate_region(dms, region_id, resp)) {
+ 			dm_task_destroy(dmt);
+-			goto_out;
++			goto_bad;
+ 		}
+ 
+ 		dm_task_destroy(dmt);
+@@ -1325,7 +1334,7 @@ int dm_stats_populate(struct dm_stats *dms, const char *program_id,
+ 
+ 	return 1;
+ 
+-out:
++bad:
+ 	_stats_regions_destroy(dms);
+ 	dms->regions = NULL;
+ 	return 0;
+@@ -1620,10 +1629,10 @@ int dm_stats_get_service_time(const struct dm_stats *dms, double *svctm,
+ 	double tput;
+ 
+ 	if (!dm_stats_get_throughput(dms, &tput, region_id, area_id))
+-		return 0;
++		return_0;
+ 
+ 	if (!dm_stats_get_utilization(dms, &util, region_id, area_id))
+-		return 0;
++		return_0;
+ 
+ 	/* avoid NAN with zero counter values */
+ 	if ( (uint64_t) tput == 0 || (uint64_t) util == 0) {
+@@ -1973,23 +1982,26 @@ struct dm_histogram *dm_histogram_bounds_from_string(const char *bounds_str)
+ 	c = bounds_str;
+ 
+ 	if (!(dmh = _alloc_dm_histogram(nr_entries)))
+-		return 0;
++		return_0;
+ 
+ 	dmh->nr_bins = nr_entries;
+ 
+ 	cur = dmh->bins;
+ 
+ 	do {
+-		for(v = _valid_chars; *v; v++)
++		for (v = _valid_chars; *v; v++)
+ 			if (*c == *v)
+ 				break;
+-		if(!*v)
++
++		if (!*v) {
++			stack;
+ 			goto badchar;
++		}
+ 
+ 		if (*c == ',') {
+ 			log_error("Empty histogram bin not allowed: %s",
+ 				  bounds_str);
+-			goto out;
++			goto bad;
+ 		} else {
+ 			const char *val_start = c;
+ 			char *endptr = NULL;
+@@ -1998,7 +2010,7 @@ struct dm_histogram *dm_histogram_bounds_from_string(const char *bounds_str)
+ 			this_val = strtoull(val_start, &endptr, 10);
+ 			if (!endptr) {
+ 				log_error("Could not parse histogram bound.");
+-				goto out;
++				goto bad;
+ 			}
+ 			c = endptr; /* Advance to units, comma, or end. */
+ 
+@@ -2012,13 +2024,17 @@ struct dm_histogram *dm_histogram_bounds_from_string(const char *bounds_str)
+ 					mult = NSEC_PER_USEC;
+ 				else if (*c == 'n')
+ 					mult = 1;
+-				else
++				else {
++					stack;
+ 					goto badchar;
++				}
+ 				c += 2; /* Advance over 'ms', 'us', or 'ns'. */
+ 			} else if (*c == ',')
+ 				c++;
+-			else if (*c) /* Expected ',' or NULL. */
++			else if (*c) { /* Expected ',' or NULL. */
++				stack;
+ 				goto badchar;
++			}
+ 
+ 			if (*c == ',')
+ 				c++;
+@@ -2035,7 +2051,7 @@ struct dm_histogram *dm_histogram_bounds_from_string(const char *bounds_str)
+ 
+ badchar:
+ 	log_error("Invalid character in histogram: %c", *c);
+-out:
++bad:
+ 	dm_free(dmh);
+ 	return NULL;
+ }
+@@ -2121,7 +2137,7 @@ static int _make_bounds_string(char *buf, size_t size, uint64_t lower,
+ 	int bounds = flags & DM_HISTOGRAM_BOUNDS_MASK;
+ 
+ 	if (!bounds)
+-		return 0;
++		return_0;
+ 
+ 	*buf = '\0';
+ 
+@@ -2258,14 +2274,15 @@ const char *dm_histogram_to_string(const struct dm_histogram *dmh, int bin,
+ 					  sep);
+ 
+ 		if (len < 0)
+-			goto_out;
++			goto_bad;
+ 
+ 		width = minwidth; /* re-set histogram column width. */
+ 		dm_pool_grow_object(mem, buf, (size_t) len);
+ 	}
+ 	dm_pool_grow_object(mem, "\0", 1);
+ 	return (const char *) dm_pool_end_object(mem);
+-out:
++
++bad:
+ 	dm_pool_abandon_object(mem);
+ 	return NULL;
+ }
+diff --git a/liblvm/lvm_pv.c b/liblvm/lvm_pv.c
+index 24b2732..5933e0a 100644
+--- a/liblvm/lvm_pv.c
++++ b/liblvm/lvm_pv.c
+@@ -155,9 +155,8 @@ static struct dm_list *_lvm_list_pvs(lvm_t libh)
+ 	} else {
+ 		dm_list_init(&rc->pvslist);
+ 		dm_list_init(&rc->vgslist);
+-		if( !get_pvs_perserve_vg(cmd, &rc->pvslist, &rc->vgslist) ) {
+-			return NULL;
+-		}
++		if (!get_pvs_perserve_vg(cmd, &rc->pvslist, &rc->vgslist))
++			return_NULL;
+ 
+ 		/*
+ 		 * If we have no PVs we still need to have access to cmd
+diff --git a/tools/dmsetup.c b/tools/dmsetup.c
+index 8983e18..61ad5a9 100644
+--- a/tools/dmsetup.c
++++ b/tools/dmsetup.c
+@@ -327,7 +327,7 @@ static int _parse_line(struct dm_task *dmt, char *buffer, const char *file,
+ 		*comment = '\0';
+ 
+ 	if (!dm_task_add_target(dmt, start, size, ttype, ptr))
+-		return 0;
++		return_0;
+ 
+ 	return 1;
+ }
+@@ -364,11 +364,11 @@ static int _parse_file(struct dm_task *dmt, const char *file)
+ 	while (getline(&buffer, &buffer_size, fp) > 0)
+ #endif
+ 		if (!_parse_line(dmt, buffer, file ? : "on stdin", ++line))
+-			goto out;
++			goto_out;
+ 
+ 	r = 1;
+ 
+-      out:
++out:
+ 	memset(buffer, 0, buffer_size);
+ #ifndef HAVE_GETLINE
+ 	dm_free(buffer);
+@@ -421,33 +421,33 @@ static struct dm_task *_get_deps_task(int major, int minor)
+ 	struct dm_info info;
+ 
+ 	if (!(dmt = dm_task_create(DM_DEVICE_DEPS)))
+-		return NULL;
++		return_NULL;
+ 
+ 	if (!dm_task_set_major(dmt, major) ||
+ 	    !dm_task_set_minor(dmt, minor))
+-		goto err;
++		goto_bad;
+ 
+ 	if (_switches[NOOPENCOUNT_ARG] && !dm_task_no_open_count(dmt))
+-		goto err;
++		goto_bad;
+ 
+ 	if (_switches[INACTIVE_ARG] && !dm_task_query_inactive_table(dmt))
+-		goto err;
++		goto_bad;
+ 
+ 	if (_switches[CHECKS_ARG] && !dm_task_enable_checks(dmt))
+-		goto err;
++		goto_bad;
+ 
+ 	if (!_task_run(dmt))
+-		goto err;
++		goto_bad;
+ 
+ 	if (!dm_task_get_info(dmt, &info))
+-		goto err;
++		goto_bad;
+ 
+ 	if (!info.exists)
+-		goto err;
++		goto_bad;
+ 
+ 	return dmt;
+ 
+-      err:
++bad:
+ 	dm_task_destroy(dmt);
+ 	return NULL;
+ }
+@@ -581,7 +581,7 @@ static int _do_timerfd_wait(void)
+ 	ssize_t bytes;
+ 
+ 	if (_timer_fd < 0)
+-		return 0;
++		return_0;
+ 
+ 	/* read on timerfd returns a uint64_t in host byte order. */
+ 	bytes = read(_timer_fd, &expired, sizeof(expired));
+@@ -646,9 +646,9 @@ static int _do_usleep_wait(void)
+ 	 */
+ 	if (!_last_sleep && !_now) {
+ 		if (!(_last_sleep = dm_timestamp_alloc()))
+-			goto_out;
++			return_0;
+ 		if (!(_now = dm_timestamp_alloc()))
+-			goto_out;
++			return_0;
+ 		dm_timestamp_get(_now);
+ 		this_interval = _interval;
+ 		log_error("Using "FMTu64" as first interval.", this_interval);
+@@ -673,17 +673,15 @@ static int _do_usleep_wait(void)
+ 			log_error("Report interval interrupted by signal.");
+ 		if (errno == EINVAL)
+ 			log_error("Report interval too short.");
+-		goto out;
++		return_0;
+ 	}
+ 
+-	if(_count == 2) {
++	if (_count == 2) {
+ 		dm_timestamp_destroy(_last_sleep);
+ 		dm_timestamp_destroy(_now);
+ 	}
+ 
+ 	return 1;
+-out:
+-	return 0;
+ }
+ 
+ static int _start_timer(void)
+@@ -838,7 +836,7 @@ static int _display_info_cols(struct dm_task *dmt, struct dm_info *info)
+ 		dm_stats_bind_devno(obj.stats, info->major, info->minor);
+ 
+ 		if (!dm_stats_populate(obj.stats, _program_id, DM_STATS_REGIONS_ALL))
+-			goto out;
++			goto_out;
+ 
+ 		/* Update timestamps and handle end-of-interval accounting. */
+ 		_update_interval_times();
+@@ -856,11 +854,11 @@ static int _display_info_cols(struct dm_task *dmt, struct dm_info *info)
+ 		dm_stats_bind_devno(obj.stats, info->major, info->minor);
+ 
+ 		if (!dm_stats_list(obj.stats, _program_id))
+-			goto out;
++			goto_out;
+ 
+ 		/* No regions to report */
+ 		if (!dm_stats_get_nr_regions(obj.stats))
+-			goto out;
++			goto_out;
+ 	}
+ 
+ 	/*
+@@ -879,7 +877,7 @@ static int _display_info_cols(struct dm_task *dmt, struct dm_info *info)
+ 	} dm_stats_walk_while(obj.stats);
+ 	r = 1;
+ 
+-      out:
++out:
+ 	if (obj.deps_task)
+ 		dm_task_destroy(obj.deps_task);
+ 	if (obj.split_name)
+@@ -938,7 +936,7 @@ static int _display_info(struct dm_task *dmt)
+ 	struct dm_info info;
+ 
+ 	if (!dm_task_get_info(dmt, &info))
+-		return 0;
++		return_0;
+ 
+ 	if (!_switches[COLS_ARG])
+ 		_display_info_long(dmt, &info);
+@@ -953,14 +951,14 @@ static int _set_task_device(struct dm_task *dmt, const char *name, int optional)
+ {
+ 	if (name) {
+ 		if (!dm_task_set_name(dmt, name))
+-			return 0;
++			return_0;
+ 	} else if (_switches[UUID_ARG]) {
+ 		if (!dm_task_set_uuid(dmt, _uuid))
+-			return 0;
++			return_0;
+ 	} else if (_switches[MAJOR_ARG] && _switches[MINOR_ARG]) {
+ 		if (!dm_task_set_major(dmt, _int_args[MAJOR_ARG]) ||
+ 		    !dm_task_set_minor(dmt, _int_args[MINOR_ARG]))
+-			return 0;
++			return_0;
+ 	} else if (!optional) {
+ 		fprintf(stderr, "No device specified.\n");
+ 		return 0;
+@@ -972,15 +970,15 @@ static int _set_task_device(struct dm_task *dmt, const char *name, int optional)
+ static int _set_task_add_node(struct dm_task *dmt)
+ {
+ 	if (!dm_task_set_add_node(dmt, DEFAULT_DM_ADD_NODE))
+-		return 0;
++		return_0;
+ 
+ 	if (_switches[ADD_NODE_ON_RESUME_ARG] &&
+ 	    !dm_task_set_add_node(dmt, DM_ADD_NODE_ON_RESUME))
+-		return 0;
++		return_0;
+ 
+ 	if (_switches[ADD_NODE_ON_CREATE_ARG] &&
+ 	    !dm_task_set_add_node(dmt, DM_ADD_NODE_ON_CREATE))
+-		return 0;
++		return_0;
+ 
+ 	return 1;
+ }
+@@ -1014,35 +1012,35 @@ static int _load(CMD_ARGS)
+ 		file = argv[0];
+ 
+ 	if (!(dmt = dm_task_create(DM_DEVICE_RELOAD)))
+-		return 0;
++		return_0;
+ 
+ 	if (!_set_task_device(dmt, name, 0))
+-		goto out;
++		goto_out;
+ 
+ 	if (!_switches[NOTABLE_ARG] && !_parse_file(dmt, file))
+-		goto out;
++		goto_out;
+ 
+ 	if (_switches[READ_ONLY] && !dm_task_set_ro(dmt))
+-		goto out;
++		goto_out;
+ 
+ 	if (_switches[NOOPENCOUNT_ARG] && !dm_task_no_open_count(dmt))
+-		goto out;
++		goto_out;
+ 
+ 	if (_switches[INACTIVE_ARG] && !dm_task_query_inactive_table(dmt))
+-		goto out;
++		goto_out;
+ 
+ 	if (_switches[CHECKS_ARG] && !dm_task_enable_checks(dmt))
+-		goto out;
++		goto_out;
+ 
+ 	if (!_task_run(dmt))
+-		goto out;
++		goto_out;
+ 
+ 	r = 1;
+ 
+ 	if (_switches[VERBOSE_ARG])
+ 		r = _display_info(dmt);
+ 
+-      out:
++out:
+ 	dm_task_destroy(dmt);
+ 
+ 	return r;
+@@ -1060,45 +1058,45 @@ static int _create(CMD_ARGS)
+ 		file = argv[1];
+ 
+ 	if (!(dmt = dm_task_create(DM_DEVICE_CREATE)))
+-		return 0;
++		return_0;
+ 
+ 	if (!dm_task_set_name(dmt, argv[0]))
+-		goto out;
++		goto_out;
+ 
+ 	if (_switches[UUID_ARG] && !dm_task_set_uuid(dmt, _uuid))
+-		goto out;
++		goto_out;
+ 
+ 	if (!_switches[NOTABLE_ARG] && !_parse_file(dmt, file))
+-		goto out;
++		goto_out;
+ 
+ 	if (_switches[READ_ONLY] && !dm_task_set_ro(dmt))
+-		goto out;
++		goto_out;
+ 
+ 	if (_switches[MAJOR_ARG] && !dm_task_set_major(dmt, _int_args[MAJOR_ARG]))
+-		goto out;
++		goto_out;
+ 
+ 	if (_switches[MINOR_ARG] && !dm_task_set_minor(dmt, _int_args[MINOR_ARG]))
+-		goto out;
++		goto_out;
+ 
+ 	if (_switches[UID_ARG] && !dm_task_set_uid(dmt, _int_args[UID_ARG]))
+-		goto out;
++		goto_out;
+ 
+ 	if (_switches[GID_ARG] && !dm_task_set_gid(dmt, _int_args[GID_ARG]))
+-		goto out;
++		goto_out;
+ 
+ 	if (_switches[MODE_ARG] && !dm_task_set_mode(dmt, _int_args[MODE_ARG]))
+-		goto out;
++		goto_out;
+ 
+ 	if (_switches[NOOPENCOUNT_ARG] && !dm_task_no_open_count(dmt))
+-		goto out;
++		goto_out;
+ 
+ 	if (_switches[INACTIVE_ARG] && !dm_task_query_inactive_table(dmt))
+-		goto out;
++		goto_out;
+ 
+ 	if (_switches[READAHEAD_ARG] &&
+ 	    !dm_task_set_read_ahead(dmt, _int_args[READAHEAD_ARG],
+ 				    _read_ahead_flags))
+-		goto out;
++		goto_out;
+ 
+ 	if (_switches[NOTABLE_ARG])
+ 		dm_udev_set_sync_support(0);
+@@ -1108,10 +1106,10 @@ static int _create(CMD_ARGS)
+ 			      DM_UDEV_DISABLE_SUBSYSTEM_RULES_FLAG;
+ 
+ 	if (_switches[CHECKS_ARG] && !dm_task_enable_checks(dmt))
+-		goto out;
++		goto_out;
+ 
+ 	if (!_set_task_add_node(dmt))
+-		goto out;
++		goto_out;
+ 
+ 	if (_udev_cookie)
+ 		cookie = _udev_cookie;
+@@ -1121,11 +1119,11 @@ static int _create(CMD_ARGS)
+ 
+ 	if (!dm_task_set_cookie(dmt, &cookie, udev_flags) ||
+ 	    !_task_run(dmt))
+-		goto out;
++		goto_out;
+ 
+ 	r = 1;
+ 
+-      out:
++out:
+ 	if (!_udev_cookie)
+ 		(void) dm_udev_wait(cookie);
+ 
+@@ -1144,26 +1142,26 @@ static int _do_rename(const char *name, const char *new_name, const char *new_uu
+ 	uint16_t udev_flags = 0;
+ 
+ 	if (!(dmt = dm_task_create(DM_DEVICE_RENAME)))
+-		return 0;
++		return_0;
+ 
+ 	/* FIXME Kernel doesn't support uuid or device number here yet */
+ 	if (!_set_task_device(dmt, name, 0))
+-		goto out;
++		goto_out;
+ 
+ 	if (new_uuid) {
+ 		if (!dm_task_set_newuuid(dmt, new_uuid))
+-			goto out;
++			goto_out;
+ 	} else if (!new_name || !dm_task_set_newname(dmt, new_name))
+-		goto out;
++		goto_out;
+ 
+ 	if (_switches[NOOPENCOUNT_ARG] && !dm_task_no_open_count(dmt))
+-		goto out;
++		goto_out;
+ 
+ 	if (_switches[INACTIVE_ARG] && !dm_task_query_inactive_table(dmt))
+-		goto out;
++		goto_out;
+ 
+ 	if (_switches[CHECKS_ARG] && !dm_task_enable_checks(dmt))
+-		goto out;
++		goto_out;
+ 
+ 	if (_switches[NOUDEVRULES_ARG])
+ 		udev_flags |= DM_UDEV_DISABLE_DM_RULES_FLAG |
+@@ -1177,11 +1175,11 @@ static int _do_rename(const char *name, const char *new_name, const char *new_uu
+ 
+ 	if (!dm_task_set_cookie(dmt, &cookie, udev_flags) ||
+ 	    !_task_run(dmt))
+-		goto out;
++		goto_out;
+ 
+ 	r = 1;
+ 
+-      out:
++out:
+ 	if (!_udev_cookie)
+ 		(void) dm_udev_wait(cookie);
+ 
+@@ -1210,14 +1208,14 @@ static int _message(CMD_ARGS)
+ 	char *endptr;
+ 
+ 	if (!(dmt = dm_task_create(DM_DEVICE_TARGET_MSG)))
+-		return 0;
++		return_0;
+ 
+ 	if (_switches[UUID_ARG] || _switches[MAJOR_ARG]) {
+ 		if (!_set_task_device(dmt, NULL, 0))
+-			goto out;
++			goto_out;
+ 	} else {
+ 		if (!_set_task_device(dmt, argv[0], 0))
+-			goto out;
++			goto_out;
+ 		argc--;
+ 		argv++;
+ 	}
+@@ -1228,7 +1226,7 @@ static int _message(CMD_ARGS)
+ 		goto out;
+ 	}
+ 	if (!dm_task_set_sector(dmt, sector))
+-		goto out;
++		goto_out;
+ 
+ 	argc--;
+ 	argv++;
+@@ -1255,19 +1253,19 @@ static int _message(CMD_ARGS)
+ 	dm_free(str);
+ 
+ 	if (!i)
+-		goto out;
++		goto_out;
+ 
+ 	if (_switches[NOOPENCOUNT_ARG] && !dm_task_no_open_count(dmt))
+-		goto out;
++		goto_out;
+ 
+ 	if (_switches[INACTIVE_ARG] && !dm_task_query_inactive_table(dmt))
+-		goto out;
++		goto_out;
+ 
+ 	if (_switches[CHECKS_ARG] && !dm_task_enable_checks(dmt))
+-		goto out;
++		goto_out;
+ 
+ 	if (!_task_run(dmt))
+-		goto out;
++		goto_out;
+ 
+ 	if ((response = dm_task_get_message_response(dmt))) {
+ 		if (!*response || response[strlen(response) - 1] == '\n')
+@@ -1278,7 +1276,7 @@ static int _message(CMD_ARGS)
+ 
+ 	r = 1;
+ 
+-      out:
++out:
+ 	dm_task_destroy(dmt);
+ 
+ 	return r;
+@@ -1290,37 +1288,37 @@ static int _setgeometry(CMD_ARGS)
+ 	struct dm_task *dmt;
+ 
+ 	if (!(dmt = dm_task_create(DM_DEVICE_SET_GEOMETRY)))
+-		return 0;
++		return_0;
+ 
+ 	if (_switches[UUID_ARG] || _switches[MAJOR_ARG]) {
+ 		if (!_set_task_device(dmt, NULL, 0))
+-			goto out;
++			goto_out;
+ 	} else {
+ 		if (!_set_task_device(dmt, argv[0], 0))
+-			goto out;
++			goto_out;
+ 		argc--;
+ 		argv++;
+ 	}
+ 
+ 	if (!dm_task_set_geometry(dmt, argv[0], argv[1], argv[2], argv[3]))
+-		goto out;
++		goto_out;
+ 
+ 	if (_switches[NOOPENCOUNT_ARG] && !dm_task_no_open_count(dmt))
+-		goto out;
++		goto_out;
+ 
+ 	if (_switches[INACTIVE_ARG] && !dm_task_query_inactive_table(dmt))
+-		goto out;
++		goto_out;
+ 
+ 	if (_switches[CHECKS_ARG] && !dm_task_enable_checks(dmt))
+-		goto out;
++		goto_out;
+ 
+ 	/* run the task */
+ 	if (!_task_run(dmt))
+-		goto out;
++		goto_out;
+ 
+ 	r = 1;
+ 
+-      out:
++out:
+ 	dm_task_destroy(dmt);
+ 
+ 	return r;
+@@ -1373,7 +1371,7 @@ static int _udevflags(CMD_ARGS)
+ 					       0};
+ 
+ 	if (!(cookie = _get_cookie_value(argv[0])))
+-		return 0;
++		return_0;
+ 
+ 	flags = cookie >> DM_UDEV_FLAGS_SHIFT;
+ 
+@@ -1405,7 +1403,7 @@ static int _udevcomplete(CMD_ARGS)
+ 	uint32_t cookie;
+ 
+ 	if (!(cookie = _get_cookie_value(argv[0])))
+-		return 0;
++		return_0;
+ 
+ 	/*
+ 	 * Strip flags from the cookie and use cookie magic instead.
+@@ -1519,7 +1517,7 @@ static int _udevcreatecookie(CMD_ARGS)
+ 	uint32_t cookie;
+ 
+ 	if (!dm_udev_create_cookie(&cookie))
+-		return 0;
++		return_0;
+ 
+ 	if (cookie)
+ 		printf("0x%08" PRIX32 "\n", cookie);
+@@ -1530,7 +1528,7 @@ static int _udevcreatecookie(CMD_ARGS)
+ static int _udevreleasecookie(CMD_ARGS)
+ {
+ 	if (argv[0] && !(_udev_cookie = _get_cookie_value(argv[0])))
+-		return 0;
++		return_0;
+ 
+ 	if (!_udev_cookie) {
+ 		log_error("No udev transaction cookie given.");
+@@ -1686,7 +1684,7 @@ static int _version(CMD_ARGS)
+ 		printf("Library version:   %s\n", version);
+ 
+ 	if (!dm_driver_version(version, sizeof(version)))
+-		return 0;
++		return_0;
+ 
+ 	printf("Driver version:    %s\n", version);
+ 
+@@ -1710,37 +1708,37 @@ static int _simple(int task, const char *name, uint32_t event_nr, int display)
+ 	struct dm_task *dmt;
+ 
+ 	if (!(dmt = dm_task_create(task)))
+-		return 0;
++		return_0;
+ 
+ 	if (!_set_task_device(dmt, name, 0))
+-		goto out;
++		goto_out;
+ 
+ 	if (event_nr && !dm_task_set_event_nr(dmt, event_nr))
+-		goto out;
++		goto_out;
+ 
+ 	if (_switches[NOFLUSH_ARG] && !dm_task_no_flush(dmt))
+-		goto out;
++		goto_out;
+ 
+ 	if (_switches[NOOPENCOUNT_ARG] && !dm_task_no_open_count(dmt))
+-		goto out;
++		goto_out;
+ 
+ 	if (_switches[INACTIVE_ARG] && !dm_task_query_inactive_table(dmt))
+-		goto out;
++		goto_out;
+ 
+ 	if (_switches[NOLOCKFS_ARG] && !dm_task_skip_lockfs(dmt))
+-		goto out;
++		goto_out;
+ 
+ 	if (_switches[CHECKS_ARG] && !dm_task_enable_checks(dmt))
+-		goto out;
++		goto_out;
+ 
+ 	/* FIXME: needs to coperate with udev */
+ 	if (!_set_task_add_node(dmt))
+-		goto out;
++		goto_out;
+ 
+ 	if (_switches[READAHEAD_ARG] &&
+ 	    !dm_task_set_read_ahead(dmt, _int_args[READAHEAD_ARG],
+ 				    _read_ahead_flags))
+-		goto out;
++		goto_out;
+ 
+ 	if (_switches[NOUDEVRULES_ARG])
+ 		udev_flags |= DM_UDEV_DISABLE_DM_RULES_FLAG |
+@@ -1753,7 +1751,7 @@ static int _simple(int task, const char *name, uint32_t event_nr, int display)
+ 		udev_flags |= DM_UDEV_DISABLE_LIBRARY_FALLBACK;
+ 
+ 	if (udev_wait_flag && !dm_task_set_cookie(dmt, &cookie, udev_flags))
+-		goto out;
++		goto_out;
+ 
+ 	if (_switches[RETRY_ARG] && task == DM_DEVICE_REMOVE)
+ 		dm_task_retry_remove(dmt);
+@@ -1763,7 +1761,7 @@ static int _simple(int task, const char *name, uint32_t event_nr, int display)
+ 
+ 	r = _task_run(dmt);
+ 
+-      out:
++out:
+ 	if (!_udev_cookie && udev_wait_flag)
+ 		(void) dm_udev_wait(cookie);
+ 
+@@ -1817,19 +1815,19 @@ static int _process_all(const struct command *cmd, const char *subcommand, int a
+ 	struct dm_task *dmt;
+ 
+ 	if (!(dmt = dm_task_create(DM_DEVICE_LIST)))
+-		return 0;
++		return_0;
+ 
+ 	if (_switches[CHECKS_ARG] && !dm_task_enable_checks(dmt))
+-		goto out;
++		goto_out;
+ 
+ 	if (!_task_run(dmt)) {
+ 		r = 0;
+-		goto out;
++		goto_out;
+ 	}
+ 
+ 	if (!(names = dm_task_get_names(dmt))) {
+ 		r = 0;
+-		goto out;
++		goto_out;
+ 	}
+ 
+ 	if (!names->dev) {
+@@ -1845,7 +1843,7 @@ static int _process_all(const struct command *cmd, const char *subcommand, int a
+ 		next = names->next;
+ 	} while (next);
+ 
+-      out:
++out:
+ 	dm_task_destroy(dmt);
+ 	return r;
+ }
+@@ -1859,25 +1857,25 @@ static uint64_t _get_device_size(const char *name)
+ 	void *next = NULL;
+ 
+ 	if (!(dmt = dm_task_create(DM_DEVICE_TABLE)))
+-		return 0;
++		return_0;
+ 
+ 	if (!_set_task_device(dmt, name, 0))
+-		goto out;
++		goto_out;
+ 
+ 	if (_switches[NOOPENCOUNT_ARG] && !dm_task_no_open_count(dmt))
+-		goto out;
++		goto_out;
+ 
+ 	if (_switches[INACTIVE_ARG] && !dm_task_query_inactive_table(dmt))
+-		goto out;
++		goto_out;
+ 
+ 	if (_switches[CHECKS_ARG] && !dm_task_enable_checks(dmt))
+-		goto out;
++		goto_out;
+ 
+ 	if (!_task_run(dmt))
+-		goto out;
++		goto_out;
+ 
+ 	if (!dm_task_get_info(dmt, &info) || !info.exists)
+-		goto out;
++		goto_out;
+ 
+ 	do {
+ 		next = dm_get_next_target(dmt, next, &start, &length,
+@@ -1885,7 +1883,7 @@ static uint64_t _get_device_size(const char *name)
+ 		size += length;
+ 	} while (next);
+ 
+-      out:
++out:
+ 	dm_task_destroy(dmt);
+ 	return size;
+ }
+@@ -1902,37 +1900,37 @@ static int _error_device(CMD_ARGS)
+ 	size = _get_device_size(name);
+ 
+ 	if (!(dmt = dm_task_create(DM_DEVICE_RELOAD)))
+-		return 0;
++		return_0;
+ 
+ 	if (!_set_task_device(dmt, name, 0))
+-		goto error;
++		goto_bad;
+ 
+ 	if (!dm_task_add_target(dmt, UINT64_C(0), size, "error", ""))
+-		goto error;
++		goto_bad;
+ 
+ 	if (_switches[READ_ONLY] && !dm_task_set_ro(dmt))
+-		goto error;
++		goto_bad;
+ 
+ 	if (_switches[NOOPENCOUNT_ARG] && !dm_task_no_open_count(dmt))
+-		goto error;
++		goto_bad;
+ 
+ 	if (_switches[INACTIVE_ARG] && !dm_task_query_inactive_table(dmt))
+-		goto error;
++		goto_bad;
+ 
+ 	if (_switches[CHECKS_ARG] && !dm_task_enable_checks(dmt))
+-		goto error;
++		goto_bad;
+ 
+ 	if (!_task_run(dmt))
+-		goto error;
++		goto_bad;
+ 
+ 	if (!_simple(DM_DEVICE_RESUME, name, 0, 0)) {
+ 		_simple(DM_DEVICE_CLEAR, name, 0, 0);
+-		goto error;
++		goto_bad;
+ 	}
+ 
+ 	r = 1;
+ 
+-error:
++bad:
+ 	dm_task_destroy(dmt);
+ 	return r;
+ }
+@@ -2013,14 +2011,14 @@ static int _exec_command(const char *name)
+ 	pid_t pid;
+ 
+ 	if (argc < 0)
+-		return 0;
++		return_0;
+ 
+ 	if (!dm_mknodes(name))
+-		return 0;
++		return_0;
+ 
+ 	n = snprintf(path, sizeof(path), "%s/%s", dm_dir(), name);
+ 	if (n < 0 || n > (int) sizeof(path) - 1)
+-		return 0;
++		return_0;
+ 
+ 	if (!argc) {
+ 		c = _command_to_exec;
+@@ -2038,7 +2036,7 @@ static int _exec_command(const char *name)
+ 
+ 		if (!argc) {
+ 			argc = -1;
+-			return 0;
++			return_0;
+ 		}
+ 
+ 		if (argc == ARGS_MAX) {
+@@ -2093,28 +2091,28 @@ static int _status(CMD_ARGS)
+ 		ls_only = 1;
+ 
+ 	if (!(dmt = dm_task_create(cmdno)))
+-		return 0;
++		return_0;
+ 
+ 	if (!_set_task_device(dmt, name, 0))
+-		goto out;
++		goto_out;
+ 
+ 	if (_switches[NOOPENCOUNT_ARG] && !dm_task_no_open_count(dmt))
+-		goto out;
++		goto_out;
+ 
+ 	if (_switches[INACTIVE_ARG] && !dm_task_query_inactive_table(dmt))
+-		goto out;
++		goto_out;
+ 
+ 	if (_switches[CHECKS_ARG] && !dm_task_enable_checks(dmt))
+-		goto out;
++		goto_out;
+ 
+ 	if (_switches[NOFLUSH_ARG] && !dm_task_no_flush(dmt))
+-		goto out;
++		goto_out;
+ 
+ 	if (!_task_run(dmt))
+-		goto out;
++		goto_out;
+ 
+ 	if (!dm_task_get_info(dmt, &info) || !info.exists)
+-		goto out;
++		goto_out;
+ 
+ 	if (!name)
+ 		name = dm_task_get_name(dmt);
+@@ -2163,11 +2161,11 @@ static int _status(CMD_ARGS)
+ 		printf("\n");
+ 
+ 	if (matched && _switches[EXEC_ARG] && _command_to_exec && !_exec_command(name))
+-		goto out;
++		goto_out;
+ 
+ 	r = 1;
+ 
+-      out:
++out:
+ 	dm_task_destroy(dmt);
+ 	return r;
+ }
+@@ -2181,13 +2179,13 @@ static int _targets(CMD_ARGS)
+ 	struct dm_versions *last_target;
+ 
+ 	if (!(dmt = dm_task_create(DM_DEVICE_LIST_VERSIONS)))
+-		return 0;
++		return_0;
+ 
+ 	if (_switches[CHECKS_ARG] && !dm_task_enable_checks(dmt))
+-		goto out;
++		goto_out;
+ 
+ 	if (!_task_run(dmt))
+-		goto out;
++		goto_out;
+ 
+ 	target = dm_task_get_versions(dmt);
+ 
+@@ -2203,7 +2201,7 @@ static int _targets(CMD_ARGS)
+ 
+ 	r = 1;
+ 
+-      out:
++out:
+ 	dm_task_destroy(dmt);
+ 	return r;
+ }
+@@ -2224,26 +2222,26 @@ static int _info(CMD_ARGS)
+ 	}
+ 
+ 	if (!(dmt = dm_task_create(DM_DEVICE_INFO)))
+-		return 0;
++		return_0;
+ 
+ 	if (!_set_task_device(dmt, name, 0))
+-		goto out;
++		goto_out;
+ 
+ 	if (_switches[NOOPENCOUNT_ARG] && !dm_task_no_open_count(dmt))
+-		goto out;
++		goto_out;
+ 
+ 	if (_switches[INACTIVE_ARG] && !dm_task_query_inactive_table(dmt))
+-		goto out;
++		goto_out;
+ 
+ 	if (_switches[CHECKS_ARG] && !dm_task_enable_checks(dmt))
+-		goto out;
++		goto_out;
+ 
+ 	if (!_task_run(dmt))
+-		goto out;
++		goto_out;
+ 
+ 	r = _display_info(dmt);
+ 
+-      out:
++out:
+ 	dm_task_destroy(dmt);
+ 	return r;
+ }
+@@ -2268,28 +2266,28 @@ static int _deps(CMD_ARGS)
+ 	}
+ 
+ 	if (!(dmt = dm_task_create(DM_DEVICE_DEPS)))
+-		return 0;
++		return_0;
+ 
+ 	if (!_set_task_device(dmt, name, 0))
+-		goto out;
++		goto_out;
+ 
+ 	if (_switches[NOOPENCOUNT_ARG] && !dm_task_no_open_count(dmt))
+-		goto out;
++		goto_out;
+ 
+ 	if (_switches[INACTIVE_ARG] && !dm_task_query_inactive_table(dmt))
+-		goto out;
++		goto_out;
+ 
+ 	if (_switches[CHECKS_ARG] && !dm_task_enable_checks(dmt))
+-		goto out;
++		goto_out;
+ 
+ 	if (!_task_run(dmt))
+-		goto out;
++		goto_out;
+ 
+ 	if (!dm_task_get_info(dmt, &info))
+-		goto out;
++		goto_out;
+ 
+ 	if (!(deps = dm_task_get_deps(dmt)))
+-		goto out;
++		goto_out;
+ 
+ 	if (!info.exists) {
+ 		printf("Device does not exist.\n");
+@@ -2322,7 +2320,7 @@ static int _deps(CMD_ARGS)
+ 
+ 	r = 1;
+ 
+-      out:
++out:
+ 	dm_task_destroy(dmt);
+ 	return r;
+ }
+@@ -2670,7 +2668,7 @@ static int _add_dep(CMD_ARGS)
+ {
+ 	if (names &&
+ 	    !dm_tree_add_dev(_dtree, (unsigned) MAJOR(names->dev), (unsigned) MINOR(names->dev)))
+-		return 0;
++		return_0;
+ 
+ 	return 1;
+ }
+@@ -2684,10 +2682,10 @@ static int _build_whole_deptree(const struct command *cmd)
+ 		return 1;
+ 
+ 	if (!(_dtree = dm_tree_create()))
+-		return 0;
++		return_0;
+ 
+ 	if (!_process_all(cmd, NULL, 0, NULL, 0, _add_dep))
+-		return 0;
++		return_0;
+ 
+ 	return 1;
+ }
+@@ -2695,7 +2693,7 @@ static int _build_whole_deptree(const struct command *cmd)
+ static int _display_tree(CMD_ARGS)
+ {
+ 	if (!_build_whole_deptree(cmd))
+-		return 0;
++		return_0;
+ 
+ 	_display_tree_walk_children(dm_tree_find_node(_dtree, 0, 0), 0);
+ 
+@@ -2732,7 +2730,7 @@ static int _show_units(void)
+ {
+ 	/* --nosuffix overrides --units */
+ 	if (_switches[NOSUFFIX_ARG])
+-		return 0;
++		return_0;
+ 
+ 	return (_int_args[UNITS_ARG]) ? 1 : 0;
+ }
+@@ -2944,8 +2942,10 @@ static int _dm_info_devno_disp(struct dm_report *rh, struct dm_pool *mem,
+ 
+ 	if (private) {
+ 		if (!dm_device_get_name(info->major, info->minor,
+-					1, buf, PATH_MAX))
++					1, buf, PATH_MAX)) {
++			stack;
+ 			goto out_abandon;
++		}
+ 	}
+ 	else {
+ 		if (dm_snprintf(buf, sizeof(buf), "%d:%d",
+@@ -4375,7 +4375,7 @@ static int _report_init(const struct command *cmd, const char *subcommand)
+ 	if (!(_report = dm_report_init_with_selection(&_report_type, _report_types,
+ 				_report_fields, options, separator, flags, keys,
+ 				selection, NULL, NULL)))
+-		goto out;
++		goto_out;
+ 
+ 	if ((_report_type & DR_TREE) && !_build_whole_deptree(cmd)) {
+ 		err("Internal device dependency tree creation failed.");
+@@ -4431,19 +4431,19 @@ static int _mangle(CMD_ARGS)
+ 	}
+ 
+ 	if (!(dmt = dm_task_create(DM_DEVICE_STATUS)))
+-		return 0;
++		return_0;
+ 
+ 	if (!(_set_task_device(dmt, name, 0)))
+-		goto out;
++		goto_out;
+ 
+ 	if (!_switches[CHECKS_ARG] && !dm_task_enable_checks(dmt))
+-		goto out;
++		goto_out;
+ 
+ 	if (!_task_run(dmt))
+-		goto out;
++		goto_out;
+ 
+ 	if (!dm_task_get_info(dmt, &info) || !info.exists)
+-		goto out;
++		goto_out;
+ 
+ 	uuid = dm_task_get_uuid(dmt);
+ 
+@@ -4465,15 +4465,15 @@ static int _mangle(CMD_ARGS)
+ 
+ 	if (target_format == DM_STRING_MANGLING_NONE) {
+ 		if (!(new_name = dm_task_get_name_unmangled(dmt)))
+-			goto out;
++			goto_out;
+ 		if (!(new_uuid = dm_task_get_uuid_unmangled(dmt)))
+-			goto out;
++			goto_out;
+ 	}
+ 	else {
+ 		if (!(new_name = dm_task_get_name_mangled(dmt)))
+-			goto out;
++			goto_out;
+ 		if (!(new_uuid = dm_task_get_uuid_mangled(dmt)))
+-			goto out;
++			goto_out;
+ 	}
+ 
+ 	/* We can't rename the UUID, the device must be reactivated manually. */
+@@ -4508,13 +4508,13 @@ static int _stats(CMD_ARGS);
+ static int _bind_stats_device(struct dm_stats *dms, const char *name)
+ {
+ 	if (name && !dm_stats_bind_name(dms, name))
+-		return 0;
++		return_0;
+ 	else if (_switches[UUID_ARG] && !dm_stats_bind_uuid(dms, _uuid))
+-		return 0;
++		return_0;
+ 	else if (_switches[MAJOR_ARG] && _switches[MINOR_ARG]
+ 		 && !dm_stats_bind_devno(dms, _int_args[MAJOR_ARG],
+ 					 _int_args[MINOR_ARG]))
+-		return 0;
++		return_0;
+ 
+ 	return 1;
+ }
+@@ -4524,10 +4524,10 @@ static int _stats_clear_regions(struct dm_stats *dms, uint64_t region_id)
+ 	int allregions = (region_id == DM_STATS_REGIONS_ALL);
+ 
+ 	if (!dm_stats_list(dms, NULL))
+-		goto_out;
++		return_0;
+ 
+ 	if (!dm_stats_get_nr_regions(dms))
+-		goto done;
++		return 1;
+ 
+ 	dm_stats_walk_do(dms) {
+ 		if (allregions)
+@@ -4535,21 +4535,18 @@ static int _stats_clear_regions(struct dm_stats *dms, uint64_t region_id)
+ 
+ 		if (!dm_stats_region_present(dms, region_id)) {
+ 			log_error("No such region: %"PRIu64".", region_id);
+-			goto out;
++			return 0;
+ 		}
+ 		if (!dm_stats_clear_region(dms, region_id)) {
+ 			log_error("Clearing statistics region %"PRIu64" failed.",
+ 				  region_id);
+-			goto out;
++			return 0;
+ 		}
+ 		log_info("Cleared statistics region %"PRIu64".", region_id);
+ 		dm_stats_walk_next_region(dms);
+ 	} dm_stats_walk_while(dms);
+-done:
+-	return 1;
+ 
+-out:
+-	return 0;
++	return 1;
+ }
+ 
+ static int _stats_clear(CMD_ARGS)
+@@ -4611,7 +4608,7 @@ static int _size_from_string(char *argptr, uint64_t *size, const char *name)
+ 	uint64_t factor;
+ 	char *endptr = NULL, unit_type;
+ 	if (!argptr)
+-		return 0;
++		return_0;
+ 
+ 	*size = strtoull(argptr, &endptr, 10);
+ 	if (endptr == argptr) {
+@@ -4674,30 +4671,30 @@ static int _do_stats_create_regions(struct dm_stats *dms,
+ 	void *next = NULL;
+ 
+ 	if (histogram && !(bounds = dm_histogram_bounds_from_string(histogram)))
+-		return 0;
++		return_0;
+ 
+ 	if (!(dmt = dm_task_create(DM_DEVICE_TABLE))) {
+ 		dm_stats_destroy(dms);
+-		return 0;
++		return_0;
+ 	}
+ 
+ 	if (!_set_task_device(dmt, name, 0))
+-		goto out;
++		goto_out;
+ 
+ 	if (!dm_task_no_open_count(dmt))
+-		goto out;
++		goto_out;
+ 
+ 	if (_switches[CHECKS_ARG] && !dm_task_enable_checks(dmt))
+-		goto out;
++		goto_out;
+ 
+ 	if (!_task_run(dmt))
+-		goto out;
++		goto_out;
+ 
+ 	if (!dm_task_get_info(dmt, &info) || !info.exists)
+-		goto out;
++		goto_out;
+ 
+ 	if (!(devname = dm_task_get_name(dmt)))
+-		goto out;
++		goto_out;
+ 
+ 	do {
+ 		uint64_t segment_start, segment_len;
+@@ -4797,7 +4794,7 @@ static int _stats_create(CMD_ARGS)
+ 	if (_switches[AREA_SIZE_ARG])
+ 		if (!_size_from_string(_string_args[AREA_SIZE_ARG],
+ 				       &area_size, "areasize"))
+-			return 0;
++			return_0;
+ 
+ 	areas = (areas) ? areas : 1;
+ 	/* bytes to sectors or -(areas): promote to signed before conversion */
+@@ -4806,7 +4803,7 @@ static int _stats_create(CMD_ARGS)
+ 	if (_switches[START_ARG]) {
+ 		if (!_size_from_string(_string_args[START_ARG],
+ 				       &start, "start"))
+-			return 0;
++			return_0;
+ 	}
+ 
+ 	/* bytes to sectors */
+@@ -4815,7 +4812,7 @@ static int _stats_create(CMD_ARGS)
+ 	if (_switches[LENGTH_ARG]) {
+ 		if (!_size_from_string(_string_args[LENGTH_ARG],
+ 				       &len, "length"))
+-			return 0;
++			return_0;
+ 	}
+ 
+ 	/* bytes to sectors */
+@@ -4831,13 +4828,13 @@ static int _stats_create(CMD_ARGS)
+ 
+ 	dms = dm_stats_create(DM_STATS_PROGRAM_ID);
+ 	if (!_bind_stats_device(dms, name))
+-		goto_out;
++		goto_bad;
+ 
+ 	if (_switches[PRECISE_ARG]) {
+ 		if (!dm_stats_driver_supports_precise()) {
+ 			log_error("Using --precise requires driver version "
+ 				  "4.32.0 or later.");
+-			goto out;
++			goto bad;
+ 		}
+ 	}
+ 
+@@ -4845,7 +4842,7 @@ static int _stats_create(CMD_ARGS)
+ 		if (!dm_stats_driver_supports_histogram()) {
+ 			log_error("Using --bounds requires driver version "
+ 				  "4.32.0 or later.");
+-			goto out;
++			goto bad;
+ 		}
+ 	}
+ 
+@@ -4857,7 +4854,7 @@ static int _stats_create(CMD_ARGS)
+ 					_switches[SEGMENTS_ARG],
+ 					program_id, aux_data);
+ 
+-out:
++bad:
+ 	dm_stats_destroy(dms);
+ 	return 0;
+ }
+@@ -4869,6 +4866,7 @@ static int _stats_delete(CMD_ARGS)
+ 	char *name = NULL;
+ 	const char *program_id = DM_STATS_PROGRAM_ID;
+ 	int allregions = _switches[ALL_REGIONS_ARG];
++	int r = 0;
+ 
+ 	/* delete does not use a report */
+ 	if (_report) {
+@@ -4908,9 +4906,11 @@ static int _stats_delete(CMD_ARGS)
+ 	if (allregions && !dm_stats_list(dms, program_id))
+ 		goto_out;
+ 
+-	if (allregions && !dm_stats_get_nr_regions(dms))
++	if (allregions && !dm_stats_get_nr_regions(dms)) {
+ 		/* no regions present */
+-		goto done;
++		r = 1;
++		goto out;
++	}
+ 
+ 	dm_stats_walk_do(dms) {
+ 		if (_switches[ALL_REGIONS_ARG])
+@@ -4923,13 +4923,11 @@ static int _stats_delete(CMD_ARGS)
+ 		dm_stats_walk_next_region(dms);
+ 	} dm_stats_walk_while(dms);
+ 
+-done:
+-	dm_stats_destroy(dms);
+-	return 1;
++	r = 1;
+ 
+ out:
+ 	dm_stats_destroy(dms);
+-	return 0;
++	return r;
+ }
+ 
+ static int _stats_print(CMD_ARGS)
+@@ -4939,6 +4937,7 @@ static int _stats_print(CMD_ARGS)
+ 	uint64_t region_id;
+ 	unsigned clear = (unsigned) _switches[CLEAR_ARG];
+ 	int allregions = _switches[ALL_REGIONS_ARG];
++	int r = 0;
+ 
+ 	/* print does not use a report */
+ 	if (_report) {
+@@ -4969,8 +4968,10 @@ static int _stats_print(CMD_ARGS)
+ 	if (!dm_stats_list(dms, NULL))
+ 		goto_out;
+ 
+-	if (allregions && !dm_stats_get_nr_regions(dms))
+-		goto done;
++	if (allregions && !dm_stats_get_nr_regions(dms)) {
++		r = 1;
++		goto out;
++	}
+ 
+ 	dm_stats_walk_do(dms) {
+ 		if (_switches[ALL_REGIONS_ARG])
+@@ -4994,13 +4995,11 @@ static int _stats_print(CMD_ARGS)
+ 
+ 	} dm_stats_walk_while(dms);
+ 
+-done:
+-	dm_stats_destroy(dms);
+-	return 1;
++	r = 1;
+ 
+ out:
+ 	dm_stats_destroy(dms);
+-	return 0;
++	return r;
+ }
+ 
+ static int _stats_report(CMD_ARGS)
+@@ -5028,25 +5027,27 @@ static int _stats_report(CMD_ARGS)
+ 	}
+ 
+ 	if (!(dmt = dm_task_create(DM_DEVICE_INFO)))
+-		return 0;
++		return_0;
+ 
+ 	if (!_set_task_device(dmt, name, 0))
+-		goto out;
++		goto_out;
+ 
+ 	if (_switches[CHECKS_ARG] && !dm_task_enable_checks(dmt))
+-		goto out;
++		goto_out;
+ 
+ 	if (!_task_run(dmt))
+-		goto out;
++		goto_out;
+ 
+ 	r = _display_info(dmt);
+ 
+-      out:
++out:
+ 	dm_task_destroy(dmt);
++
+ 	if (!r && _report) {
+ 		dm_report_free(_report);
+ 		_report = NULL;
+ 	}
++
+ 	return r;
+ }
+ 
+@@ -5321,7 +5322,7 @@ static int _stats(CMD_ARGS)
+ 	 */
+ 	if (!stats_cmd->fn(stats_cmd, subcommand, argc, argv, NULL,
+ 			   multiple_devices))
+-		return 0;
++		return_0;
+ 
+ 	return 1;
+ }
+@@ -5418,35 +5419,35 @@ static char *parse_loop_device_name(const char *dev, const char *dev_dir)
+ 	char *device = NULL;
+ 
+ 	if (!(buf = dm_malloc(PATH_MAX)))
+-		return NULL;
++		return_NULL;
+ 
+ 	if (dev[0] == '/') {
+ 		if (!(device = _get_abspath(dev)))
+-			goto error;
++			goto_bad;
+ 
+ 		if (strncmp(device, dev_dir, strlen(dev_dir)))
+-			goto error;
++			goto_bad;
+ 
+ 		/* If dev_dir does not end in a slash, ensure that the
+ 		   following byte in the device string is "/".  */
+ 		if (dev_dir[strlen(dev_dir) - 1] != '/' &&
+ 		    device[strlen(dev_dir)] != '/')
+-			goto error;
++			goto_bad;
+ 
+ 		if (!dm_strncpy(buf, strrchr(device, '/') + 1, PATH_MAX))
+-			goto error;
++			goto_bad;
+ 		dm_free(device);
+ 	} else {
+ 		/* check for device number */
+ 		if (strncmp(dev, "loop", sizeof("loop") - 1))
+-			goto error;
++			goto_bad;
+ 
+ 		if (!dm_strncpy(buf, dev, PATH_MAX))
+-			goto error;
++			goto_bad;
+ 	}
+ 
+ 	return buf;
+-error:
++bad:
+ 	dm_free(device);
+ 	dm_free(buf);
+ 
+@@ -5476,10 +5477,10 @@ static int _loop_table(char *table, size_t tlen, char *file,
+ 	}
+ 
+ 	if (fd < 0)
+-		goto error;
++		goto_bad;
+ 
+ 	if (fstat(fd, &fbuf))
+-		goto error;
++		goto_bad;
+ 
+ 	size = (fbuf.st_size - off);
+ 	sectors = size >> SECTOR_SHIFT;
+@@ -5491,7 +5492,7 @@ static int _loop_table(char *table, size_t tlen, char *file,
+ 
+ #ifdef HAVE_SYS_STATVFS_H
+ 	if (fstatvfs(fd, &fsbuf))
+-		goto error;
++		goto_bad;
+ 
+ 	/* FIXME Fragment size currently unused */
+ 	blksize = fsbuf.f_frsize;
+@@ -5502,18 +5503,18 @@ static int _loop_table(char *table, size_t tlen, char *file,
+ 
+ 	if (dm_snprintf(table, tlen, "%llu %llu loop %s %llu\n", 0ULL,
+ 			(long long unsigned)sectors, file, (long long unsigned)off) < 0)
+-		return 0;
++		return_0;
+ 
+ 	if (_switches[VERBOSE_ARG] > 1)
+ 		fprintf(stderr, "Table: %s\n", table);
+ 
+ 	return 1;
+ 
+-error:
++bad:
+ 	if (fd > -1 && close(fd))
+ 		log_sys_error("close", file);
+ 
+-	return 0;
++	return_0;
+ }
+ 
+ static int _process_losetup_switches(const char *base, int *argcp, char ***argvp,
+@@ -5536,7 +5537,7 @@ static int _process_losetup_switches(const char *base, int *argcp, char ***argvp
+ 	while ((c = GETOPTLONG_FN(*argcp, *argvp, "ade:fo:v",
+ 				  long_options, NULL)) != -1 ) {
+ 		if (c == ':' || c == '?')
+-			return 0;
++			return_0;
+ 		if (c == 'a')
+ 			show_all++;
+ 		if (c == 'd')
+@@ -5836,7 +5837,7 @@ static int _process_switches(int *argcp, char ***argvp, const char *dev_dir)
+ 			_string_args[AUX_DATA_ARG] = optarg;
+ 		}
+ 		if (c == ':' || c == '?')
+-			return 0;
++			return_0;
+ 		if (c == 'h' || ind == HELP_ARG)
+ 			_switches[HELP_ARG]++;
+ 		if (ind == BOUNDS_ARG) {
+@@ -6201,7 +6202,7 @@ unknown:
+ 
+ #ifdef UDEV_SYNC_SUPPORT
+ 	if (!_set_up_udev_support(dev_dir))
+-		goto out;
++		goto_out;
+ #endif
+ 
+ 	/*
+@@ -6215,7 +6216,7 @@ unknown:
+ 		subcommand = (char *) "";
+ 
+ 	if (_switches[COLS_ARG] && !_report_init(cmd, subcommand))
+-		goto out;
++		goto_out;
+ 
+ 	if (_switches[COUNT_ARG])
+ 		_count = ((uint32_t)_int_args[COUNT_ARG]) ? : UINT32_MAX;
diff --git a/SOURCES/lvm2-2_02_131-swapping-of-lv-identifiers-handles-more-complex-lvs.patch b/SOURCES/lvm2-2_02_131-swapping-of-lv-identifiers-handles-more-complex-lvs.patch
new file mode 100644
index 0000000..9a7541f
--- /dev/null
+++ b/SOURCES/lvm2-2_02_131-swapping-of-lv-identifiers-handles-more-complex-lvs.patch
@@ -0,0 +1,66 @@
+ WHATS_NEW              |  1 +
+ tools/lvconvert.c      |  4 ++--
+ tools/lvconvert_poll.c | 13 +++++++++----
+ 3 files changed, 12 insertions(+), 6 deletions(-)
+
+diff --git a/WHATS_NEW b/WHATS_NEW
+index 9ddecbc..5260321 100644
+--- a/WHATS_NEW
++++ b/WHATS_NEW
+@@ -1,5 +1,6 @@
+ Version 2.02.131 - 
+ =====================================
++  Swapping of LV identifiers handles more complex LVs.
+   Fix VG metadata comparison failure while scanning the VG for lvmetad.
+   Ignore persistent cache if configuration changed. (2.02.127)
+ 
+diff --git a/tools/lvconvert.c b/tools/lvconvert.c
+index 2bffb07..919537a 100644
+--- a/tools/lvconvert.c
++++ b/tools/lvconvert.c
+@@ -2489,14 +2489,14 @@ deactivate_pmslv:
+ 	if (!detach_pool_metadata_lv(first_seg(pool_lv), &mlv))
+ 		return_0;
+ 
++	/* Swap _pmspare and _tmeta name */
+ 	if (!swap_lv_identifiers(cmd, mlv, pmslv))
+ 		return_0;
+ 
+-	/* Used _pmspare will become _tmeta */
+ 	if (!attach_pool_metadata_lv(first_seg(pool_lv), pmslv))
+ 		return_0;
+ 
+-	/* Used _tmeta will become visible  _meta%d */
++	/* Used _tmeta (now _pmspare) becomes _meta%d */
+ 	if (!lv_rename_update(cmd, mlv, pms_path, 0))
+ 		return_0;
+ 
+diff --git a/tools/lvconvert_poll.c b/tools/lvconvert_poll.c
+index e3a3709..1b230bc 100644
+--- a/tools/lvconvert_poll.c
++++ b/tools/lvconvert_poll.c
+@@ -44,15 +44,20 @@ int swap_lv_identifiers(struct cmd_context *cmd,
+ 			struct logical_volume *a, struct logical_volume *b)
+ {
+ 	union lvid lvid;
+-	const char *name;
++	const char *aname = a->name, *bname = b->name;
+ 
+ 	lvid = a->lvid;
+ 	a->lvid = b->lvid;
+ 	b->lvid = lvid;
+ 
+-	name = a->name;
+-	a->name = b->name;
+-	if (!lv_rename_update(cmd, b, name, 0))
++	/* rename temporarily to 'unused' name */
++	if (!lv_rename_update(cmd, a, "pmove_tmeta", 0))
++		return_0;
++	/* name rename 'b' to unused name of 'a' */
++	if (!lv_rename_update(cmd, b, aname, 0))
++		return_0;
++	/* finish name swapping */
++	if (!lv_rename_update(cmd, a, bname, 0))
+ 		return_0;
+ 
+ 	return 1;
diff --git a/SOURCES/lvm2-2_02_133-check-for-space-in-thin-pool-before-creating-new-thin.patch b/SOURCES/lvm2-2_02_133-check-for-space-in-thin-pool-before-creating-new-thin.patch
new file mode 100644
index 0000000..a02d919
--- /dev/null
+++ b/SOURCES/lvm2-2_02_133-check-for-space-in-thin-pool-before-creating-new-thin.patch
@@ -0,0 +1,51 @@
+ WHATS_NEW               |  4 ++++
+ lib/metadata/lv_manip.c | 23 ++++++++++++++++++-----
+ 2 files changed, 22 insertions(+), 5 deletions(-)
+
+diff --git a/WHATS_NEW b/WHATS_NEW
+index 1718c29..0fa6bb6 100644
+--- a/WHATS_NEW
++++ b/WHATS_NEW
+@@ -1,3 +1,7 @@
++Version 2.02.133 - 
++======================================
++  Check for enough space in thin-pool in command before creating new thin.
++
+ Version 2.02.131 - 
+ =====================================
+   Fix vgimportclone cache_dir path name (2.02.115).
+diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
+index 88c516b..32aa666 100644
+--- a/lib/metadata/lv_manip.c
++++ b/lib/metadata/lv_manip.c
+@@ -7038,12 +7038,25 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
+ 			}
+ 		}
+ 
+-		if (seg_is_thin_volume(lp) &&
+-		    lv_is_new_thin_pool(pool_lv)) {
++		if (seg_is_thin_volume(lp)) {
+ 			thin_pool_was_active = lv_is_active(pool_lv);
+-			if (!check_new_thin_pool(pool_lv))
+-				return_NULL;
+-			/* New pool is now inactive */
++			if (lv_is_new_thin_pool(pool_lv)) {
++				if (!check_new_thin_pool(pool_lv))
++					return_NULL;
++				/* New pool is now inactive */
++			} else {
++				if (!activate_lv_excl_local(cmd, pool_lv)) {
++					log_error("Aborting. Failed to locally activate thin pool %s.",
++						  display_lvname(pool_lv));
++					return 0;
++				}
++				if (!pool_below_threshold(first_seg(pool_lv))) {
++					log_error("Cannot create new thin volume, free space in "
++						  "thin pool %s reached threshold.",
++						  display_lvname(pool_lv));
++					return NULL;
++				}
++			}
+ 		}
+ 
+ 		if (seg_is_cache(lp) &&
diff --git a/SOURCES/lvm2-2_02_133-enforce-writethrough-mode-for-cleaner-policy.patch b/SOURCES/lvm2-2_02_133-enforce-writethrough-mode-for-cleaner-policy.patch
new file mode 100644
index 0000000..58a3359
--- /dev/null
+++ b/SOURCES/lvm2-2_02_133-enforce-writethrough-mode-for-cleaner-policy.patch
@@ -0,0 +1,30 @@
+ WHATS_NEW_DM          | 4 ++++
+ libdm/libdm-deptree.c | 3 ++-
+ 2 files changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
+index 9e30786..71b25ba 100644
+--- a/WHATS_NEW_DM
++++ b/WHATS_NEW_DM
+@@ -1,3 +1,7 @@
++Version 1.02.110 - 
++======================================
++  Enforce writethrough mode for cleaner policy.
++
+ Version 1.02.108 - 
+ =====================================
+   Do not check for full thin pool when activating without messages (1.02.107).
+diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c
+index 7b7ca5b..fc79e33 100644
+--- a/libdm/libdm-deptree.c
++++ b/libdm/libdm-deptree.c
+@@ -3456,7 +3456,8 @@ int dm_tree_node_add_cache_target(struct dm_tree_node *node,
+ 		return_0;
+ 
+ 	seg->data_block_size = data_block_size;
+-	seg->flags = feature_flags;
++	/* Enforce WriteThough mode for cleaner policy */
++	seg->flags = (strcmp(policy_name, "cleaner") == 0) ? DM_CACHE_FEATURE_WRITETHROUGH : feature_flags;
+ 	seg->policy_name = policy_name;
+ 
+ 	/* FIXME: better validation missing */
diff --git a/SOURCES/lvm2-drop-unavailable-libblkid-2_24-BLKID_SUBLKS_BADCSUM-for-signature-detection.patch b/SOURCES/lvm2-drop-unavailable-libblkid-2_24-BLKID_SUBLKS_BADCSUM-for-signature-detection.patch
index 67b7081..f90e258 100644
--- a/SOURCES/lvm2-drop-unavailable-libblkid-2_24-BLKID_SUBLKS_BADCSUM-for-signature-detection.patch
+++ b/SOURCES/lvm2-drop-unavailable-libblkid-2_24-BLKID_SUBLKS_BADCSUM-for-signature-detection.patch
@@ -4,10 +4,10 @@
  3 files changed, 13 insertions(+), 14 deletions(-)
 
 diff --git a/configure b/configure
-index df902c3..d8319e0 100755
+index 3d650a1..31ceb35 100755
 --- a/configure
 +++ b/configure
-@@ -10524,12 +10524,12 @@ if test -n "$BLKID_CFLAGS"; then
+@@ -11217,12 +11217,12 @@ if test -n "$BLKID_CFLAGS"; then
      pkg_cv_BLKID_CFLAGS="$BLKID_CFLAGS"
   elif test -n "$PKG_CONFIG"; then
      if test -n "$PKG_CONFIG" && \
@@ -23,7 +23,7 @@ index df902c3..d8319e0 100755
  		      test "x$?" != "x0" && pkg_failed=yes
  else
    pkg_failed=yes
-@@ -10541,12 +10541,12 @@ if test -n "$BLKID_LIBS"; then
+@@ -11234,12 +11234,12 @@ if test -n "$BLKID_LIBS"; then
      pkg_cv_BLKID_LIBS="$BLKID_LIBS"
   elif test -n "$PKG_CONFIG"; then
      if test -n "$PKG_CONFIG" && \
@@ -39,7 +39,7 @@ index df902c3..d8319e0 100755
  		      test "x$?" != "x0" && pkg_failed=yes
  else
    pkg_failed=yes
-@@ -10567,9 +10567,9 @@ else
+@@ -11260,9 +11260,9 @@ else
          _pkg_short_errors_supported=no
  fi
          if test $_pkg_short_errors_supported = yes; then
@@ -51,7 +51,7 @@ index df902c3..d8319e0 100755
          fi
  	# Put the nasty error message in config.log where it belongs
  	echo "$BLKID_PKG_ERRORS" >&5
-@@ -10577,7 +10577,7 @@ fi
+@@ -11270,7 +11270,7 @@ fi
  	if test "$BLKID_WIPING" = maybe; then
  				BLKID_WIPING=no
  			   else
@@ -60,7 +60,7 @@ index df902c3..d8319e0 100755
  			   fi
  elif test $pkg_failed = untried; then
       	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-@@ -10585,7 +10585,7 @@ $as_echo "no" >&6; }
+@@ -11278,7 +11278,7 @@ $as_echo "no" >&6; }
  	if test "$BLKID_WIPING" = maybe; then
  				BLKID_WIPING=no
  			   else
@@ -70,10 +70,10 @@ index df902c3..d8319e0 100755
  else
  	BLKID_CFLAGS=$pkg_cv_BLKID_CFLAGS
 diff --git a/configure.in b/configure.in
-index 5b22b93..2c3fcba 100644
+index 21ce581..6f1cd5b 100644
 --- a/configure.in
 +++ b/configure.in
-@@ -1077,12 +1077,12 @@ AC_MSG_RESULT($BLKID_WIPING)
+@@ -1193,12 +1193,12 @@ AC_MSG_RESULT($BLKID_WIPING)
  
  if test "$BLKID_WIPING" != no; then
  	pkg_config_init
@@ -89,10 +89,10 @@ index 5b22b93..2c3fcba 100644
  	if test "$BLKID_WIPING" = yes; then
  		BLKID_PC="blkid"
 diff --git a/lib/device/dev-type.c b/lib/device/dev-type.c
-index 001248d..03752a5 100644
+index 82e37e0..ebc8d82 100644
 --- a/lib/device/dev-type.c
 +++ b/lib/device/dev-type.c
-@@ -548,8 +548,7 @@ static int _wipe_known_signatures_with_blkid(struct device *dev, const char *nam
+@@ -625,8 +625,7 @@ static int _wipe_known_signatures_with_blkid(struct device *dev, const char *nam
  						 BLKID_SUBLKS_TYPE |
  						 BLKID_SUBLKS_USAGE |
  						 BLKID_SUBLKS_VERSION |
@@ -101,4 +101,4 @@ index 001248d..03752a5 100644
 +						 BLKID_SUBLKS_MAGIC);
  
  	while (!blkid_do_probe(probe)) {
- 		found++;
+ 		if ((r_wipe = _blkid_wipe(probe, dev, name, types_to_exclude, types_no_prompt, yes, force)) == 1)
diff --git a/SOURCES/lvm2-enable-lvmetad-by-default.patch b/SOURCES/lvm2-enable-lvmetad-by-default.patch
deleted file mode 100644
index 7f16b92..0000000
--- a/SOURCES/lvm2-enable-lvmetad-by-default.patch
+++ /dev/null
@@ -1,30 +0,0 @@
- conf/example.conf.in         | 2 +-
- lib/config/config_settings.h | 2 +-
- 2 files changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/conf/example.conf.in b/conf/example.conf.in
-index d1a1397..812b747 100644
---- a/conf/example.conf.in
-+++ b/conf/example.conf.in
-@@ -730,7 +730,7 @@ global {
-     # is set at the same time, LVM always issues a warning message about this
-     # and then it automatically disables use_lvmetad.
- 
--    use_lvmetad = 0
-+    use_lvmetad = 1
- 
-     # Full path of the utility called to check that a thin metadata device
-     # is in a state that allows it to be used.
-diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h
-index e944b81..7b5beff 100644
---- a/lib/config/config_settings.h
-+++ b/lib/config/config_settings.h
-@@ -177,7 +177,7 @@ cfg(global_mirror_segtype_default_CFG, "mirror_segtype_default", global_CFG_SECT
- cfg(global_raid10_segtype_default_CFG, "raid10_segtype_default", global_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_RAID10_SEGTYPE, vsn(2, 2, 99), NULL)
- cfg(global_sparse_segtype_default_CFG, "sparse_segtype_default", global_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_SPARSE_SEGTYPE, vsn(2, 2, 112), NULL)
- cfg(global_lvdisplay_shows_full_device_path_CFG, "lvdisplay_shows_full_device_path", global_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_BOOL, DEFAULT_LVDISPLAY_SHOWS_FULL_DEVICE_PATH, vsn(2, 2, 89), NULL)
--cfg(global_use_lvmetad_CFG, "use_lvmetad", global_CFG_SECTION, 0, CFG_TYPE_BOOL, 0, vsn(2, 2, 93), NULL)
-+cfg(global_use_lvmetad_CFG, "use_lvmetad", global_CFG_SECTION, 0, CFG_TYPE_BOOL, 1, vsn(2, 2, 93), NULL)
- cfg(global_thin_check_executable_CFG, "thin_check_executable", global_CFG_SECTION, CFG_ALLOW_EMPTY, CFG_TYPE_STRING, THIN_CHECK_CMD, vsn(2, 2, 94), NULL)
- cfg_array(global_thin_check_options_CFG, "thin_check_options", global_CFG_SECTION, 0, CFG_TYPE_STRING, "#S" DEFAULT_THIN_CHECK_OPTIONS, vsn(2, 2, 96), NULL)
- cfg_array(global_thin_disabled_features_CFG, "thin_disabled_features", global_CFG_SECTION, CFG_ALLOW_EMPTY, CFG_TYPE_STRING, NULL, vsn(2, 2, 99), NULL)
diff --git a/SOURCES/lvm2-lvmlockd-tech-preview-warning.patch b/SOURCES/lvm2-lvmlockd-tech-preview-warning.patch
new file mode 100644
index 0000000..e3d1eda
--- /dev/null
+++ b/SOURCES/lvm2-lvmlockd-tech-preview-warning.patch
@@ -0,0 +1,27 @@
+commit dc1c96b8bebbd6bfe9b774fdb13f904f976f29bd
+Author: David Teigland <teigland@redhat.com>
+Date:   Thu Jul 2 13:45:38 2015 -0500
+
+    lvmlockd: tech preview notice
+---
+ tools/toollib.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+diff --git a/tools/toollib.c b/tools/toollib.c
+index 6b8ce22..b8edaea 100644
+--- a/tools/toollib.c
++++ b/tools/toollib.c
+@@ -981,6 +981,13 @@ int vgcreate_params_set_from_args(struct cmd_context *cmd,
+ 		vp_new->clustered = 0;
+ 
+ 	log_debug("Setting lock_type to %s", vp_new->lock_type);
++
++	if (is_lockd_type(vp_new->lock_type)) {
++		log_print("WARNING: shared lock type \"%s\" and lvmlockd are Technology Preview.", vp_new->lock_type);
++		log_print("For more information on Technology Preview features, visit:");
++		log_print("https://access.redhat.com/support/offerings/techpreview/");
++	}
++
+ 	return 1;
+ }
+ 
diff --git a/SOURCES/lvm2-rhel7.patch b/SOURCES/lvm2-rhel7.patch
index 80ed52d..fec262d 100644
--- a/SOURCES/lvm2-rhel7.patch
+++ b/SOURCES/lvm2-rhel7.patch
@@ -7,12 +7,12 @@ index dd4e60e..39d6c15 100644
 --- a/VERSION
 +++ b/VERSION
 @@ -1 +1 @@
--2.02.115(2) (2015-01-21)
-+2.02.115(2)-RHEL7 (2015-01-28)
+-2.02.130(2) (2015-09-05)
++2.02.130(2)-RHEL7 (2015-10-14)
 diff --git a/VERSION_DM b/VERSION_DM
 index d53f47a..005fbd4 100644
 --- a/VERSION_DM
 +++ b/VERSION_DM
 @@ -1 +1 @@
--1.02.93 (2015-01-21)
-+1.02.93-RHEL7 (2015-01-28)
+-1.02.107 (2015-09-05)
++1.02.107-RHEL7 (2015-10-14)
diff --git a/SOURCES/lvm2-set-default-preferred_names.patch b/SOURCES/lvm2-set-default-preferred_names.patch
index 801177f..1c44605 100644
--- a/SOURCES/lvm2-set-default-preferred_names.patch
+++ b/SOURCES/lvm2-set-default-preferred_names.patch
@@ -1,11 +1,30 @@
---- LVM2.2.02.108/conf/example.conf.in	2014-07-23 16:21:02.000000000 +0100
-+++ LVM2.2.02.108-new/conf/example.conf.in	2014-07-23 23:05:06.000000000 +0100
-@@ -58,7 +58,7 @@
-     # preferred_names = [ ]
+ conf/example.conf.in         | 2 +-
+ lib/config/config_settings.h | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/conf/example.conf.in b/conf/example.conf.in
+index c0afcb7..ec12918 100644
+--- a/conf/example.conf.in
++++ b/conf/example.conf.in
+@@ -106,7 +106,7 @@ devices {
+ 	# Example
+ 	# preferred_names = [ "^/dev/mpath/", "^/dev/mapper/mpath", "^/dev/[hs]d" ]
+ 	# 
+-	# This configuration option does not have a default value defined.
++	preferred_names = [ "^/dev/mpath/", "^/dev/mapper/mpath", "^/dev/[hs]d" ]
  
-     # Try to avoid using undescriptive /dev/dm-N names, if present.
--    # preferred_names = [ "^/dev/mpath/", "^/dev/mapper/mpath", "^/dev/[hs]d" ]
-+    preferred_names = [ "^/dev/mpath/", "^/dev/mapper/mpath", "^/dev/[hs]d" ]
+ 	# Configuration option devices/filter.
+ 	# Limit the block devices that are used by LVM commands.
+diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h
+index 9017043..c06b6f0 100644
+--- a/lib/config/config_settings.h
++++ b/lib/config/config_settings.h
+@@ -205,7 +205,7 @@ cfg(devices_external_device_info_source_CFG, "external_device_info_source", devi
+ 	"    compiled with udev support.\n"
+ 	"#\n")
  
-     # In case no prefererred name matches or if preferred_names are not
-     # defined at all, builtin rules are used to determine the preference.
+-cfg_array(devices_preferred_names_CFG, "preferred_names", devices_CFG_SECTION, CFG_ALLOW_EMPTY | CFG_DEFAULT_UNDEFINED , CFG_TYPE_STRING, NULL, vsn(1, 2, 19), NULL, 0, NULL,
++cfg_array(devices_preferred_names_CFG, "preferred_names", devices_CFG_SECTION, CFG_ALLOW_EMPTY, CFG_TYPE_STRING, "#S^/dev/mpath/#S^/dev/mapper/mpath#S^/dev/[hs]d", vsn(1, 2, 19), NULL, 0, NULL,
+ 	"Select which path name to display for a block device.\n"
+ 	"If multiple path names exist for a block device, and LVM needs to\n"
+ 	"display a name for the device, the path names are matched against\n"
diff --git a/SPECS/lvm2.spec b/SPECS/lvm2.spec
index c91b276..9377a64 100644
--- a/SPECS/lvm2.spec
+++ b/SPECS/lvm2.spec
@@ -1,9 +1,11 @@
-%define device_mapper_version 1.02.93
+%define device_mapper_version 1.02.107
 
 %define enable_cache 1
 %define enable_cluster 1
 %define enable_cmirror 1
 %define enable_lvmetad 1
+%define enable_lvmlockd 1
+%define enable_lvmpolld 1
 %define enable_python 1
 %define enable_thin 1
 
@@ -15,12 +17,21 @@
 %define resource_agents_version 3.9.5-25
 %define dlm_version 3.99.1-1
 %define libselinux_version 1.30.19-4
-%define persistent_data_version 0.3.2-1
+%define persistent_data_version 0.5.5-1
+%define sanlock_version 3.2.4-1
+
+%define enable_lockd_sanlock %{enable_lvmlockd}
+%define enable_lockd_dlm %{enable_lvmlockd}
 
 %if 0%{?rhel}
   %ifnarch i686 x86_64 s390x
     %define enable_cluster 0
     %define enable_cmirror 0
+    %define enable_lockd_dlm 0
+  %endif
+
+  %ifnarch x86_64 ppc64le ppc64 aarch64
+    %define enable_lockd_sanlock 0
   %endif
 %endif
 
@@ -40,19 +51,27 @@
 Summary: Userland logical volume management tools 
 Name: lvm2
 Epoch: 7
-Version: 2.02.115
-Release: 3%{?dist}.1
+Version: 2.02.130
+Release: 5%{?dist}
 License: GPLv2
 Group: System Environment/Base
 URL: http://sources.redhat.com/lvm2
 Source0: ftp://sources.redhat.com/pub/lvm2/releases/LVM2.%{version}.tgz
 Patch0: lvm2-rhel7.patch
 Patch1: lvm2-set-default-preferred_names.patch
-Patch2: lvm2-enable-lvmetad-by-default.patch
-Patch3: lvm2-drop-unavailable-libblkid-2_24-BLKID_SUBLKS_BADCSUM-for-signature-detection.patch
-Patch4: lvm2-remove-mpath-device-handling-from-udev-rules.patch
-Patch5: lvm2-2_02_116-fix-raid-image-splitting.patch
-Patch6: lvm2-2_02_116-fix-lvm2app-to-properly-handle-info-status-properties.patch
+Patch2: lvm2-drop-unavailable-libblkid-2_24-BLKID_SUBLKS_BADCSUM-for-signature-detection.patch
+Patch3: lvm2-remove-mpath-device-handling-from-udev-rules.patch
+Patch4: lvm2-lvmlockd-tech-preview-warning.patch
+Patch5: lvm2-2_02_131-standardise-error-paths.patch
+Patch6: lvm2-2_02_131-dmstats-fixups.patch
+Patch7: lvm2-2_02_131-ignore-persistent-cache-if-configuration-changed.patch
+Patch8: lvm2-2_02_131-fix-vg-metadata-comparison-failure-while-scanning-the-vg-for-lvmetad.patch
+Patch9: lvm2-2_02_131-swapping-of-lv-identifiers-handles-more-complex-lvs.patch
+Patch10: lvm2-2_02_131-do-not-check-for-full-thin-pool-when-activating-without-messages.patch
+Patch11: lvm2-2_02_131-disallow-usage-of-stripe-and-stripesize-when-creating-cache-pool.patch
+Patch12: lvm2-2_02_131-fix-vgimportclone-cache_dir-path-name.patch
+Patch13: lvm2-2_02_133-check-for-space-in-thin-pool-before-creating-new-thin.patch
+Patch14: lvm2-2_02_133-enforce-writethrough-mode-for-cleaner-policy.patch
 
 BuildRequires: libselinux-devel >= %{libselinux_version}, libsepol-devel
 BuildRequires: libblkid-devel >= %{util_linux_version}
@@ -60,6 +79,8 @@ BuildRequires: ncurses-devel
 BuildRequires: readline-devel
 %if %{enable_cluster}
 BuildRequires: corosynclib-devel >= %{corosync_version}
+%endif
+%if %{enable_cluster} || %{enable_lockd_dlm}
 BuildRequires: dlm-devel >= %{dlm_version}
 %endif
 BuildRequires: module-init-tools
@@ -70,16 +91,19 @@ BuildRequires: systemd-units
 BuildRequires: python2-devel
 BuildRequires: python-setuptools
 %endif
-%if %{enable_thin}
+%if %{enable_thin} || %{enable_cache}
 BuildRequires: device-mapper-persistent-data >= %{persistent_data_version}
 %endif
+%if %{enable_lockd_sanlock}
+BuildRequires: sanlock-devel >= %{sanlock_version}
+%endif
 Requires: %{name}-libs = %{epoch}:%{version}-%{release}
 Requires: bash >= %{bash_version}
 Requires(post): systemd-units >= %{systemd_version}
 Requires(preun): systemd-units >= %{systemd_version}
 Requires(postun): systemd-units >= %{systemd_version}
 Requires: module-init-tools
-%if %{enable_thin}
+%if %{enable_thin} || %{enable_cache}
 Requires: device-mapper-persistent-data >= %{persistent_data_version}
 %endif
 
@@ -95,11 +119,19 @@ or more physical volumes and creating one or more logical volumes
 %setup -q -n LVM2.%{version}
 %patch0 -p1 -b .rhel7
 %patch1 -p1 -b .preferred_names
-%patch2 -p1 -b .enable_lvmetad
-%patch3 -p1 -b .blkid_sublks_badcsum
-%patch4 -p1 -b .multipath
-%patch5 -p1 -b .raid_split
-%patch6 -p1 -b .lvm2app_info_status
+%patch2 -p1 -b .blkid_sublks_badcsum
+%patch3 -p1 -b .multipath
+%patch4 -p1 -b .lvmlockd_tech_preview
+%patch5 -p1 -b .error_paths
+%patch6 -p1 -b .dmstats_fixups
+%patch7 -p1 -b .persistent_cache_ignore
+%patch8 -p1 -b .lvmetad_rescan_vg_meta_comparison
+%patch9 -p1 -b .lv_swapping_complex
+%patch10 -p1 -b .thin_no_messages_no_check
+%patch11 -p1 -b .disallow_stripe_for_cache_pool
+%patch12 -p1 -b .vgimportclone_cache_dir
+%patch13 -p1 -b .check_for_thin_pool_space
+%patch14 -p1 -b .writethrough_cleaner_policy
 
 %build
 %define _default_pid_dir /run
@@ -117,19 +149,32 @@ or more physical volumes and creating one or more logical volumes
 %endif
 
 %if %{enable_thin}
-%define configure_thin --with-thin=internal --with-thin-check=%{_sbindir}/thin_check --with-thin-dump=%{_sbindir}/thin_dump --with-thin-repair=%{_sbindir}/thin_repair
+%define configure_thin --with-thin=internal
 %endif
 
 %if %{enable_lvmetad}
 %define configure_lvmetad --enable-lvmetad
 %endif
 
+%if %{enable_lockd_dlm}
+%define configure_lockd_dlm --enable-lockd-dlm
+%endif
+
+%if %{enable_lockd_sanlock}
+%define configure_lockd_sanlock --enable-lockd-sanlock
+%endif
+
+%if %{enable_lvmpolld}
+%define configure_lvmpolld --enable-lvmpolld
+%endif
+
 %if %{enable_python}
 %define configure_python --enable-python-bindings
 %endif
 
-%configure --with-default-dm-run-dir=%{_default_dm_run_dir} --with-default-run-dir=%{_default_run_dir} --with-default-pid-dir=%{_default_pid_dir} --with-default-locking-dir=%{_default_locking_dir} --with-usrlibdir=%{_libdir} --enable-lvm1_fallback --enable-fsadm --with-pool=internal --enable-write_install --with-user= --with-group= --with-device-uid=0 --with-device-gid=6 --with-device-mode=0660 --enable-pkgconfig --enable-applib --enable-cmdlib --enable-dmeventd --enable-blkid_wiping %{?configure_python} %{?configure_cluster} %{?configure_cmirror} %{?configure_udev} %{?configure_thin} %{?configure_lvmetad} %{?configure_cache}
+%define configure_final --with-default-dm-run-dir=%{_default_dm_run_dir} --with-default-run-dir=%{_default_run_dir} --with-default-pid-dir=%{_default_pid_dir} --with-default-locking-dir=%{_default_locking_dir} --with-usrlibdir=%{_libdir} --enable-lvm1_fallback --enable-fsadm --with-pool=internal --enable-write_install --with-user= --with-group= --with-device-uid=0 --with-device-gid=6 --with-device-mode=0660 --enable-pkgconfig --enable-applib --enable-cmdlib --enable-dmeventd --enable-blkid_wiping %{?configure_python} %{?configure_cluster} %{?configure_cmirror} %{?configure_udev} %{?configure_thin} %{?configure_lvmetad} %{?configure_cache} %{?configure_lvmpolld} %{?configure_lockd_dlm} %{?configure_lockd_sanlock}
 
+%configure %{?configure_final}
 make %{?_smp_mflags}
 
 %install
@@ -145,38 +190,76 @@ rm -rf $RPM_BUILD_ROOT
 
 %post
 /sbin/ldconfig
-%systemd_post blk-availability.service lvm2-monitor.service
+%systemd_post lvm2-monitor.service
+if [ "$1" = "1" ] ; then
+	# enable and start lvm2-monitor.service on completely new installation only, not on upgrades
+	systemctl enable lvm2-monitor.service
+	systemctl start lvm2-monitor.service
+fi
 %if %{enable_lvmetad}
 %systemd_post lvm2-lvmetad.socket
+# lvm2-lvmetad.socket is always enabled and started and ready to serve if lvmetad is used
+# replace direct systemctl calls with systemd rpm macro once this is provided in the macro:
+# http://cgit.freedesktop.org/systemd/systemd/commit/?id=57ab2eabb8f92fad5239c7d4492e9c6e23ee0678
+systemctl enable lvm2-lvmetad.socket
+systemctl start lvm2-lvmetad.socket
+%endif
+
+%if %{enable_lvmpolld}
+%systemd_post lvm2-lvmpolld.socket
+# lvm2-lvmpolld socket is always enabled and started and ready to serve if lvmpolld is used
+# replace direct systemctl calls with systemd rpm macro once this is provided in the macro:
+# http://cgit.freedesktop.org/systemd/systemd/commit/?id=57ab2eabb8f92fad5239c7d4492e9c6e23ee0678
+systemctl enable lvm2-lvmpolld.socket
+systemctl start lvm2-lvmpolld.socket
 %endif
 
 %preun
-%systemd_preun blk-availability.service lvm2-monitor.service
+%systemd_preun lvm2-monitor.service
 %if %{enable_lvmetad}
 %systemd_preun lvm2-lvmetad.service lvm2-lvmetad.socket
 %endif
 
+%if %{enable_lvmpolld}
+%systemd_preun lvm2-lvmpolld.service lvm2-lvmpolld.socket
+%endif
+
 %postun
 %systemd_postun lvm2-monitor.service
 %if %{enable_lvmetad}
 %systemd_postun_with_restart lvm2-lvmetad.service
 %endif
 
+%if %{enable_lvmpolld}
+%systemd_postun_with_restart lvm2-lvmpolld.service
+%endif
+
+%triggerun -- %{name} < 2.02.86-2
+%{_bindir}/systemd-sysv-convert --save lvm2-monitor >/dev/null 2>&1 || :
+/bin/systemctl --no-reload enable lvm2-monitor.service > /dev/null 2>&1 || :
+/sbin/chkconfig --del lvm2-monitor > /dev/null 2>&1 || :
+/bin/systemctl try-restart lvm2-monitor.service > /dev/null 2>&1 || :
+
 %files
 %defattr(-,root,root,-)
-%doc COPYING COPYING.LIB INSTALL README VERSION WHATS_NEW
+%{!?_licensedir:%global license %%doc}
+%license COPYING COPYING.LIB
+%doc README VERSION WHATS_NEW
 %doc doc/lvm_fault_handling.txt
 
 # Main binaries
 %defattr(555,root,root,-)
-%{_sbindir}/blkdeactivate
 %{_sbindir}/fsadm
 %{_sbindir}/lvm
 %{_sbindir}/lvmconf
+%{_sbindir}/lvmconfig
 %{_sbindir}/lvmdump
 %if %{enable_lvmetad}
 %{_sbindir}/lvmetad
 %endif
+%if %{enable_lvmpolld}
+%{_sbindir}/lvmpolld
+%endif
 %{_sbindir}/vgimportclone
 
 # Other files
@@ -226,7 +309,7 @@ rm -rf $RPM_BUILD_ROOT
 %{_mandir}/man5/lvm.conf.5.gz
 %{_mandir}/man7/lvmcache.7.gz
 %{_mandir}/man7/lvmthin.7.gz
-%{_mandir}/man8/blkdeactivate.8.gz
+%{_mandir}/man7/lvmsystemid.7.gz
 %{_mandir}/man8/fsadm.8.gz
 %{_mandir}/man8/lvchange.8.gz
 %{_mandir}/man8/lvconvert.8.gz
@@ -235,6 +318,8 @@ rm -rf $RPM_BUILD_ROOT
 %{_mandir}/man8/lvextend.8.gz
 %{_mandir}/man8/lvm.8.gz
 %{_mandir}/man8/lvm2-activation-generator.8.gz
+%{_mandir}/man8/lvm-config.8.gz
+%{_mandir}/man8/lvmconfig.8.gz
 %{_mandir}/man8/lvm-dumpconfig.8.gz
 %{_mandir}/man8/lvmchange.8.gz
 %{_mandir}/man8/lvmconf.8.gz
@@ -281,21 +366,27 @@ rm -rf $RPM_BUILD_ROOT
 %{_mandir}/man8/lvmetad.8.gz
 %{_udevdir}/69-dm-lvm-metad.rules
 %endif
-%dir %{_sysconfdir}/lvm
+%if %{enable_lvmpolld}
+%{_mandir}/man8/lvmpolld.8.gz
+%{_mandir}/man8/lvm-lvpoll.8.gz
+%endif
+%attr(755, -, -) %dir %{_sysconfdir}/lvm
 %ghost %{_sysconfdir}/lvm/cache/.cache
 %attr(644, -, -) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/lvm/lvm.conf
-%dir %{_sysconfdir}/lvm/profile
+%attr(644, -, -) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/lvm/lvmlocal.conf
+%attr(755, -, -) %dir %{_sysconfdir}/lvm/profile
 %{_sysconfdir}/lvm/profile/command_profile_template.profile
 %{_sysconfdir}/lvm/profile/metadata_profile_template.profile
 %{_sysconfdir}/lvm/profile/thin-generic.profile
 %{_sysconfdir}/lvm/profile/thin-performance.profile
-%dir %{_sysconfdir}/lvm/backup
-%dir %{_sysconfdir}/lvm/cache
-%dir %{_sysconfdir}/lvm/archive
+%{_sysconfdir}/lvm/profile/cache-mq.profile
+%{_sysconfdir}/lvm/profile/cache-smq.profile
+%attr(700, -, -) %dir %{_sysconfdir}/lvm/backup
+%attr(700, -, -) %dir %{_sysconfdir}/lvm/cache
+%attr(700, -, -) %dir %{_sysconfdir}/lvm/archive
 %ghost %dir %{_default_locking_dir}
 %ghost %dir %{_default_run_dir}
 %{_tmpfilesdir}/%{name}.conf
-%{_unitdir}/blk-availability.service
 %{_unitdir}/lvm2-monitor.service
 %attr(555, -, -) %{_prefix}/lib/systemd/system-generators/lvm2-activation-generator
 %if %{enable_lvmetad}
@@ -303,6 +394,10 @@ rm -rf $RPM_BUILD_ROOT
 %{_unitdir}/lvm2-lvmetad.service
 %{_unitdir}/lvm2-pvscan@.service
 %endif
+%if %{enable_lvmpolld}
+%{_unitdir}/lvm2-lvmpolld.socket
+%{_unitdir}/lvm2-lvmpolld.service
+%endif
 
 ##############################################################################
 # Library and Development subpackages
@@ -344,6 +439,8 @@ This package contains shared lvm2 libraries for applications.
 
 %files libs
 %defattr(555,root,root,-)
+%{!?_licensedir:%global license %%doc}
+%license COPYING.LIB
 %{_libdir}/liblvm2app.so.*
 %{_libdir}/liblvm2cmd.so.*
 %{_libdir}/libdevmapper-event-lvm2.so.*
@@ -380,6 +477,48 @@ logical volumes, physical volumes, and volume groups.
 %endif
 
 ##############################################################################
+# LVM locking daemon
+##############################################################################
+%if %{enable_lockd_dlm} || %{enable_lockd_sanlock}
+%package lockd
+Summary: LVM locking daemon
+Group: System Environment/Base
+Requires: lvm2 = %{epoch}:%{version}-%{release}
+%if %{enable_lockd_dlm}
+Requires: dlm-lib >= %{dlm_version}
+%endif
+%if %{enable_lockd_sanlock}
+Requires: sanlock-lib >= %{sanlock_version}
+%endif
+Requires(post): systemd-units >= %{systemd_version}
+Requires(preun): systemd-units >= %{systemd_version}
+Requires(postun): systemd-units >= %{systemd_version}
+
+%description lockd
+
+LVM commands use lvmlockd to coordinate access to shared storage.
+
+%post lockd
+%systemd_post lvm2-lvmlockd.service lvm2-lvmlocking.service
+
+%preun lockd
+%systemd_preun lvm2-lvmlockd.service lvm2-lvmlocking.service
+
+%postun lockd
+%systemd_postun lvm2-lvmlockd.service lvm2-lvmlocking.service
+
+%files lockd
+%defattr(444,root,root,-)
+%%attr(555, -, -) %{_sbindir}/lvmlockd
+%%attr(555, -, -) %{_sbindir}/lvmlockctl
+%{_mandir}/man8/lvmlockd.8.gz
+%{_mandir}/man8/lvmlockctl.8.gz
+%{_unitdir}/lvm2-lvmlockd.service
+%{_unitdir}/lvm2-lvmlocking.service
+
+%endif
+
+##############################################################################
 # Cluster subpackage
 # The 'clvm' OCF script to manage clvmd instance is part of resource-agents.
 ##############################################################################
@@ -527,6 +666,9 @@ is not used as the system init process.
 %if %{enable_lvmetad}
 %{_sysconfdir}/rc.d/init.d/lvm2-lvmetad
 %endif
+%if %{enable_lvmpolld}
+%{_sysconfdir}/rc.d/init.d/lvm2-lvmpolld
+%endif
 
 ##############################################################################
 # Device-mapper subpackages
@@ -549,16 +691,27 @@ Conflicts: dracut < %{dracut_version}
 This package contains the supporting userspace utility, dmsetup,
 for the kernel device-mapper.
 
+%post -n device-mapper
+%systemd_post blk-availability.service
+
+%preun -n device-mapper
+%systemd_preun blk-availability.service
+
 %files -n device-mapper
 %defattr(-,root,root,-)
 %doc COPYING COPYING.LIB WHATS_NEW_DM VERSION_DM README INSTALL
 %doc udev/12-dm-permissions.rules
 %defattr(444,root,root,-)
 %attr(555, -, -) %{_sbindir}/dmsetup
+%attr(555, -, -) %{_sbindir}/blkdeactivate
+%{_sbindir}/dmstats
 %{_mandir}/man8/dmsetup.8.gz
+%{_mandir}/man8/dmstats.8.gz
+%{_mandir}/man8/blkdeactivate.8.gz
 %{_udevdir}/10-dm.rules
 %{_udevdir}/13-dm-disk.rules
 %{_udevdir}/95-dm-notify.rules
+%{_unitdir}/blk-availability.service
 
 %package -n device-mapper-devel
 Summary: Development libraries and headers for device-mapper
@@ -596,6 +749,8 @@ This package contains the device-mapper shared library, libdevmapper.
 
 %files -n device-mapper-libs
 %defattr(555,root,root,-)
+%{!?_licensedir:%global license %%doc}
+%license COPYING COPYING.LIB
 %{_libdir}/libdevmapper.so.*
 
 %package -n device-mapper-event
@@ -615,6 +770,11 @@ of device-mapper devices.
 
 %post -n device-mapper-event
 %systemd_post dm-event.socket
+# dm-event.socket is always enabled and started and ready to serve if dmeventd is used
+# replace direct systemctl calls with systemd rpm macro once this is provided in the macro:
+# http://cgit.freedesktop.org/systemd/systemd/commit/?id=57ab2eabb8f92fad5239c7d4492e9c6e23ee0678
+systemctl enable dm-event.socket
+systemctl start dm-event.socket
 if [ -e %{_default_pid_dir}/dmeventd.pid ]; then
 	%{_sbindir}/dmeventd -R || echo "Failed to restart dmeventd daemon. Please, try manual restart."
 fi
@@ -646,6 +806,8 @@ libdevmapper-event.
 
 %files -n device-mapper-event-libs
 %defattr(555,root,root,-)
+%{!?_licensedir:%global license %%doc}
+%license COPYING.LIB
 %{_libdir}/libdevmapper-event.so.*
 
 %package -n device-mapper-event-devel
@@ -668,9 +830,147 @@ the device-mapper event library.
 %{_libdir}/pkgconfig/devmapper-event.pc
 
 %changelog
-* Mon May 18 2015 Peter Rajnoha <prajnoha@redhat.com> - 7:2.02.115-3.el7_1.1
-- Fix lvm2app lvm_lv_get_property return value for fields with info/status ioctl.
-- Fix lvm2app regression in lvm_lv_get_attr causing unknown values (2.02.115).
+* Wed Oct 14 2015 Peter Rajnoha <prajnoha@redhat.com> - 7:2.02.130-5
+- Fixup /etc/lvm/archive ownership.
+
+* Wed Oct 14 2015 Peter Rajnoha <prajnoha@redhat.com> - 7:2.02.130-4
+- Reinstate /etc/lvm dir content permissions after change in defaults.
+
+* Wed Oct 14 2015 Peter Rajnoha <prajnoha@redhat.com> - 7:2.02.130-3
+- Enforce writethrough mode for cleaner policy.
+- Check for enough space in thin-pool in command before creating new thin.
+
+* Tue Sep 15 2015 Peter Rajnoha <prajnoha@redhat.com> - 7:2.02.130-2
+- Fix vgimportclone cache_dir path name (2.02.115).
+- Disallow usage of --stripe and --stripesize when creating cache pool.
+- Swapping of LV identifiers handles more complex LVs.
+- Fix VG metadata comparison failure while scanning the VG for lvmetad.
+- Ignore persistent cache if configuration changed. (2.02.127)
+- Do not check for full thin pool when activating without messages (1.02.107).
+
+* Wed Sep 09 2015 Peter Rajnoha <prajnoha@redhat.com> - 7:2.02.130-1
+- Fix use of uninitialized device status if reading outdated .cache record.
+- Restore support for --monitor option in lvcreate (2.02.112).
+- Read thin-pool data and metadata percent without flush.
+- Detect blocked thin-pool and avoid scanning their thin volumes.
+- Check if dm device is usable before checking its size (2.02.116).
+- Extend parsing of cache_check version in configure.
+- Make lvpoll error messages visible in lvmpolld's stderr and in syslog.
+- Add 'make install_full_man' to install all man pages regardless of config.
+- Parse thin-pool status with one single routine internally.
+- Add --histogram to select default histogram fields for list and report.
+- Add report fields for displaying latency histogram configuration and data.
+- Add dmstats --bounds to specify histogram boundaries for a new region.
+- Add dm_histogram_to_string() to format histogram data in string form.
+- Add public methods to libdm to access numerical histogram config and data.
+- Parse and store histogram data in dm_stats_list() and dm_stats_populate().
+- Add an argument to specify histogram bounds to dm_stats_create_region().
+- Add dm_histogram_bounds_from_{string,uint64_t}() to parse histogram bounds.
+- Add dm_histogram handle type to represent a latency histogram and its bounds.
+
+* Wed Sep 02 2015 Peter Rajnoha <prajnoha@redhat.com> - 7:2.02.129-2
+- Reinstate dm_task_get_info@Base to libdevmapper exports. (1.02.106)
+
+* Mon Aug 31 2015 Peter Rajnoha <prajnoha@redhat.com> - 7:2.02.129-1
+- Drop error message when vgdisplay encounters an exported VG. (2.02.27)
+- Fix shared library generation to stop exporting internal functions.(2.02.120)
+- Accept --cachemode with lvconvert.
+- Fix and improve reporting properties of cache-pool.
+- Enable usage of --cachepolicy and --cachesetting with lvconvert.
+- Don't allow to reduce size of thin-pool metadata.
+- Fix debug buffer overflows in cmirrord logging.
+- Add --foreground and --help to cmirrord.
+- Add 'precise' column to statistics reports.
+- Add --precise switch to 'dmstats create' to request nanosecond counters.
+- Add precise argument to dm_stats_create_region().
+- Add support to libdm-stats for precise_timestamps
+- Fix devmapper.pc pkgconfig file to declare -lrt dependency properly.
+
+* Tue Aug 18 2015 Peter Rajnoha <prajnoha@redhat.com> - 7:2.02.128-1
+- Allocation setting cache_pool_cachemode is replaced by cache_mode.
+- Don't attempt to close config file that couldn't be opened.
+- Check for valid cache mode in validation of cache segment.
+- Change internal interface handling cache mode and policy.
+- When no cache policy specified, prefer smq (if available) over mq.
+- Add demo cache-mq and cache-smq profiles.
+- Add cmd profilable allocation/cache_policy,cache_settings,cache_mode.
+- Require cache_check 0.5.4 for use of --clear-needs-check-flag.
+- Fix lvmetad udev rules to not override SYSTEMD_WANTS, add the service instead.
+- Fix 'dmstats list -o all' segfault.
+- Separate dmstats statistics fields from region information fields.
+- Add interval and interval_ns fields to dmstats reports.
+- Do not include internal glibc headers in libdm-timestamp.c (1.02.104)
+- Exit immediately if no device is supplied to dmsetup wipe_table.
+- Suppress dmsetup report headings when no data is output. (1.02.104)
+- Adjust dmsetup usage/help output selection to match command invoked.
+- Fix dmsetup -o all to select correct fields in splitname report.
+- Restructure internal dmsetup argument handling across all commands.
+- Add dm_report_is_empty() to indicate there is no data awaiting output.
+- Add more arg validation for dm_tree_node_add_cache_target().
+- Add --alldevices switch to replace use of --force for stats create / delete.
+
+* Mon Aug 10 2015 Peter Rajnoha <prajnoha@redhat.com> - 7:2.02.127-1
+- Do not init filters, locking, lvmetad, lvmpolld if command doesn't use it.
+- 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.
+- 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 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 statistics fields to dmsetup -o.
+- Add libdm-stats library to allow management of device-mapper statistics.
+- 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.
+
+* Tue Jul 28 2015 Peter Rajnoha <prajnoha@redhat.com> - 7:2.02.126-1
+- Fix long option hyphen removal. (2.02.122)
+- Fix clvmd freeze if client disappears without first releasing its locks.
+- Fix lvconvert segfaults while performing snapshots merge.
+- Ignore errors during detection if use_blkid_wiping=1 and --force is used.
+- Recognise DM_ABORT_ON_INTERNAL_ERRORS env var override in lvm logging fn.
+- Fix alloc segfault when extending LV with fewer stripes than in first seg.
+- Fix handling of cache policy name.
+- Set cache policy before with the first lvm2 cache pool metadata commit.
+- Fix detection of thin-pool overprovisioning (2.02.124).
+- Fix lvmpolld segfaults on 32 bit architectures.
+- Add lvmlockd lock_args validation to vg_validate.
+- Fix ignored --startstopservices option if running lvmconf with systemd.
+- Hide sanlock LVs when processing LVs in VG unless named or --all used.
+- Introduce libdevmapper wrappers for all malloc-related functions.
+
+* Fri Jul 10 2015 Peter Rajnoha <prajnoha@redhat.com> - 7:2.02.125-2
+- lvm2-lockd subpackage requires dlm-lib or sanlock-lib or both
+  based on which support is compiled in.
+- lvm2-lockd subpackage requires dlm-lib instead of former dlm
+  for lvmlockd daemon with dlm support.
+
+* Tue Jul 07 2015 Peter Rajnoha <prajnoha@redhat.com> - 7:2.02.125-1
+- Fix getline memory usage in lvmpolld.
+- Add support --clear-needs-check-flag for cache_check of cache pool metadata.
+- Add lvmetactl for developer use only.
+- Rename global/lock_retries to lvmlockd_retries.
+- Replace --enable-lvmlockd by --enable-lockd-sanlock and --enable-lockd-dlm.
+
+* Mon Jul 06 2015 Peter Rajnoha <prajnoha@redhat.com> - 7:2.02.124-1
+- Add lvm2-lockd subpackage with technical preview of lvm locking daemon.
+- Update to latest upstream release with various fixes and
+  enhancements documented in WHATS_NEW and WHATS_NEW_DM file.
 
 * Wed Jan 28 2015 Peter Rajnoha <prajnoha@redhat.com> - 7:2.02.115-3
 - Preserve chunk size with repair and metadata swap of a thin pool.