main - polldaemon: improve support for interruptions
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=d2522f4a05aa027bcc9...
Commit: d2522f4a05aa027bcc911ecb832450bc19b7fb57
Parent: ff8aaadec912398598fd4b16de99ed700b97b130
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Apr 6 14:57:42 2021 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Apr 6 22:02:31 2021 +0200
polldaemon: improve support for interruptions
Enhance handling of interruptions of polling process and lvmpoll daemon.
Daemon should now react much faster on interrups (i.e. shutdown
sequence) and avoid taking lenghty sleep waiting on pvmove signaling.
---
daemons/lvmpolld/lvmpolld-core.c | 6 ++----
tools/polldaemon.c | 35 ++++++++++++++++-------------------
2 files changed, 18 insertions(+), 23 deletions(-)
diff --git a/daemons/lvmpolld/lvmpolld-core.c b/daemons/lvmpolld/lvmpolld-core.c
index f7381eb35..ab8284145 100644
--- a/daemons/lvmpolld/lvmpolld-core.c
+++ b/daemons/lvmpolld/lvmpolld-core.c
@@ -149,7 +149,7 @@ static void _lvmpolld_global_unlock(struct lvmpolld_state *ls)
static int _fini(struct daemon_state *s)
{
int done;
- const struct timespec t = { .tv_nsec = 250000000 }; /* .25 sec */
+ const struct timespec t = { .tv_nsec = 10000000 }; /* .01 sec */
struct lvmpolld_state *ls = s->private;
DEBUGLOG(s, "fini");
@@ -236,9 +236,7 @@ static int poll_for_output(struct lvmpolld_lv *pdlv, struct lvmpolld_thread_data
}
while (1) {
- do {
- r = poll(fds, 2, pdlv_get_timeout(pdlv) * 1000);
- } while (r < 0 && errno == EINTR);
+ r = poll(fds, 2, pdlv_get_timeout(pdlv) * 1000);
DEBUGLOG(pdlv->ls, "%s: %s %d", PD_LOG_PREFIX, "poll() returned", r);
if (r < 0) {
diff --git a/tools/polldaemon.c b/tools/polldaemon.c
index c182e548e..a220d63a2 100644
--- a/tools/polldaemon.c
+++ b/tools/polldaemon.c
@@ -122,10 +122,12 @@ static void _nanosleep(unsigned secs, unsigned allow_zero_time)
if (!secs && !allow_zero_time)
wtime.tv_nsec = WAIT_AT_LEAST_NANOSECS;
- while (!nanosleep(&wtime, &wtime) && errno == EINTR) {}
+ sigint_allow();
+ nanosleep(&wtime, &wtime);
+ sigint_restore();
}
-static void _sleep_and_rescan_devices(struct cmd_context *cmd, struct daemon_parms *parms)
+static int _sleep_and_rescan_devices(struct cmd_context *cmd, struct daemon_parms *parms)
{
if (!parms->aborting) {
/*
@@ -137,8 +139,12 @@ static void _sleep_and_rescan_devices(struct cmd_context *cmd, struct daemon_par
lvmcache_destroy(cmd, 1, 0);
label_scan_destroy(cmd);
_nanosleep(parms->interval, 0);
+ if (sigint_caught())
+ return_0;
lvmcache_label_scan(cmd);
}
+
+ return 1;
}
int wait_for_single_lv(struct cmd_context *cmd, struct poll_operation_id *id,
@@ -150,14 +156,18 @@ int wait_for_single_lv(struct cmd_context *cmd, struct poll_operation_id *id,
uint32_t lockd_state = 0;
uint32_t error_flags = 0;
int ret;
+ unsigned wait_before_testing = parms->wait_before_testing;
- if (!parms->wait_before_testing)
+ if (!wait_before_testing)
lvmcache_label_scan(cmd);
/* Poll for completion */
while (!finished) {
- if (parms->wait_before_testing)
- _sleep_and_rescan_devices(cmd, parms);
+ if (wait_before_testing &&
+ !_sleep_and_rescan_devices(cmd, parms)) {
+ log_error("ABORTING: Polling interrupted for %s.", id->display_name);
+ return 0;
+ }
/*
* An ex VG lock is needed because the check can call finish_copy
@@ -220,20 +230,7 @@ int wait_for_single_lv(struct cmd_context *cmd, struct poll_operation_id *id,
if (!lockd_vg(cmd, id->vg_name, "un", 0, &lockd_state))
stack;
- /*
- * FIXME Sleeping after testing, while preferred, also works around
- * unreliable "finished" state checking in _percent_run. If the
- * above _check_lv_status is deferred until after the first sleep it
- * may be that a polldaemon will run without ever completing.
- *
- * This happens when one snapshot-merge polldaemon is racing with
- * another (polling the same LV). The first to see the LV status
- * reach the "finished" state will alter the LV that the other
- * polldaemon(s) are polling. These other polldaemon(s) can then
- * continue polling an LV that doesn't have a "status".
- */
- if (!parms->wait_before_testing && !finished)
- _sleep_and_rescan_devices(cmd, parms);
+ wait_before_testing = 1;
}
return 1;
3 years
main - mirror_percent: support interruptible check
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=ff8aaadec912398598f...
Commit: ff8aaadec912398598fd4b16de99ed700b97b130
Parent: 1f17b1c56526abc7b7c8edacfba683b396f95705
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Apr 6 14:47:11 2021 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Apr 6 22:02:31 2021 +0200
mirror_percent: support interruptible check
When checking for mirror percentage with WAITEVENT (i.e. during pvmove)
handle intrruption (^C) of such wait.
---
lib/activate/dev_manager.c | 36 ++++++++++++++++++++++++++++--------
1 file changed, 28 insertions(+), 8 deletions(-)
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index 172a6bab1..c4a673901 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -26,6 +26,7 @@
#include "lib/activate/activate.h"
#include "lib/misc/lvm-exec.h"
#include "lib/datastruct/str_list.h"
+#include "lib/misc/lvm-signal.h"
#include <limits.h>
#include <dirent.h>
@@ -1123,7 +1124,8 @@ static int _percent_run(struct dev_manager *dm, const char *name,
const char *dlid,
const char *target_type, int wait,
const struct logical_volume *lv, dm_percent_t *overall_percent,
- uint32_t *event_nr, int fail_if_percent_unsupported)
+ uint32_t *event_nr, int fail_if_percent_unsupported,
+ int *interrupted)
{
int r = 0;
struct dm_task *dmt;
@@ -1144,9 +1146,12 @@ static int _percent_run(struct dev_manager *dm, const char *name,
if (!(segtype = get_segtype_from_string(dm->cmd, target_type)))
return_0;
+ if (wait)
+ sigint_allow();
+
if (!(dmt = _setup_task_run(wait ? DM_DEVICE_WAITEVENT : DM_DEVICE_STATUS, &info,
name, dlid, event_nr, 0, 0, 0, 0, 0)))
- return_0;
+ goto_bad;
if (!info.exists)
goto_out;
@@ -1214,8 +1219,19 @@ static int _percent_run(struct dev_manager *dm, const char *name,
display_percent(dm->cmd, *overall_percent));
r = 1;
- out:
+ out:
dm_task_destroy(dmt);
+
+ bad:
+ if (wait) {
+ sigint_restore();
+
+ if (sigint_caught()) {
+ *interrupted = 1;
+ return_0;
+ }
+ }
+
return r;
}
@@ -1224,20 +1240,24 @@ static int _percent(struct dev_manager *dm, const char *name, const char *dlid,
const struct logical_volume *lv, dm_percent_t *percent,
uint32_t *event_nr, int fail_if_percent_unsupported)
{
+ int interrupted = 0;
+
if (dlid && *dlid) {
if (_percent_run(dm, NULL, dlid, target_type, wait, lv, percent,
- event_nr, fail_if_percent_unsupported))
+ event_nr, fail_if_percent_unsupported, &interrupted))
return 1;
- if (_original_uuid_format_check_required(dm->cmd) &&
+ if (!interrupted &&
+ _original_uuid_format_check_required(dm->cmd) &&
_percent_run(dm, NULL, dlid + sizeof(UUID_PREFIX) - 1,
target_type, wait, lv, percent,
- event_nr, fail_if_percent_unsupported))
+ event_nr, fail_if_percent_unsupported, &interrupted))
return 1;
}
- if (name && _percent_run(dm, name, NULL, target_type, wait, lv, percent,
- event_nr, fail_if_percent_unsupported))
+ if (!interrupted && name &&
+ _percent_run(dm, name, NULL, target_type, wait, lv, percent,
+ event_nr, fail_if_percent_unsupported, &interrupted))
return 1;
return_0;
3 years
main - daemon-server: handle reaping threads better
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=1f17b1c56526abc7b7c...
Commit: 1f17b1c56526abc7b7c8edacfba683b396f95705
Parent: fe4f83171d43ed764b2342f2081db8d9e8ce9343
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Apr 1 11:32:47 2021 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Apr 6 21:26:57 2021 +0200
daemon-server: handle reaping threads better
Avoid sleeping in pselect when thread missed reap() handling.
This speedup handling of daemon shutdown sequences.
---
libdaemon/server/daemon-server.c | 23 +++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
diff --git a/libdaemon/server/daemon-server.c b/libdaemon/server/daemon-server.c
index 7c1b1cf89..1e900261c 100644
--- a/libdaemon/server/daemon-server.c
+++ b/libdaemon/server/daemon-server.c
@@ -551,9 +551,14 @@ static void _reap(daemon_state s, int waiting)
while (ts) {
if (waiting || !ts->active) {
- if (ts->client.thread_id &&
- (errno = pthread_join(ts->client.thread_id, &rv)))
- ERROR(&s, "pthread_join failed: %s", strerror(errno));
+ if (ts->client.thread_id) {
+ if ((errno = pthread_kill(ts->client.thread_id, SIGTERM)) &&
+ (errno != ESRCH))
+ ERROR(&s, "pthread_kill failed for pid %ld",
+ (long)ts->client.thread_id);
+ if ((errno = pthread_join(ts->client.thread_id, &rv)))
+ ERROR(&s, "pthread_join failed: %s", strerror(errno));
+ }
last->next = ts->next;
free(ts);
} else
@@ -659,19 +664,13 @@ void daemon_start(daemon_state s)
if (sigprocmask(SIG_SETMASK, NULL, &old_set))
perror("sigprocmask error");
- while (!failed) {
+ while (!failed && !_shutdown_requested) {
_reset_timeout(s);
FD_ZERO(&in);
FD_SET(s.socket_fd, &in);
if (sigprocmask(SIG_SETMASK, &new_set, NULL))
perror("sigprocmask error");
- if (_shutdown_requested && !s.threads->next) {
- if (sigprocmask(SIG_SETMASK, &old_set, NULL))
- perror("sigprocmask error");
- INFO(&s, "%s shutdown requested", s.name);
- break;
- }
ret = pselect(s.socket_fd + 1, &in, NULL, NULL, _get_timeout(s), &old_set);
if (sigprocmask(SIG_SETMASK, &old_set, NULL))
perror("sigprocmask error");
@@ -679,6 +678,7 @@ void daemon_start(daemon_state s)
if (ret < 0) {
if ((errno != EINTR) && (errno != EAGAIN))
perror("select error");
+ _reap(s, 0);
continue;
}
@@ -698,6 +698,9 @@ void daemon_start(daemon_state s)
}
}
+ if (_shutdown_requested)
+ INFO(&s, "%s shutdown requested", s.name);
+
INFO(&s, "%s waiting for client threads to finish", s.name);
_reap(s, 1);
out:
3 years
main - signals: support also SIGTERM for breaking command
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=fe4f83171d43ed764b2...
Commit: fe4f83171d43ed764b2342f2081db8d9e8ce9343
Parent: 287565fd5dd5f49f1a51c6cd9ebdc9c20ebc7730
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Apr 1 11:32:29 2021 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Apr 6 21:26:57 2021 +0200
signals: support also SIGTERM for breaking command
If we are signaled with SIGTERM it should be at least as good
as with SIGINT - as the command should stop ASAP.
So when lvm2 command allows signal handling we also
enable SIGTERM handling. If there are some other signals
we should handle equally - we could just extend array.
---
lib/misc/lvm-signal.c | 76 +++++++++++++++++++++++++++++++++------------------
1 file changed, 49 insertions(+), 27 deletions(-)
diff --git a/lib/misc/lvm-signal.c b/lib/misc/lvm-signal.c
index b1653a85c..67012af86 100644
--- a/lib/misc/lvm-signal.c
+++ b/lib/misc/lvm-signal.c
@@ -26,8 +26,19 @@ static volatile sig_atomic_t _handler_installed = 0;
/* Support 3 level nesting, increase if needed more */
#define MAX_SIGINTS 3
-static struct sigaction _oldhandler[MAX_SIGINTS];
-static int _oldmasked[MAX_SIGINTS];
+
+struct ar_sigs {
+ int sig;
+ const char *name;
+ int oldmasked[MAX_SIGINTS];
+ struct sigaction oldhandler[MAX_SIGINTS];
+};
+
+/* List of signals we want to allow/restore */
+static struct ar_sigs _ar_sigs[] = {
+ { SIGINT, "SIGINT" },
+ { SIGTERM, "SIGTERM" },
+};
static void _catch_sigint(int unused __attribute__((unused)))
{
@@ -58,6 +69,7 @@ void sigint_clear(void)
void sigint_allow(void)
{
+ int i, mask = 0;
struct sigaction handler;
sigset_t sigs;
@@ -70,30 +82,37 @@ void sigint_allow(void)
if (++_handler_installed > MAX_SIGINTS)
return;
- /* Grab old sigaction for SIGINT: shall not fail. */
- if (sigaction(SIGINT, NULL, &handler))
- log_sys_debug("sigaction", "SIGINT");
+ /* Unmask signals. Remember to mask it again on restore. */
+ if (sigprocmask(0, NULL, &sigs))
+ log_sys_debug("sigprocmask", "");
- handler.sa_flags &= ~SA_RESTART; /* Clear restart flag */
- handler.sa_handler = _catch_sigint;
+ for (i = 0; i < DM_ARRAY_SIZE(_ar_sigs); ++i) {
+ /* Grab old sigaction for SIGNAL: shall not fail. */
+ if (sigaction(_ar_sigs[i].sig, NULL, &handler))
+ log_sys_debug("sigaction", _ar_sigs[i].name);
- /* Override the signal handler: shall not fail. */
- if (sigaction(SIGINT, &handler, &_oldhandler[_handler_installed - 1]))
- log_sys_debug("sigaction", "SIGINT");
+ handler.sa_flags &= ~SA_RESTART; /* Clear restart flag */
+ handler.sa_handler = _catch_sigint;
- /* Unmask SIGINT. Remember to mask it again on restore. */
- if (sigprocmask(0, NULL, &sigs))
- log_sys_debug("sigprocmask", "");
+ /* Override the signal handler: shall not fail. */
+ if (sigaction(_ar_sigs[i].sig, &handler, &_ar_sigs[i].oldhandler[_handler_installed - 1]))
+ log_sys_debug("sigaction", _ar_sigs[i].name);
- if ((_oldmasked[_handler_installed - 1] = sigismember(&sigs, SIGINT))) {
- sigdelset(&sigs, SIGINT);
- if (sigprocmask(SIG_SETMASK, &sigs, NULL))
- log_sys_debug("sigprocmask", "SIG_SETMASK");
+ if ((_ar_sigs[i].oldmasked[_handler_installed - 1] = sigismember(&sigs, _ar_sigs[i].sig))) {
+ sigdelset(&sigs, _ar_sigs[i].sig);
+ mask = 1;
+ }
}
+
+ if (mask && sigprocmask(SIG_SETMASK, &sigs, NULL))
+ log_sys_debug("sigprocmask", "SIG_SETMASK");
}
void sigint_restore(void)
{
+ int i, mask = 0;
+ sigset_t sigs;
+
if (memlock_count_daemon())
return;
@@ -102,16 +121,19 @@ void sigint_restore(void)
return;
/* Nesting count went below MAX_SIGINTS. */
- if (_oldmasked[_handler_installed]) {
- sigset_t sigs;
- sigprocmask(0, NULL, &sigs);
- sigaddset(&sigs, SIGINT);
- if (sigprocmask(SIG_SETMASK, &sigs, NULL))
- log_sys_debug("sigprocmask", "SIG_SETMASK");
- }
-
- if (sigaction(SIGINT, &_oldhandler[_handler_installed], NULL))
- log_sys_debug("sigaction", "SIGINT restore");
+ sigprocmask(0, NULL, &sigs);
+ for (i = 0; i < DM_ARRAY_SIZE(_ar_sigs); ++i)
+ if (_ar_sigs[i].oldmasked[_handler_installed]) {
+ sigaddset(&sigs, _ar_sigs[i].sig);
+ mask = 1;
+ }
+
+ if (mask && sigprocmask(SIG_SETMASK, &sigs, NULL))
+ log_sys_debug("sigprocmask", "SIG_SETMASK");
+
+ for (i = 0; i < DM_ARRAY_SIZE(_ar_sigs); ++i)
+ if (sigaction(_ar_sigs[i].sig, &_ar_sigs[i].oldhandler[_handler_installed], NULL))
+ log_sys_debug("sigaction", _ar_sigs[i].name);
}
void block_signals(uint32_t flags __attribute__((unused)))
3 years
main - lvreduce: support --yes
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=287565fd5dd5f49f1a5...
Commit: 287565fd5dd5f49f1a51c6cd9ebdc9c20ebc7730
Parent: f1d3648dc786a8fad53a32cbd334a44b36c53767
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Apr 6 12:26:42 2021 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Apr 6 21:26:57 2021 +0200
lvreduce: support --yes
Missed support for --yes with 'lvreduce' to answer 'y' to prompt.
---
lib/metadata/lv_manip.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 81346bd1a..b38acf883 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -4970,7 +4970,7 @@ static int _request_confirmation(const struct logical_volume *lv,
log_warn("THIS MAY DESTROY YOUR DATA (filesystem etc.)");
- if (!lp->force) {
+ if (!lp->force && !lp->yes) {
if (yes_no_prompt("Do you really want to reduce %s? [y/n]: ",
display_lvname(lv)) == 'n') {
log_error("Logical volume %s NOT reduced.",
3 years
main - libdm: eliminate some abi-dumper errors
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=f1d3648dc786a8fad53...
Commit: f1d3648dc786a8fad53a32cbd334a44b36c53767
Parent: 14ea63cfc7ba7a8a47197e7fae0c045eda68e749
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Apr 3 14:25:56 2021 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Apr 6 21:26:57 2021 +0200
libdm: eliminate some abi-dumper errors
ABI dumper does not like missing enum/union/struct names,
so add them with _e, _u suffix.
Usage reference:
https://doc.dpdk.org/guides-16.04/contributing/versioning.html
---
daemons/cmirrord/cluster.c | 2 +-
daemons/cmirrord/cluster.h | 2 +-
libdm/ioctl/libdm-targets.h | 2 +-
libdm/libdevmapper.h | 38 +++++++++++++++++++-------------------
libdm/libdm-report.c | 6 +++---
5 files changed, 25 insertions(+), 25 deletions(-)
diff --git a/daemons/cmirrord/cluster.c b/daemons/cmirrord/cluster.c
index 9df321a4c..23308e7a9 100644
--- a/daemons/cmirrord/cluster.c
+++ b/daemons/cmirrord/cluster.c
@@ -1548,7 +1548,7 @@ static void cpg_config_callback(cpg_handle_t handle, const struct cpg_name *gnam
member_list, member_list_entries);
}
-cpg_callbacks_t cpg_callbacks = {
+static cpg_callbacks_t cpg_callbacks = {
.cpg_deliver_fn = cpg_message_callback,
.cpg_confchg_fn = cpg_config_callback,
};
diff --git a/daemons/cmirrord/cluster.h b/daemons/cmirrord/cluster.h
index ccb2f358f..10032bd43 100644
--- a/daemons/cmirrord/cluster.h
+++ b/daemons/cmirrord/cluster.h
@@ -39,7 +39,7 @@ struct clog_request {
* machine. If the two are equal, there is no need
* to do endian conversions.
*/
- union {
+ union version_u {
uint64_t version[2]; /* LE version and native version */
struct dm_list list;
} u;
diff --git a/libdm/ioctl/libdm-targets.h b/libdm/ioctl/libdm-targets.h
index b5b20d5e9..294210d2b 100644
--- a/libdm/ioctl/libdm-targets.h
+++ b/libdm/ioctl/libdm-targets.h
@@ -47,7 +47,7 @@ struct dm_task {
mode_t mode;
uint32_t read_ahead;
uint32_t read_ahead_flags;
- union {
+ union dmi_u {
struct dm_ioctl *v4;
} dmi;
char *newname;
diff --git a/libdm/libdevmapper.h b/libdm/libdevmapper.h
index 26d64bf4e..ac31b59da 100644
--- a/libdm/libdevmapper.h
+++ b/libdm/libdevmapper.h
@@ -247,7 +247,7 @@ struct dm_timestamp *dm_task_get_ioctl_timestamp(struct dm_task *dmt);
*/
int dm_task_enable_checks(struct dm_task *dmt);
-typedef enum {
+typedef enum dm_add_node_e {
DM_ADD_NODE_ON_RESUME, /* add /dev/mapper node with dmsetup resume */
DM_ADD_NODE_ON_CREATE /* add /dev/mapper node with dmsetup create */
} dm_add_node_t;
@@ -294,7 +294,7 @@ void *dm_get_next_target(struct dm_task *dmt,
*/
/* Parse params from STATUS call for mirror target */
-typedef enum {
+typedef enum dm_status_mirror_health_e {
DM_STATUS_MIRROR_ALIVE = 'A',/* No failures */
DM_STATUS_MIRROR_FLUSH_FAILED = 'F',/* Mirror out-of-sync */
DM_STATUS_MIRROR_WRITE_FAILED = 'D',/* Mirror out-of-sync */
@@ -307,14 +307,14 @@ struct dm_status_mirror {
uint64_t total_regions;
uint64_t insync_regions;
uint32_t dev_count; /* # of devs[] elements (<= 8) */
- struct {
+ struct dm_dev_leg_health_s {
dm_status_mirror_health_t health;
uint32_t major;
uint32_t minor;
} *devs; /* array with individual legs */
const char *log_type; /* core, disk,.... */
uint32_t log_count; /* # of logs[] elements */
- struct {
+ struct dm_dev_log_health_s {
dm_status_mirror_health_t health;
uint32_t major;
uint32_t minor;
@@ -404,7 +404,7 @@ int dm_get_status_snapshot(struct dm_pool *mem, const char *params,
struct dm_status_snapshot **status);
/* Parse params from STATUS call for thin_pool target */
-typedef enum {
+typedef enum dm_thin_discards_e {
DM_THIN_DISCARDS_IGNORE,
DM_THIN_DISCARDS_NO_PASSDOWN,
DM_THIN_DISCARDS_PASSDOWN
@@ -992,7 +992,7 @@ const char *dm_stats_get_region_program_id(const struct dm_stats *dms,
const char *dm_stats_get_region_aux_data(const struct dm_stats *dms,
uint64_t region_id);
-typedef enum {
+typedef enum dm_stats_obj_type_e {
DM_STATS_OBJECT_TYPE_NONE,
DM_STATS_OBJECT_TYPE_AREA,
DM_STATS_OBJECT_TYPE_REGION,
@@ -1405,7 +1405,7 @@ uint64_t *dm_stats_update_regions_from_fd(struct dm_stats *dms, int fd,
* and placing a new file at the same path.
*/
-typedef enum {
+typedef enum dm_filemapd_mode_e {
DM_FILEMAPD_FOLLOW_INODE,
DM_FILEMAPD_FOLLOW_PATH,
DM_FILEMAPD_FOLLOW_NONE
@@ -1464,7 +1464,7 @@ void dm_task_update_nodes(void);
* HEX mangling format: \xNN, NN being the hex value of the character.
* (whitelist and format supported by udev)
*/
-typedef enum {
+typedef enum dm_string_mangling_e {
DM_STRING_MANGLING_NONE, /* do not mangle at all */
DM_STRING_MANGLING_AUTO, /* mangle only if not already mangled with hex, error when mixed */
DM_STRING_MANGLING_HEX /* always mangle with hex encoding, no matter what the input is */
@@ -1930,7 +1930,7 @@ int dm_tree_node_add_cache_target(struct dm_tree_node *node,
* Replicator operation mode
* Note: API for Replicator is not yet stable
*/
-typedef enum {
+typedef enum dm_replicator_mode_e {
DM_REPLICATOR_SYNC, /* Synchronous replication */
DM_REPLICATOR_ASYNC_WARN, /* Warn if async replicator is slow */
DM_REPLICATOR_ASYNC_STALL, /* Stall replicator if not fast enough */
@@ -1995,7 +1995,7 @@ int dm_tree_node_add_thin_pool_target_v1(struct dm_tree_node *node,
unsigned crop_metadata);
/* Supported messages for thin provision target */
-typedef enum {
+typedef enum dm_thin_message_e {
DM_THIN_MESSAGE_CREATE_SNAP, /* device_id, origin_id */
DM_THIN_MESSAGE_CREATE_THIN, /* device_id */
DM_THIN_MESSAGE_DELETE, /* device_id */
@@ -2066,7 +2066,7 @@ void dm_tree_node_set_read_ahead(struct dm_tree_node *dnode,
* Callback is called before 'activation' of node for activation tree,
* or 'deactivation' of node for deactivation tree.
*/
-typedef enum {
+typedef enum dm_node_callback_e {
DM_NODE_CALLBACK_PRELOADED, /* Node has preload deps */
DM_NODE_CALLBACK_DEACTIVATED, /* Node is deactivated */
} dm_node_callback_t;
@@ -2728,7 +2728,7 @@ uint64_t dm_units_to_factor(const char *units, char *unit_type,
/*
* Type of unit specifier used by dm_size_to_string().
*/
-typedef enum {
+typedef enum dm_size_suffix_e {
DM_SIZE_LONG = 0, /* Megabyte */
DM_SIZE_SHORT = 1, /* MB or MiB */
DM_SIZE_UNIT = 2 /* M or m */
@@ -2844,7 +2844,7 @@ uint32_t dm_regex_fingerprint(struct dm_regex *regex);
*/
#define DM_PERCENT_CHAR '%'
-typedef enum {
+typedef enum dm_percent_range_e {
DM_PERCENT_0 = 0,
DM_PERCENT_1 = 1000000,
DM_PERCENT_100 = 100 * DM_PERCENT_1,
@@ -3007,7 +3007,7 @@ struct dm_report_reserved_value {
/*
* Available actions for dm_report_reserved_value_handler.
*/
-typedef enum {
+typedef enum dm_report_reserved_action_e {
DM_REPORT_RESERVED_PARSE_FUZZY_NAME,
DM_REPORT_RESERVED_GET_DYNAMIC_VALUE,
} dm_report_reserved_action_t;
@@ -3166,7 +3166,7 @@ void dm_report_field_set_value(struct dm_report_field *field, const void *value,
*/
struct dm_report_group;
-typedef enum {
+typedef enum dm_report_group_type_e {
DM_REPORT_GROUP_SINGLE,
DM_REPORT_GROUP_BASIC,
DM_REPORT_GROUP_JSON
@@ -3218,7 +3218,7 @@ int dm_report_group_destroy(struct dm_report_group *group);
#define DM_STATS_REGION_CURRENT UINT64_MAX
#define DM_STATS_AREA_CURRENT UINT64_MAX
-typedef enum {
+typedef enum dm_stats_counter_e {
DM_STATS_READS_COUNT,
DM_STATS_READS_MERGED_COUNT,
DM_STATS_READ_SECTORS_COUNT,
@@ -3305,7 +3305,7 @@ uint64_t dm_stats_get_total_write_nsecs(const struct dm_stats *dms,
* average_wr_wait_time: the average write wait time
*/
-typedef enum {
+typedef enum dm_stats_metric_e {
DM_STATS_RD_MERGES_PER_SEC,
DM_STATS_WR_MERGES_PER_SEC,
DM_STATS_READS_PER_SEC,
@@ -3495,7 +3495,7 @@ const char *dm_histogram_to_string(const struct dm_histogram *dmh, int bin,
/*************************
* config file parse/print
*************************/
-typedef enum {
+typedef enum dm_config_value_type_e {
DM_CFG_INT,
DM_CFG_FLOAT,
DM_CFG_STRING,
@@ -3505,7 +3505,7 @@ typedef enum {
struct dm_config_value {
dm_config_value_type_t type;
- union {
+ union dm_config_value_u {
int64_t i;
float f;
double d; /* Unused. */
diff --git a/libdm/libdm-report.c b/libdm/libdm-report.c
index a1c07badd..5433e74ae 100644
--- a/libdm/libdm-report.c
+++ b/libdm/libdm-report.c
@@ -90,7 +90,7 @@ struct report_group_item {
struct dm_list list;
struct dm_report_group *group;
struct dm_report *report;
- union {
+ union store_u {
uint32_t orig_report_flags;
uint32_t finished_count;
} store;
@@ -207,7 +207,7 @@ struct selection_str_list {
};
struct field_selection_value {
- union {
+ union value_u {
const char *s;
uint64_t i;
time_t t;
@@ -227,7 +227,7 @@ struct field_selection {
struct selection_node {
struct dm_list list;
uint32_t type;
- union {
+ union selection_u {
struct field_selection *item;
struct dm_list set;
} selection;
3 years
main - symver: sorting
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=14ea63cfc7ba7a8a471...
Commit: 14ea63cfc7ba7a8a47197e7fae0c045eda68e749
Parent: 60eb608d66c2056a78e81f27db3da14139d9faab
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sun Apr 4 11:26:45 2021 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Apr 6 21:26:57 2021 +0200
symver: sorting
---
libdm/.exported_symbols.DM_1_02_100 | 2 +-
libdm/.exported_symbols.DM_1_02_101 | 2 +-
libdm/.exported_symbols.DM_1_02_104 | 12 ++++++------
libdm/.exported_symbols.DM_1_02_110 | 2 +-
libdm/.exported_symbols.DM_1_02_128 | 4 ++--
libdm/.exported_symbols.DM_1_02_138 | 6 +++---
6 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/libdm/.exported_symbols.DM_1_02_100 b/libdm/.exported_symbols.DM_1_02_100
index 00d7d5b10..4564338c8 100644
--- a/libdm/.exported_symbols.DM_1_02_100
+++ b/libdm/.exported_symbols.DM_1_02_100
@@ -1,2 +1,2 @@
-dm_config_value_set_format_flags
dm_config_value_get_format_flags
+dm_config_value_set_format_flags
diff --git a/libdm/.exported_symbols.DM_1_02_101 b/libdm/.exported_symbols.DM_1_02_101
index 75089ba8b..0bdcfe4c9 100644
--- a/libdm/.exported_symbols.DM_1_02_101
+++ b/libdm/.exported_symbols.DM_1_02_101
@@ -1,2 +1,2 @@
-dm_report_value_cache_set
dm_report_value_cache_get
+dm_report_value_cache_set
diff --git a/libdm/.exported_symbols.DM_1_02_104 b/libdm/.exported_symbols.DM_1_02_104
index 712fcf2d5..d0bb855b5 100644
--- a/libdm/.exported_symbols.DM_1_02_104
+++ b/libdm/.exported_symbols.DM_1_02_104
@@ -30,12 +30,12 @@ dm_stats_get_io_nsecs
dm_stats_get_nr_areas
dm_stats_get_nr_regions
dm_stats_get_rd_merges_per_sec
-dm_stats_get_read_nsecs
dm_stats_get_reads
-dm_stats_get_read_sectors
-dm_stats_get_read_sectors_per_sec
dm_stats_get_reads_merged
dm_stats_get_reads_per_sec
+dm_stats_get_read_nsecs
+dm_stats_get_read_sectors
+dm_stats_get_read_sectors_per_sec
dm_stats_get_region_area_len
dm_stats_get_region_aux_data
dm_stats_get_region_len
@@ -50,12 +50,12 @@ dm_stats_get_total_read_nsecs
dm_stats_get_total_write_nsecs
dm_stats_get_utilization
dm_stats_get_weighted_io_nsecs
-dm_stats_get_write_nsecs
dm_stats_get_writes
-dm_stats_get_write_sectors
-dm_stats_get_write_sectors_per_sec
dm_stats_get_writes_merged
dm_stats_get_writes_per_sec
+dm_stats_get_write_nsecs
+dm_stats_get_write_sectors
+dm_stats_get_write_sectors_per_sec
dm_stats_get_wr_merges_per_sec
dm_stats_list
dm_stats_populate
diff --git a/libdm/.exported_symbols.DM_1_02_110 b/libdm/.exported_symbols.DM_1_02_110
index eba56259a..74f6bfb8c 100644
--- a/libdm/.exported_symbols.DM_1_02_110
+++ b/libdm/.exported_symbols.DM_1_02_110
@@ -1,3 +1,3 @@
-dm_report_compact_given_fields
dm_hold_control_dev
+dm_report_compact_given_fields
dm_tree_node_size_changed
diff --git a/libdm/.exported_symbols.DM_1_02_128 b/libdm/.exported_symbols.DM_1_02_128
index c3239739b..ad76c459f 100644
--- a/libdm/.exported_symbols.DM_1_02_128
+++ b/libdm/.exported_symbols.DM_1_02_128
@@ -1,5 +1,5 @@
dm_report_group_create
-dm_report_group_push
-dm_report_group_pop
dm_report_group_destroy
+dm_report_group_pop
+dm_report_group_push
dm_report_set_selection
diff --git a/libdm/.exported_symbols.DM_1_02_138 b/libdm/.exported_symbols.DM_1_02_138
index 21e9ad8cc..609c195e4 100644
--- a/libdm/.exported_symbols.DM_1_02_138
+++ b/libdm/.exported_symbols.DM_1_02_138
@@ -1,9 +1,9 @@
+dm_bitset_parse_list
dm_bit_get_last
dm_bit_get_prev
dm_filemapd_mode_from_string
-dm_stats_update_regions_from_fd
-dm_bitset_parse_list
dm_stats_bind_from_fd
dm_stats_start_filemapd
-dm_tree_node_add_raid_target_with_params_v2
+dm_stats_update_regions_from_fd
dm_tree_node_add_cache_target
+dm_tree_node_add_raid_target_with_params_v2
3 years
main - symver: restore and uncomment some symbols
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=60eb608d66c2056a78e...
Commit: 60eb608d66c2056a78e81f27db3da14139d9faab
Parent: c23f4c8075655aeaef96b3e19ad44c0be78020c9
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Apr 3 21:51:06 2021 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Apr 6 21:26:57 2021 +0200
symver: restore and uncomment some symbols
---
libdm/.exported_symbols.Base | 2 ++
libdm/.exported_symbols.DM_1_02_104 | 1 +
libdm/.exported_symbols.DM_1_02_106 | 2 +-
libdm/.exported_symbols.DM_1_02_129 | 2 +-
4 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/libdm/.exported_symbols.Base b/libdm/.exported_symbols.Base
index 4dc5c936c..f6018ec84 100644
--- a/libdm/.exported_symbols.Base
+++ b/libdm/.exported_symbols.Base
@@ -183,6 +183,7 @@ dm_task_destroy
dm_task_enable_checks
dm_task_get_deps
dm_task_get_driver_version
+dm_task_get_info
dm_task_get_info_with_deferred_remove
dm_task_get_message_response
dm_task_get_name
@@ -234,6 +235,7 @@ dm_tree_free
dm_tree_get_cookie
dm_tree_children_use_uuid
dm_tree_next_child
+dm_tree_node_add_cache_target
dm_tree_node_add_crypt_target
dm_tree_node_add_error_target
dm_tree_node_add_linear_target
diff --git a/libdm/.exported_symbols.DM_1_02_104 b/libdm/.exported_symbols.DM_1_02_104
index f0a8ed9aa..712fcf2d5 100644
--- a/libdm/.exported_symbols.DM_1_02_104
+++ b/libdm/.exported_symbols.DM_1_02_104
@@ -6,6 +6,7 @@ dm_stats_bind_uuid
dm_stats_buffer_destroy
dm_stats_clear_region
dm_stats_create
+dm_stats_create_region
dm_stats_delete_region
dm_stats_destroy
dm_stats_get_area_start
diff --git a/libdm/.exported_symbols.DM_1_02_106 b/libdm/.exported_symbols.DM_1_02_106
index 88bba0225..0bec54428 100644
--- a/libdm/.exported_symbols.DM_1_02_106
+++ b/libdm/.exported_symbols.DM_1_02_106
@@ -1,5 +1,5 @@
dm_message_supports_precise_timestamps
-#dm_stats_create_region
+dm_stats_create_region
dm_stats_driver_supports_precise
dm_stats_get_current_region_precise_timestamps
dm_stats_get_region_precise_timestamps
diff --git a/libdm/.exported_symbols.DM_1_02_129 b/libdm/.exported_symbols.DM_1_02_129
index a5133ddb0..88d3f1b6b 100644
--- a/libdm/.exported_symbols.DM_1_02_129
+++ b/libdm/.exported_symbols.DM_1_02_129
@@ -1,4 +1,4 @@
-#dm_bitset_parse_list
+dm_bitset_parse_list
dm_stats_create_group
dm_stats_current_object_type
dm_stats_delete_group
3 years
main - makefiles: add check for versioned symbols
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=c23f4c8075655aeaef9...
Commit: c23f4c8075655aeaef96b3e19ad44c0be78020c9
Parent: 40b277ae1799fc7a2e3f38b0abebd81a8e3d1995
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Apr 6 14:39:44 2021 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Apr 6 21:26:57 2021 +0200
makefiles: add check for versioned symbols
Simple check produced library has the latest symbol as well as its versioned
older version with check for dm_stats_create_region().
---
libdm/Makefile.in | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/libdm/Makefile.in b/libdm/Makefile.in
index 12fec06b4..a78d2b517 100644
--- a/libdm/Makefile.in
+++ b/libdm/Makefile.in
@@ -47,7 +47,7 @@ endif
LIB_SHARED = $(interface)/libdevmapper.$(LIB_SUFFIX)
LIB_VERSION = $(LIB_VERSION_DM)
-TARGETS = libdevmapper.$(LIB_SUFFIX) libdevmapper.$(LIB_SUFFIX).$(LIB_VERSION)
+TARGETS = libdevmapper.$(LIB_SUFFIX) libdevmapper.$(LIB_SUFFIX).$(LIB_VERSION) .symver_check
CFLOW_LIST = $(SOURCES)
CFLOW_LIST_TARGET = libdevmapper.cflow
@@ -69,6 +69,16 @@ libdevmapper.$(LIB_SUFFIX) libdevmapper.$(LIB_SUFFIX).$(LIB_VERSION): $(LIB_SHAR
@echo " [LN] $<"
$(Q) $(LN_S) -f $< $@
+# Check versioned build when default versioned symbol is present @@
+# also the older symbol is built-in
+.symver_check: $(LIB_SHARED)
+ @echo " [CHECK] $<"
+ $(Q) if readelf -Ws $< | grep -q dm_stats_create_region@@; then \
+ SYM=$$(readelf -Ws $< | grep dm_stats_create_region@DM_1_02_106); \
+ if test -n "$$SYM"; then touch $@; \
+ else echo >&2 "Missing versioned symbols in $<"; false; fi; \
+ else touch $@; fi
+
.PHONY: install_dynamic install_static install_include \
install_ioctl install_ioctl_static \
install_pkgconfig
3 years
main - makefiles: slight change in .export.sym
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=40b277ae1799fc7a2e3...
Commit: 40b277ae1799fc7a2e3f38b0abebd81a8e3d1995
Parent: 1398e66a556fd3ed79353819ca8bef4ccb351990
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sun Apr 4 13:06:09 2021 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Apr 6 21:26:57 2021 +0200
makefiles: slight change in .export.sym
Avoid emitting Local symbol and sort symbols from
start and add dependency on previous version
Should not change anything, just better followup
linkage guidlines.
---
libdm/make.tmpl.in | 13 +++++++------
make.tmpl.in | 13 +++++++------
2 files changed, 14 insertions(+), 12 deletions(-)
diff --git a/libdm/make.tmpl.in b/libdm/make.tmpl.in
index 70edcf91d..219eeca9d 100644
--- a/libdm/make.tmpl.in
+++ b/libdm/make.tmpl.in
@@ -509,20 +509,21 @@ EXPORTED_SYMBOLS := $(wildcard $(srcdir)/.exported_symbols.Base $(srcdir)/.expor
ifeq (,$(firstword $(EXPORTED_SYMBOLS)))
$(Q) set -e; (echo "Base {"; echo " global:";\
$(SED) "/^#/d;s/^/ /;s/$$/;/" $<;\
+ echo " local:"; echo " *;";\
echo "};";\
- echo "Local {"; echo " local:"; echo " *;"; echo "};";\
) > $@
else
$(Q) set -e;\
R=$$($(SORT) $^ | $(GREP) -v "^#" | uniq -u);\
test -z "$$R" || { echo "Mismatch between symbols in shared library and lists in .exported_symbols.* files: $$R"; false; } ;\
- ( for i in $$(echo $(EXPORTED_SYMBOLS) | tr ' ' '\n' | $(SORT) -rnt_ -k5 ); do\
+ LAST=;\
+ for i in $$(echo $(EXPORTED_SYMBOLS) | tr ' ' '\n' | $(SORT) -nt_ -k5 ); do\
echo "$${i##*.} {"; echo " global:";\
$(SED) "/^#/d;s/^/ /;s/$$/;/" $$i;\
- echo "};";\
- done;\
- echo "Local {"; echo " local:"; echo " *;"; echo "};";\
- ) > $@
+ if test -z "$$LAST"; then echo " local:"; echo " *;";fi;\
+ echo "}$$LAST;";\
+ LAST=" $${i##*.}";\
+ done > $@
endif
ifeq ("@USE_TRACKING@","yes")
diff --git a/make.tmpl.in b/make.tmpl.in
index 99998f9fd..b28ef6f8f 100644
--- a/make.tmpl.in
+++ b/make.tmpl.in
@@ -551,20 +551,21 @@ EXPORTED_SYMBOLS := $(wildcard $(srcdir)/.exported_symbols.Base $(srcdir)/.expor
ifeq (,$(firstword $(EXPORTED_SYMBOLS)))
$(Q) set -e; (echo "Base {"; echo " global:";\
$(SED) "/^#/d;s/^/ /;s/$$/;/" $<;\
+ echo " local:"; echo " *;";\
echo "};";\
- echo "Local {"; echo " local:"; echo " *;"; echo "};";\
) > $@
else
$(Q) set -e;\
R=$$($(SORT) $^ | $(GREP) -v "^#" | uniq -u);\
test -z "$$R" || { echo "Mismatch between symbols in shared library and lists in .exported_symbols.* files: $$R"; false; } ;\
- ( for i in $$(echo $(EXPORTED_SYMBOLS) | tr ' ' '\n' | $(SORT) -rnt_ -k5 ); do\
+ LAST=;\
+ for i in $$(echo $(EXPORTED_SYMBOLS) | tr ' ' '\n' | $(SORT) -nt_ -k5 ); do\
echo "$${i##*.} {"; echo " global:";\
$(SED) "/^#/d;s/^/ /;s/$$/;/" $$i;\
- echo "};";\
- done;\
- echo "Local {"; echo " local:"; echo " *;"; echo "};";\
- ) > $@
+ if test -z "$$LAST"; then echo " local:"; echo " *;";fi;\
+ echo "}$$LAST;";\
+ LAST=" $${i##*.}";\
+ done > $@
endif
ifeq ("$(USE_TRACKING)","yes")
3 years