Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=e7a56d5cd32654e4921e4…
Commit: e7a56d5cd32654e4921e4c03bc434efd0e24b1c0
Parent: f6a54a50a0f5e1a06e1a4da6ca17f9e84773eb88
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Fri Nov 2 12:11:09 2018 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Fri Nov 2 12:11:09 2018 -0500
lvmlockd: fix handling of sanlock release error
When sanlock_release returns an error because of an i/o
timeout releasing the lease on disk, lvmlockd should just
consider the lock released. sanlock will continue trying
to release the lease on disk after the original request
times out.
---
daemons/lvmlockd/lvmlockd-sanlock.c | 18 +++++++++++++-----
1 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/daemons/lvmlockd/lvmlockd-sanlock.c b/daemons/lvmlockd/lvmlockd-sanlock.c
index 892b446..9c950f3 100644
--- a/daemons/lvmlockd/lvmlockd-sanlock.c
+++ b/daemons/lvmlockd/lvmlockd-sanlock.c
@@ -2111,12 +2111,20 @@ int lm_unlock_sanlock(struct lockspace *ls, struct resource *r,
if (rv < 0)
log_error("S %s R %s unlock_san release error %d", ls->name, r->name, rv);
- if (rv == -EIO)
- rv = -ELOCKIO;
- else if (rv < 0)
- rv = -ELMERR;
+ /*
+ * sanlock may return an error here if it fails to release the lease on
+ * disk because of an io timeout. But, sanlock will continue trying to
+ * release the lease after this call returns. We shouldn't return an
+ * error here which would result in lvmlockd-core keeping the lock
+ * around. By releasing the lock in lvmlockd-core at this point,
+ * lvmlockd may send another acquire request to lvmlockd. If sanlock
+ * has not been able to release the previous instance of the lock yet,
+ * then it will return an error for the new request. But, acquiring a
+ * new lock is able o fail gracefully, until sanlock is finally able to
+ * release the old lock.
+ */
- return rv;
+ return 0;
}
int lm_hosts_sanlock(struct lockspace *ls, int notify)
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=f6a54a50a0f5e1a06e1a4…
Commit: f6a54a50a0f5e1a06e1a4da6ca17f9e84773eb88
Parent: 7a170873aa13cc09dcc2b4d0a918e45278c4c4dd
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Oct 25 10:51:25 2018 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Nov 1 13:25:21 2018 -0500
lvmlockd: deactivate lvmlock LV in vgchange
When changing a VG to lock_type sanlock, the internal
lvmlock LV was left active at the end of vgchange.
It shouldn't be active until lockstart.
---
tools/vgchange.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/tools/vgchange.c b/tools/vgchange.c
index c8f894d..13b72cc 100644
--- a/tools/vgchange.c
+++ b/tools/vgchange.c
@@ -993,6 +993,18 @@ static int _vgchange_locktype_single(struct cmd_context *cmd, const char *vg_nam
backup(vg);
+ /*
+ * When init_vg_sanlock is called for vgcreate, the lockspace remains
+ * started and lvmlock remains active, but when called for
+ * vgchange --locktype sanlock, the lockspace is not started so the
+ * lvmlock LV should be deactivated at the end. vg_write writes the
+ * new leases to lvmlock, so we need to wait until after vg_write to
+ * deactivate it.
+ */
+ if (vg->lock_type && !strcmp(vg->lock_type, "sanlock") &&
+ (cmd->command->command_enum == vgchange_locktype_CMD))
+ deactivate_lv(cmd, vg->sanlock_lv);
+
log_print_unless_silent("Volume group \"%s\" successfully changed", vg->name);
return ECMD_PROCESSED;
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=925aaf0b874fd92aec1b3…
Commit: 925aaf0b874fd92aec1b34f42d23987f65205ff9
Parent: 19f2105b87773047854ef172de8fc48da110b2fa
Author: Bryn M. Reeves <bmr(a)redhat.com>
AuthorDate: Thu Nov 1 16:49:05 2018 +0000
Committer: Bryn M. Reeves <bmr(a)redhat.com>
CommitterDate: Thu Nov 1 17:00:06 2018 +0000
dmsetup: fix stats report command output
Since the stats handle is neither bound nor listed before the
attempt to call dm_stats_get_nr_regions(), it will always return
zero: this prevents reporting of any dmstats regions on any
device.
Remove the dm_stats_get_nr_regions() check and instead rely on
the correct return status from dm_stats_populate() which only
returns 0 in the case that there are regions to inspect (and
which logs a specific error for all other cases).
Reported-by: Bryan Gurney <bgurney(a)redhat.com>
---
libdm/dm-tools/dmsetup.c | 10 +++-------
1 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/libdm/dm-tools/dmsetup.c b/libdm/dm-tools/dmsetup.c
index 835fdcd..93714ac 100644
--- a/libdm/dm-tools/dmsetup.c
+++ b/libdm/dm-tools/dmsetup.c
@@ -914,17 +914,13 @@ static int _display_info_cols(struct dm_task *dmt, struct dm_info *info)
if (!(obj.stats = dm_stats_create(DM_STATS_PROGRAM_ID)))
goto_out;
- if (!dm_stats_get_nr_regions(obj.stats)) {
- log_debug("Skipping %s with no regions.", dm_task_get_name(dmt));
+ dm_stats_bind_devno(obj.stats, info->major, info->minor);
+
+ if (!dm_stats_populate(obj.stats, _program_id, DM_STATS_REGIONS_ALL)) {
r = 1;
goto out;
}
- dm_stats_bind_devno(obj.stats, info->major, info->minor);
-
- if (!dm_stats_populate(obj.stats, _program_id, DM_STATS_REGIONS_ALL))
- goto_out;
-
/* Update timestamps and handle end-of-interval accounting. */
_update_interval_times();
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=19f2105b87773047854ef…
Commit: 19f2105b87773047854ef172de8fc48da110b2fa
Parent: 420af27f088a3808816ba3ab5b47dfa400fef308
Author: Bryn M. Reeves <bmr(a)redhat.com>
AuthorDate: Thu Nov 1 16:47:56 2018 +0000
Committer: Bryn M. Reeves <bmr(a)redhat.com>
CommitterDate: Thu Nov 1 16:59:56 2018 +0000
libdm-stats: move no regions warning after dm_stats_list()
It doesn't make sense to test or warn about the region count until
the stats handle has been listed: at this point it may or may not
contain valid information (but is guaranteed to be correct after
the list).
---
libdm/libdm-stats.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/libdm/libdm-stats.c b/libdm/libdm-stats.c
index 0143957..ca46d9a 100644
--- a/libdm/libdm-stats.c
+++ b/libdm/libdm-stats.c
@@ -2338,11 +2338,6 @@ int dm_stats_populate(struct dm_stats *dms, const char *program_id,
return 0;
}
- if (!dms->nr_regions) {
- log_error("No regions registered.");
- return 0;
- }
-
/* allow zero-length program_id for populate */
if (!program_id)
program_id = dms->program_id;
@@ -2354,6 +2349,11 @@ int dm_stats_populate(struct dm_stats *dms, const char *program_id,
goto_bad;
}
+ if (!dms->nr_regions) {
+ log_verbose("No stats regions registered: %s", dms->name);
+ return 0;
+ }
+
dms->walk_flags = DM_STATS_WALK_REGION;
dm_stats_walk_start(dms);
do {