master - lvconvert: Don't require a 'force' option during RAID repair.
by Jonathan Brassow
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=d34d2068ddf20b7d683...
Commit: d34d2068ddf20b7d683ee06205c31ec673b32813
Parent: c87907dcd5385337ba96c79b4bee8e3d2f2ea129
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Wed Jun 14 08:39:07 2017 -0500
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Wed Jun 14 08:39:07 2017 -0500
lvconvert: Don't require a 'force' option during RAID repair.
Previously, we were treating non-RAID to RAID up-converts as a "resync"
operation. (The most common example being 'linear -> RAID1'.) RAID to
RAID up-converts or rebuilds of specific RAID images are properly treated
as a "recover" operation.
Since we were treating some up-convert operations as "resync", it was
possible to have scenarios where data corruption or data loss were
possibilities if the RAID hadn't been able to sync completely before a
loss of the primary source devices. In order to ensure that the user took
the proper precautions in such scenarios, we required a '--force' option
to be present. Unfortuneately, the force option was rendered useless
because there was no way to distiguish the failure state of a potentially
destructive repair from a nominal one - making the '--force' option a
requirement for any RAID1 repair!
We now treat non-RAID to RAID up-converts properly as "recover" operations.
This eliminates the scenarios that can potentially cause data loss or
data corruption; and this eliminates the need for the '--force' requirement.
This patch removes the requirement to specify '--force' for RAID repairs.
---
WHATS_NEW | 1 +
lib/metadata/raid_manip.c | 31 +------------------------------
2 files changed, 2 insertions(+), 30 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index c7f8903..b2796f6 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.172 -
===============================
+ No longer necessary to '--force' a repair for RAID1
Linear to RAID1 upconverts now use "recover" sync action, not "resync".
Improve lvcreate --cachepool arg validation.
Limit maximal size of thin-pool for specific chunk size.
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index 425abbb..ac0b8f1 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -409,23 +409,6 @@ int lv_raid_in_sync(const struct logical_volume *lv)
return _raid_in_sync(lv);
}
-/* Check if RaidLV @lv is synced or any raid legs of @lv are not synced */
-static int _raid_devs_sync_healthy(struct logical_volume *lv)
-{
- char *raid_health;
-
- if (!_raid_in_sync(lv))
- return 0;
-
- if (!seg_is_raid1(first_seg(lv)))
- return 1;
-
- if (!lv_raid_dev_health(lv, &raid_health))
- return_0;
-
- return (strchr(raid_health, 'a') || strchr(raid_health, 'D')) ? 0 : 1;
-}
-
/*
* _raid_remove_top_layer
* @lv
@@ -2964,20 +2947,8 @@ static int _raid_extract_images(struct logical_volume *lv,
if (!lv_is_on_pvs(seg_lv(seg, s), target_pvs) &&
!lv_is_on_pvs(seg_metalv(seg, s), target_pvs))
continue;
-
- /*
- * Kernel may report raid LV in-sync but still
- * image devices may not be in-sync or faulty.
- */
- if (!_raid_devs_sync_healthy(lv) &&
- (!seg_is_mirrored(seg) || (s == 0 && !force))) {
- log_error("Unable to extract %sRAID image"
- " while RAID array is not in-sync%s.",
- seg_is_mirrored(seg) ? "primary " : "",
- seg_is_mirrored(seg) ? " (use --force option to replace)" : "");
- return 0;
- }
}
+
if (!_extract_image_components(seg, s, &rmeta_lv, &rimage_lv)) {
log_error("Failed to extract %s from %s.",
display_lvname(seg_lv(seg, s)),
6 years, 10 months
master - lvconvert: linear -> raid1 upconvert should cause "recover" not "resync"
by Jonathan Brassow
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=c87907dcd5385337ba9...
Commit: c87907dcd5385337ba96c79b4bee8e3d2f2ea129
Parent: 14d563accc7692dfd827a4db91912c9ab498ca1f
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Wed Jun 14 08:33:42 2017 -0500
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Wed Jun 14 08:35:22 2017 -0500
lvconvert: linear -> raid1 upconvert should cause "recover" not "resync"
Two of the sync actions performed by the kernel (aka MD runtime) are
"resync" and "recover". The "resync" refers to when an entirely new array
is going through the process of initializing (or resynchronizing after an
unexpected shutdown). The "recover" is the process of initializing a new
member device to the array. So, a brand new array with all new devices
will undergo "resync". An array with replaced or added sub-LVs will undergo
"recover".
These two states are treated very differently when failures happen. If any
device is lost or replaced while "resync", there are no worries. This is
because any writes created from the inception of the array have occurred to
all the devices and can be safely recovered. Even though non-initialized
portions will still be resync'ed with uninitialized data, it is ok. However,
if a pre-existing device is lost (aka, the original linear device in a
linear -> raid1 convert) during a "recover", data loss can be the result.
Thus, writes are errored by the kernel and recovery is halted. The failed
device must be restored or removed. This is the correct behavior.
Unfortunately, we were treating an up-convert from linear as a "resync"
when we should have been treating it as a "recover". This patch
removes the special case for linear upconvert. It allows each new image
sub-LV to be marked with a rebuild flag and treats the array as 'in-sync'.
This has the correct effect of causing the upconvert to be treated as a
"recover" rather than a "resync". There is no need to flag these two states
differently in LVM metadata, because they are already considered differently
by the kernel RAID metadata. (Any activation/deactivation will properly
resume the "recover" process and not a "resync" process.)
We make this behavior change based on the presense of dm-raid target
version 1.9.0+.
---
WHATS_NEW | 1 +
lib/metadata/raid_manip.c | 35 +++++++++++++++++++++++++++++++++--
lib/metadata/segtype.h | 18 ++++++++++++++++++
lib/raid/raid.c | 1 +
test/shell/lvcreate-large-raid.sh | 10 +++++++++-
5 files changed, 62 insertions(+), 3 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index cdd401e..c7f8903 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.172 -
===============================
+ Linear to RAID1 upconverts now use "recover" sync action, not "resync".
Improve lvcreate --cachepool arg validation.
Limit maximal size of thin-pool for specific chunk size.
Print a warning about in-use PVs with no VG using them.
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index a19a7e9..425abbb 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -57,6 +57,25 @@ static int _reshape_is_supported(struct cmd_context *cmd, const struct segment_t
}
/*
+ * Check if rebuild CTR args are allowed when other images exist in the array
+ * with empty metadata areas for this kernel.
+ */
+static int _rebuild_with_emptymeta_is_supported(struct cmd_context *cmd,
+ const struct segment_type *segtype)
+{
+ unsigned attrs;
+
+ if (!segtype->ops->target_present ||
+ !segtype->ops->target_present(cmd, NULL, &attrs) ||
+ !(attrs & RAID_FEATURE_NEW_DEVICES_ACCEPT_REBUILD)) {
+ log_verbose("RAID module does not support rebuild+emptymeta.");
+ return 0;
+ }
+
+ return 1;
+}
+
+/*
* Ensure region size exceeds the minimum for @lv because
* MD's bitmap is limited to tracking 2^21 regions.
*
@@ -2550,6 +2569,7 @@ static int _raid_add_images_without_commit(struct logical_volume *lv,
struct dm_list meta_lvs, data_lvs;
struct lv_list *lvl;
struct lv_segment_area *new_areas;
+ struct segment_type *segtype;
if (lv_is_not_synced(lv)) {
log_error("Can't add image to out-of-sync RAID LV:"
@@ -2581,8 +2601,19 @@ static int _raid_add_images_without_commit(struct logical_volume *lv,
* LV to accompany it.
*/
if (seg_is_linear(seg)) {
- /* A complete resync will be done, no need to mark each sub-lv */
- status_mask = ~(LV_REBUILD);
+ /*
+ * As of dm-raid version 1.9.0, it is possible to specify
+ * RAID table lines with the 'rebuild' parameters necessary
+ * to force a "recover" instead of a "resync" on upconvert.
+ *
+ * LVM's interaction with older kernels should be as before -
+ * performing a complete resync rather than a set of rebuilds.
+ */
+ if (!(segtype = get_segtype_from_string(lv->vg->cmd, SEG_TYPE_NAME_RAID1)))
+ return_0;
+
+ if (!_rebuild_with_emptymeta_is_supported(lv->vg->cmd, segtype))
+ status_mask = ~(LV_REBUILD);
/* FIXME: allow setting region size on upconvert from linear */
seg->region_size = get_default_region_size(lv->vg->cmd);
diff --git a/lib/metadata/segtype.h b/lib/metadata/segtype.h
index 93132c3..2acb894 100644
--- a/lib/metadata/segtype.h
+++ b/lib/metadata/segtype.h
@@ -290,6 +290,24 @@ struct segment_type *init_unknown_segtype(struct cmd_context *cmd,
#define RAID_FEATURE_RAID4 (1U << 3) /* ! version 1.8 or 1.9.0 */
#define RAID_FEATURE_SHRINK (1U << 4) /* version 1.9.0 */
#define RAID_FEATURE_RESHAPE (1U << 5) /* version 1.10.1 */
+/*
+ * RAID_FEATURE_NEW_DEVICES_ACCEPT_REBUILD
+ * This signifies a behavioral change in dm-raid. Prior to upstream kernel
+ * commit 33e53f068, the kernel would refuse to allow 'rebuild' CTR args to
+ * be submitted when other devices in the array had uninitialized superblocks.
+ * After the commit, these parameters were allowed.
+ *
+ * The most obvious useful case of this new behavior is up-converting a
+ * linear device to RAID1. A new superblock is allocated for the linear dev
+ * and it will be uninitialized, while all the new images are specified for
+ * 'rebuild'. This valid scenario would not have been allowed prior to
+ * commit 33e53f068.
+ *
+ * Commit 33e53f068 did not bump the dm-raid version number. So it exists
+ * in some, but not all 1.8.1 versions of dm-raid. The only way to be
+ * certain the new behavior exists is to check for version 1.9.0.
+ */
+#define RAID_FEATURE_NEW_DEVICES_ACCEPT_REBUILD (1U << 6) /* version 1.9.0 */
#ifdef RAID_INTERNAL
int init_raid_segtypes(struct cmd_context *cmd, struct segtype_library *seglib);
diff --git a/lib/raid/raid.c b/lib/raid/raid.c
index 25009f6..8a53d7e 100644
--- a/lib/raid/raid.c
+++ b/lib/raid/raid.c
@@ -474,6 +474,7 @@ static int _raid_target_present(struct cmd_context *cmd,
{ 1, 3, 0, RAID_FEATURE_RAID10, SEG_TYPE_NAME_RAID10 },
{ 1, 7, 0, RAID_FEATURE_RAID0, SEG_TYPE_NAME_RAID0 },
{ 1, 9, 0, RAID_FEATURE_SHRINK, "shrinking" },
+ { 1, 9, 0, RAID_FEATURE_NEW_DEVICES_ACCEPT_REBUILD, "rebuild+emptymeta" },
{ 1, 10, 1, RAID_FEATURE_RESHAPE, "reshaping" },
};
diff --git a/test/shell/lvcreate-large-raid.sh b/test/shell/lvcreate-large-raid.sh
index ca3f715..7ec140b 100644
--- a/test/shell/lvcreate-large-raid.sh
+++ b/test/shell/lvcreate-large-raid.sh
@@ -101,7 +101,15 @@ lvremove -ff $vg1
lvcreate -aey -L 200T -n $lv1 $vg1
lvconvert -y --type raid1 -m 1 $vg1/$lv1
check lv_field $vg1/$lv1 size "200.00t"
-check raid_leg_status $vg1 $lv1 "aa"
+if aux have_raid 1 9 0; then
+ # The 1.9.0 version of dm-raid is capable of performing
+ # linear -> RAID1 upconverts as "recover" not "resync"
+ # The LVM code now checks the dm-raid version when
+ # upconverting and if 1.9.0+ is found, it uses "recover"
+ check raid_leg_status $vg1 $lv1 "Aa"
+else
+ check raid_leg_status $vg1 $lv1 "aa"
+fi
lvremove -ff $vg1
# bz837927 END
6 years, 10 months
master - raid: change reshape segtype flags
by Heinz Mauelshagen
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=14d563accc7692dfd82...
Commit: 14d563accc7692dfd827a4db91912c9ab498ca1f
Parent: 08079ec42062944eadcd4e5625edafe45b36c55c
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Wed Jun 14 15:01:19 2017 +0200
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Wed Jun 14 15:01:19 2017 +0200
raid: change reshape segtype flags
Commit 1c916ec5ffd37cfb7be2101b93a2dc91aa2ef7f0
missed new reshape flags.
---
lib/format_text/flags.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/format_text/flags.c b/lib/format_text/flags.c
index a9548e0..88fb091 100644
--- a/lib/format_text/flags.c
+++ b/lib/format_text/flags.c
@@ -63,9 +63,9 @@ static const struct flag _lv_flags[] = {
{LV_NOTSYNCED, "NOTSYNCED", STATUS_FLAG},
{LV_REBUILD, "REBUILD", STATUS_FLAG},
{LV_RESHAPE, "RESHAPE", SEGTYPE_FLAG},
- {LV_RESHAPE_DELTA_DISKS_PLUS, "RESHAPE_DELTA_DISKS_PLUS", STATUS_FLAG},
- {LV_RESHAPE_DELTA_DISKS_MINUS, "RESHAPE_DELTA_DISKS_MINUS", STATUS_FLAG},
- {LV_REMOVE_AFTER_RESHAPE, "REMOVE_AFTER_RESHAPE", STATUS_FLAG},
+ {LV_RESHAPE_DELTA_DISKS_PLUS, "RESHAPE_DELTA_DISKS_PLUS", SEGTYPE_FLAG},
+ {LV_RESHAPE_DELTA_DISKS_MINUS, "RESHAPE_DELTA_DISKS_MINUS", SEGTYPE_FLAG},
+ {LV_REMOVE_AFTER_RESHAPE, "REMOVE_AFTER_RESHAPE", SEGTYPE_FLAG},
{LV_WRITEMOSTLY, "WRITEMOSTLY", STATUS_FLAG},
{LV_ACTIVATION_SKIP, "ACTIVATION_SKIP", COMPATIBLE_FLAG},
{LV_ERROR_WHEN_FULL, "ERROR_WHEN_FULL", COMPATIBLE_FLAG},
6 years, 10 months
master - lvconvert: fix detached SubLV deactivation in cluster
by Heinz Mauelshagen
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=08079ec42062944eadc...
Commit: 08079ec42062944eadcd4e5625edafe45b36c55c
Parent: 9a094350e044100fdfb2270a18085e42e6f5ba3a
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Tue Jun 13 23:15:51 2017 +0200
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Tue Jun 13 23:15:51 2017 +0200
lvconvert: fix detached SubLV deactivation in cluster
On conversion from raid10 to raid0 (takeover), all rmeta
devices and the rimage devices of mirrored stripes are
detached from the raid10 LV. The remaining rimage areas
are being shifted down into the slots of the detached
ones hence requiring renames to show proper _N suffix
sequences (e.g. 0,1,2,3 instead of 0,2,4,6). Only the
top-level raid10 LV has a cluster lock, not the detached
SubLVs thus their deactivation is impossible and e.g the
rename from *_rimage_6 to *_rimage_3 will fail. Fix by
activating exclusively before deactivating and removing.
Resolves: rhbz1448123
---
lib/metadata/raid_manip.c | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index fd51964..a19a7e9 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -285,6 +285,17 @@ static int _deactivate_and_remove_lvs(struct volume_group *vg, struct dm_list *r
struct lv_list *lvl;
dm_list_iterate_items(lvl, removal_lvs) {
+ if (!lv_is_visible(lvl->lv)) {
+ log_error(INTERNAL_ERROR
+ "LVs must be set visible before removing.");
+ return 0;
+ }
+ /* Got to get any cluster lock an SubLVs to be removed. */
+ if (!activate_lv_excl_local(vg->cmd, lvl->lv))
+ return_0;
+ }
+
+ dm_list_iterate_items(lvl, removal_lvs) {
if (!deactivate_lv(vg->cmd, lvl->lv))
return_0;
if (!lv_remove(lvl->lv))
6 years, 10 months
master - dmfilemapd: do not wait if file has been truncated
by Bryn Reeves
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=9a094350e044100fdfb...
Commit: 9a094350e044100fdfb2270a18085e42e6f5ba3a
Parent: 0cb628dfe2980b45fb7db5edd2f197d23905b02e
Author: Bryn M. Reeves <bmr(a)redhat.com>
AuthorDate: Wed Jun 7 19:29:16 2017 +0100
Committer: Bryn M. Reeves <bmr(a)redhat.com>
CommitterDate: Tue Jun 13 19:46:41 2017 +0100
dmfilemapd: do not wait if file has been truncated
---
daemons/dmfilemapd/dmfilemapd.c | 16 +++++++++-------
1 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/daemons/dmfilemapd/dmfilemapd.c b/daemons/dmfilemapd/dmfilemapd.c
index 0dbdefc..43ae970 100644
--- a/daemons/dmfilemapd/dmfilemapd.c
+++ b/daemons/dmfilemapd/dmfilemapd.c
@@ -686,7 +686,10 @@ static int _update_regions(struct dm_stats *dms, struct filemap_monitor *fm)
for (region = regions; *region != DM_STATS_REGIONS_ALL; region++)
nr_regions++;
- if (regions[0] != fm->group_id) {
+ if (!nr_regions)
+ log_warn("File contains no extents: exiting.");
+
+ if (nr_regions && (regions[0] != fm->group_id)) {
log_warn("group_id changed from " FMTu64 " to " FMTu64,
fm->group_id, regions[0]);
fm->group_id = regions[0];
@@ -753,17 +756,16 @@ static int _dmfilemapd(struct filemap_monitor *fm)
if ((check = _filemap_fd_check_changed(fm)) < 0)
goto bad;
- if (!check)
- goto wait;
-
- if (!_update_regions(dms, fm))
+ if (check && !_update_regions(dms, fm))
goto bad;
+ running = !!fm->nr_regions;
+ if (!running)
+ continue;
+
wait:
_filemap_monitor_wait(FILEMAPD_WAIT_USECS);
- running = !!fm->nr_regions;
-
/* mode=inode termination condions */
if (fm->mode == DM_FILEMAPD_FOLLOW_INODE) {
if (!_filemap_monitor_check_file_unlinked(fm))
6 years, 10 months
master - dmfilemapd: update file block count at daemon start
by Bryn Reeves
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=0cb628dfe2980b45fb7...
Commit: 0cb628dfe2980b45fb7db5edd2f197d23905b02e
Parent: 744f2920dbb03c391a2d4981ed6c93af85121e7e
Author: Bryn M. Reeves <bmr(a)redhat.com>
AuthorDate: Wed Jun 7 19:26:09 2017 +0100
Committer: Bryn M. Reeves <bmr(a)redhat.com>
CommitterDate: Tue Jun 13 19:46:41 2017 +0100
dmfilemapd: update file block count at daemon start
The file block count stored in the filemap_monitor was lazily
initialised at the time of the first check. This causes problems
in the case that the file has been truncated between this time and
the time the daemon started: the initial block count and current
block count match and the daemon fails to detect a change.
Separate the setting of the block count from the check and make a
call to update the value at the start of _dmfilemapd().
---
daemons/dmfilemapd/dmfilemapd.c | 28 +++++++++++++++++-----------
1 files changed, 17 insertions(+), 11 deletions(-)
diff --git a/daemons/dmfilemapd/dmfilemapd.c b/daemons/dmfilemapd/dmfilemapd.c
index 2637bd2..0dbdefc 100644
--- a/daemons/dmfilemapd/dmfilemapd.c
+++ b/daemons/dmfilemapd/dmfilemapd.c
@@ -357,30 +357,33 @@ static int _parse_args(int argc, char **argv, struct filemap_monitor *fm)
return 1;
}
-static int _filemap_fd_check_changed(struct filemap_monitor *fm)
+static int _filemap_fd_update_blocks(struct filemap_monitor *fm)
{
- int64_t blocks, old_blocks;
struct stat buf;
if (fm->fd < 0) {
log_error("Filemap fd is not open.");
- return -1;
+ return 0;
}
if (fstat(fm->fd, &buf)) {
log_error("Failed to fstat filemap file descriptor.");
- return -1;
+ return 0;
}
- blocks = buf.st_blocks;
+ fm->blocks = buf.st_blocks;
- /* first check? */
- if (fm->blocks < 0)
- old_blocks = buf.st_blocks;
- else
- old_blocks = fm->blocks;
+ return 1;
+}
- fm->blocks = blocks;
+static int _filemap_fd_check_changed(struct filemap_monitor *fm)
+{
+ int64_t old_blocks;
+
+ old_blocks = fm->blocks;
+
+ if (!_filemap_fd_update_blocks(fm))
+ return -1;
return (fm->blocks != old_blocks);
}
@@ -714,6 +717,9 @@ static int _dmfilemapd(struct filemap_monitor *fm)
if (!_filemap_monitor_set_notify(fm))
goto bad;
+ if (!_filemap_fd_update_blocks(fm))
+ goto bad;
+
if (!dm_stats_list(dms, DM_STATS_ALL_PROGRAMS)) {
log_error("Failed to list stats handle.");
goto bad;
6 years, 10 months
master - libdm: allow truncated files in dm_stats_update_regions_from_fd()
by Bryn Reeves
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=744f2920dbb03c391a2...
Commit: 744f2920dbb03c391a2d4981ed6c93af85121e7e
Parent: 37cd8f9678c92281e2f832dff01dc888e0ce608c
Author: Bryn M. Reeves <bmr(a)redhat.com>
AuthorDate: Wed Jun 7 19:21:10 2017 +0100
Committer: Bryn M. Reeves <bmr(a)redhat.com>
CommitterDate: Tue Jun 13 19:45:50 2017 +0100
libdm: allow truncated files in dm_stats_update_regions_from_fd()
It's not an error to attempt to update regions from an fd that has
been truncated (or otherwise no longer has any allocated extents):
in this case, the call should remove all regions corresponding to
the group, and return an empty region table.
---
WHATS_NEW_DM | 1 +
libdm/libdm-stats.c | 24 ++++++++++++------------
2 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index 2894d62..5718ab7 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,6 @@
Version 1.02.141 -
===============================
+ Accept truncated files in calls to dm_stats_update_regions_from_fd().
Restore Warning by 5% increment when thin-pool is over 80% (1.02.138).
Version 1.02.140 - 3rd May 2017
diff --git a/libdm/libdm-stats.c b/libdm/libdm-stats.c
index 6ce6c57..b0c9e4b 100644
--- a/libdm/libdm-stats.c
+++ b/libdm/libdm-stats.c
@@ -4466,6 +4466,7 @@ static struct _extent *_stats_get_extents_for_file(struct dm_pool *mem, int fd,
return extents;
bad:
+ *count = 0;
dm_pool_abandon_object(mem);
dm_free(buf);
return NULL;
@@ -4536,7 +4537,7 @@ static int _stats_unmap_regions(struct dm_stats *dms, uint64_t group_id,
region = &dms->regions[i];
nr_old++;
- if (_find_extent(*count, extents,
+ if (extents && _find_extent(*count, extents,
region->start, region->len)) {
ext.start = region->start;
ext.len = region->len;
@@ -4653,11 +4654,12 @@ static uint64_t *_stats_map_file_regions(struct dm_stats *dms, int fd,
* causing complications in the error path.
*/
if (!(extent_mem = dm_pool_create("extents", sizeof(*extents))))
- return_0;
+ return_NULL;
if (!(extents = _stats_get_extents_for_file(extent_mem, fd, count))) {
- dm_pool_destroy(extent_mem);
- return_0;
+ log_very_verbose("No extents found in fd %d", fd);
+ if (!update)
+ goto out;
}
if (update) {
@@ -4734,7 +4736,10 @@ static uint64_t *_stats_map_file_regions(struct dm_stats *dms, int fd,
if (bounds)
dm_free(hist_arg);
- dm_pool_free(extent_mem, extents);
+ /* the extent table will be empty if the file has been truncated. */
+ if (extents)
+ dm_pool_free(extent_mem, extents);
+
dm_pool_destroy(extent_mem);
return regions;
@@ -4755,12 +4760,6 @@ out_remove:
*count = 0;
out:
- /*
- * The table of file extents in 'extents' is always built, so free
- * it explicitly: this will also free any 'old_extents' table that
- * was later allocated from the 'extent_mem' pool by this function.
- */
- dm_pool_free(extent_mem, extents);
dm_pool_destroy(extent_mem);
dm_free(hist_arg);
dm_free(regions);
@@ -4872,7 +4871,8 @@ uint64_t *dm_stats_update_regions_from_fd(struct dm_stats *dms, int fd,
if (!dm_stats_list(dms, NULL))
goto bad;
- if (regroup)
+ /* regroup if there are regions to group */
+ if (regroup && (*regions != DM_STATS_REGION_NOT_PRESENT))
if (!_stats_group_file_regions(dms, regions, count, alias))
goto bad;
6 years, 10 months
master - configure: update
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=37cd8f9678c92281e2f...
Commit: 37cd8f9678c92281e2f832dff01dc888e0ce608c
Parent: 4b4a210e8397a37446fe7229242868055af9cd81
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Jun 9 22:50:40 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Jun 9 22:52:19 2017 +0200
configure: update
---
configure | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 93 insertions(+), 0 deletions(-)
diff --git a/configure b/configure
index 2a591aa..e1ae0e8 100755
--- a/configure
+++ b/configure
@@ -827,6 +827,7 @@ WC
CHMOD
CSCOPE_CMD
CFLOW_CMD
+AR
RANLIB
MKDIR_P
SET_MAKE
@@ -4948,6 +4949,98 @@ else
fi
if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ar; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_AR+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$AR"; then
+ ac_cv_prog_AR="$AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_AR="${ac_tool_prefix}ar"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+AR=$ac_cv_prog_AR
+if test -n "$AR"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5
+$as_echo "$AR" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_AR"; then
+ ac_ct_AR=$AR
+ # Extract the first word of "ar", so it can be a program name with args.
+set dummy ar; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_AR+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_AR"; then
+ ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_AR="ar"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_AR=$ac_cv_prog_ac_ct_AR
+if test -n "$ac_ct_AR"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5
+$as_echo "$ac_ct_AR" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_AR" = x; then
+ AR=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ AR=$ac_ct_AR
+ fi
+else
+ AR="$ac_cv_prog_AR"
+fi
+
+if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}cflow", so it can be a program name with args.
set dummy ${ac_tool_prefix}cflow; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
6 years, 10 months
master - configure: search for (a possibly prefixed) ar
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=4b4a210e8397a37446f...
Commit: 4b4a210e8397a37446fe7229242868055af9cd81
Parent: 5ef20d2168176f598d13e0b7bcc658b976813d5c
Author: Heiko Becker <heirecka(a)exherbo.org>
AuthorDate: Thu Apr 13 09:07:49 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Jun 9 22:49:39 2017 +0200
configure: search for (a possibly prefixed) ar
e.g. when cross compiling.
Signed-off-by: Heiko Becker <heirecka(a)exherbo.org>
---
configure.in | 1 +
make.tmpl.in | 2 +-
2 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/configure.in b/configure.in
index ae5baa5..2e5e015 100644
--- a/configure.in
+++ b/configure.in
@@ -84,6 +84,7 @@ AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_MKDIR_P
AC_PROG_RANLIB
+AC_CHECK_TOOL(AR, ar)
AC_PATH_TOOL(CFLOW_CMD, cflow)
AC_PATH_TOOL(CSCOPE_CMD, cscope)
AC_PATH_TOOL(CHMOD, chmod)
diff --git a/make.tmpl.in b/make.tmpl.in
index a40eaaa..cb5953a 100644
--- a/make.tmpl.in
+++ b/make.tmpl.in
@@ -44,7 +44,7 @@ EGREP = @EGREP@
GREP = @GREP@
SORT = @SORT@
WC = @WC@
-AR = ar
+AR = @AR@
RM = rm -f
PYTHON2 = @PYTHON2@
6 years, 10 months
master - configure: improve reporting about readline
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=5ef20d2168176f598d1...
Commit: 5ef20d2168176f598d13e0b7bcc658b976813d5c
Parent: 358eee15f30778bc20c2723532bffdf1d8176684
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Jun 9 22:40:27 2017 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Jun 9 22:40:27 2017 +0200
configure: improve reporting about readline
Report real 'readline' supporting state instead of 'maybe'.
Really check for 'readline' headers.
---
configure | 11 ++++++-----
configure.in | 5 +++--
2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/configure b/configure
index 9d0d97c..2a591aa 100755
--- a/configure
+++ b/configure
@@ -9623,8 +9623,6 @@ _ACEOF
################################################################################
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable readline" >&5
-$as_echo_n "checking whether to enable readline... " >&6; }
# Check whether --enable-readline was given.
if test "${enable_readline+set}" = set; then :
enableval=$enable_readline; READLINE=$enableval
@@ -9632,8 +9630,6 @@ else
READLINE=maybe
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $READLINE" >&5
-$as_echo "$READLINE" >&6; }
################################################################################
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable realtime support" >&5
@@ -14444,7 +14440,8 @@ if test "x$ac_cv_lib_readline_readline" = xyes; then :
$as_echo "#define READLINE_SUPPORT 1" >>confdefs.h
- LIBS=$lvm_saved_libs
+ READLINE=yes
+ LIBS=$lvm_saved_libs
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rl_line_buffer in -lreadline" >&5
$as_echo_n "checking for rl_line_buffer in -lreadline... " >&6; }
if ${ac_cv_lib_readline_rl_line_buffer+:} false; then :
@@ -14764,6 +14761,10 @@ fi
done
fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable readline" >&5
+$as_echo_n "checking whether to enable readline... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $READLINE" >&5
+$as_echo "$READLINE" >&6; }
if test "$BUILD_CMIRRORD" = yes; then
for ac_func in atexit
diff --git a/configure.in b/configure.in
index 0ca6b43..ae5baa5 100644
--- a/configure.in
+++ b/configure.in
@@ -674,11 +674,9 @@ AC_DEFINE_UNQUOTED([CACHE_RESTORE_CMD], ["$CACHE_RESTORE_CMD"],
################################################################################
dnl -- Disable readline
-AC_MSG_CHECKING(whether to enable readline)
AC_ARG_ENABLE([readline],
AC_HELP_STRING([--disable-readline], [disable readline support]),
READLINE=$enableval, READLINE=maybe)
-AC_MSG_RESULT($READLINE)
################################################################################
dnl -- Disable realtime clock support
@@ -1721,6 +1719,7 @@ Note: (n)curses also seems to work as a substitute for termcap. This was
AC_DEFINE([READLINE_SUPPORT], 1,
[Define to 1 to include the LVM readline shell.])
dnl -- Try only with -lreadline and check for different symbol
+ READLINE=yes
LIBS=$lvm_saved_libs
AC_CHECK_LIB([readline], [rl_line_buffer],
[ READLINE_LIBS="-lreadline" ], [
@@ -1827,6 +1826,8 @@ dnl -- Ensure additional headers required
if test "$READLINE" = yes; then
AC_CHECK_HEADERS(readline/readline.h readline/history.h,,hard_bailout)
fi
+AC_MSG_CHECKING(whether to enable readline)
+AC_MSG_RESULT($READLINE)
if test "$BUILD_CMIRRORD" = yes; then
AC_CHECK_FUNCS(atexit,,hard_bailout)
6 years, 10 months