master - cleanup: fix gcc compile with older pthread
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=b5b2a5483450df...
Commit: b5b2a5483450dff10fd23a7b712649729e619b0d
Parent: 21748a86309443ddaefe1fcc0644f0b9a6ea138e
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Oct 23 09:44:21 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 23 10:54:13 2015 +0200
cleanup: fix gcc compile with older pthread
Older pthread library was missing 'trick'
in pthread_cleanup_pop() which lead to
compilation error:
error: label at end of compound statement
Use explicit ';' to fix it.
---
daemons/dmeventd/dmeventd.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/daemons/dmeventd/dmeventd.c b/daemons/dmeventd/dmeventd.c
index 949fcf4..b5f1be3 100644
--- a/daemons/dmeventd/dmeventd.c
+++ b/daemons/dmeventd/dmeventd.c
@@ -1029,6 +1029,9 @@ static void *_monitor_thread(void *arg)
}
}
out:
+ /* ';' fixes gcc compilation problem with older pthread macros
+ * "label at end of compound statement" */
+ ;
pthread_cleanup_pop(1);
8 years, 6 months
master - cleanup: gcc warning for old-style
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=21748a86309443...
Commit: 21748a86309443ddaefe1fcc0644f0b9a6ea138e
Parent: e5b686d6932be9931a386d15e8d452153225952b
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Oct 23 09:42:38 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 23 10:54:13 2015 +0200
cleanup: gcc warning for old-style
---
lib/mm/memlock.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/mm/memlock.c b/lib/mm/memlock.c
index 34a6eff..c17ae13 100644
--- a/lib/mm/memlock.c
+++ b/lib/mm/memlock.c
@@ -639,7 +639,7 @@ void memlock_unlock(struct cmd_context *cmd)
#endif
-int memlock_count_daemon()
+int memlock_count_daemon(void)
{
return _memlock_count_daemon;
}
8 years, 6 months
master - tools: update for lvm2_disable_dmeventd_monitoring
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e5b686d6932be9...
Commit: e5b686d6932be9931a386d15e8d452153225952b
Parent: 87a39d8bac572b67f927dad41548155606a50f4f
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Oct 23 10:48:01 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 23 10:54:13 2015 +0200
tools: update for lvm2_disable_dmeventd_monitoring
Make lvm2_disable_dmeventd_monitoring() more explicit.
As memlock_inc_daemon() is also used by clvmd, which
does changes dmeventd and suspend ignore state at
some stages - make updates of these 2 variable
tied to the call of lvm2_disable_dmeventd_monitoring().
Once this call is made dmeventd monitoring
and suspended devices are ignored.
TODO: all lvm-global settings should really be moved
to command context.
---
lib/misc/lvm-globals.c | 11 +++++++++--
lib/misc/lvm-globals.h | 1 +
tools/lvmcmdlib.c | 4 ++--
3 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/lib/misc/lvm-globals.c b/lib/misc/lvm-globals.c
index 0cdcc88..06c36e2 100644
--- a/lib/misc/lvm-globals.c
+++ b/lib/misc/lvm-globals.c
@@ -40,6 +40,8 @@ static int _security_level = SECURITY_LEVEL;
static char _cmd_name[30] = "";
static int _mirror_in_sync = 0;
static int _dmeventd_monitor = DEFAULT_DMEVENTD_MONITOR;
+/* When set, disables update of _dmeventd_monitor & _ignore_suspended_devices */
+static int _disable_dmeventd_monitoring = 0;
static int _background_polling = DEFAULT_BACKGROUND_POLLING;
static int _ignore_suspended_devices = 0;
static int _ignore_lvm_mirrors = DEFAULT_IGNORE_LVM_MIRRORS;
@@ -123,10 +125,15 @@ void init_mirror_in_sync(int in_sync)
void init_dmeventd_monitor(int reg)
{
- if (!memlock_count_daemon())
+ if (!_disable_dmeventd_monitoring)
_dmeventd_monitor = reg;
}
+void init_disable_dmeventd_monitoring(int reg)
+{
+ _disable_dmeventd_monitoring = reg;
+}
+
void init_background_polling(int polling)
{
_background_polling = polling;
@@ -134,7 +141,7 @@ void init_background_polling(int polling)
void init_ignore_suspended_devices(int ignore)
{
- if (!memlock_count_daemon())
+ if (!_disable_dmeventd_monitoring)
_ignore_suspended_devices = ignore;
}
diff --git a/lib/misc/lvm-globals.h b/lib/misc/lvm-globals.h
index 8628a89..132af96 100644
--- a/lib/misc/lvm-globals.h
+++ b/lib/misc/lvm-globals.h
@@ -38,6 +38,7 @@ void init_lockingfailed(int level);
void init_security_level(int level);
void init_mirror_in_sync(int in_sync);
void init_dmeventd_monitor(int reg);
+void init_disable_dmeventd_monitoring(int disable);
void init_background_polling(int polling);
void init_ignore_suspended_devices(int ignore);
void init_ignore_lvm_mirrors(int scan);
diff --git a/tools/lvmcmdlib.c b/tools/lvmcmdlib.c
index ae8ff5c..b30cce0 100644
--- a/tools/lvmcmdlib.c
+++ b/tools/lvmcmdlib.c
@@ -80,8 +80,6 @@ int lvm2_run(void *handle, const char *cmdline)
/* FIXME Temporary - move to libdevmapper */
ret = ECMD_PROCESSED;
if (!strcmp(cmdline, "_memlock_inc")) {
- init_dmeventd_monitor(DMEVENTD_MONITOR_IGNORE);
- init_ignore_suspended_devices(1);
memlock_inc_daemon(cmd);
} else if (!strcmp(cmdline, "_memlock_dec"))
memlock_dec_daemon(cmd);
@@ -99,6 +97,8 @@ int lvm2_run(void *handle, const char *cmdline)
void lvm2_disable_dmeventd_monitoring(void *handle) {
init_dmeventd_monitor(DMEVENTD_MONITOR_IGNORE);
+ init_ignore_suspended_devices(1);
+ init_disable_dmeventd_monitoring(1); /* Lock settings */
}
void lvm2_log_level(void *handle, int level)
8 years, 6 months
master - dmeventd: ensure filter is empty
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=87a39d8bac572b...
Commit: 87a39d8bac572b67f927dad41548155606a50f4f
Parent: cff1c728d8c80b3393c461f6229066f633b67fc2
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Oct 23 09:43:21 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 23 10:54:13 2015 +0200
dmeventd: ensure filter is empty
On some error path we could have left filter set to some value.
Not a big issue - but lets make reporting correct as soon
as we can.
---
daemons/dmeventd/dmeventd.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/daemons/dmeventd/dmeventd.c b/daemons/dmeventd/dmeventd.c
index af03091..949fcf4 100644
--- a/daemons/dmeventd/dmeventd.c
+++ b/daemons/dmeventd/dmeventd.c
@@ -936,6 +936,7 @@ static void _monitor_unregister(void *arg)
break;
}
+ thread->events = 0; /* Filter is now empty */
thread->pending = 0; /* Event pending resolved */
thread->processing = 1; /* Process unregistering */
8 years, 6 months
master - dmeventd: debug error paths
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=cff1c728d8c80b...
Commit: cff1c728d8c80b3393c461f6229066f633b67fc2
Parent: 2786cd27da3e7c6176940495ba57653ead7cfe08
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Oct 23 09:43:06 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Oct 23 10:54:13 2015 +0200
dmeventd: debug error paths
---
daemons/dmeventd/dmeventd.c | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/daemons/dmeventd/dmeventd.c b/daemons/dmeventd/dmeventd.c
index 6f3bfff..af03091 100644
--- a/daemons/dmeventd/dmeventd.c
+++ b/daemons/dmeventd/dmeventd.c
@@ -446,8 +446,10 @@ static int _pthread_create_smallstack(pthread_t *t, void *(*fun)(void *), void *
* Linux these functions always succeed (but portable and future-proof
* applications should nevertheless handle a possible error return).
*/
- if ((r = pthread_attr_init(&attr)) != 0)
+ if ((r = pthread_attr_init(&attr)) != 0) {
+ log_sys_error("pthread_attr_init", "");
return r;
+ }
/*
* We use a smaller stack since it gets preallocated in its entirety
@@ -462,7 +464,8 @@ static int _pthread_create_smallstack(pthread_t *t, void *(*fun)(void *), void *
t = &tmp;
}
- r = pthread_create(t, &attr, fun, arg);
+ if ((r = pthread_create(t, &attr, fun, arg)))
+ log_sys_error("pthread_create", "");
pthread_attr_destroy(&attr);
@@ -1150,7 +1153,7 @@ static int _register_for_event(struct message_data *message_data)
}
if ((ret = _create_thread(thread))) {
- log_sys_error("pthread_create", "");
+ stack;
_free_thread_status(thread);
return -ret;
}
@@ -1169,8 +1172,10 @@ static int _register_for_event(struct message_data *message_data)
usually means we are so starved on resources that we are
almost as good as dead already... */
if ((message_data->events_field & DM_EVENT_TIMEOUT) &&
- (ret = _register_for_timeout(thread)))
+ (ret = _register_for_timeout(thread))) {
+ stack;
_unregister_for_event(message_data);
+ }
return -ret;
}
8 years, 6 months
master - tests: enable raid test on 4.3
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=2786cd27da3e7c...
Commit: 2786cd27da3e7c6176940495ba57653ead7cfe08
Parent: 1a2d0a0c729e80e4cd122532829f3a11e6566823
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Oct 22 16:51:18 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Oct 22 22:46:10 2015 +0200
tests: enable raid test on 4.3
With kernel -rc6 it's passing our raid tests again - so enable
it in tests.
Note: related only to Fedora rawhide kernels...
---
test/lib/aux.sh | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index 8a25d87..3f99357 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -1112,9 +1112,8 @@ have_raid() {
# some kernels have broken mdraid bitmaps, don't use them!
# may oops kernel, we know for sure all FC24 are currently broken
# in general any 4.1, 4.2 is likely useless unless patched
- # hopefully 4.3 will be patched
case "$(uname -r)" in
- 4.[123].*fc24*) return 1 ;;
+ 4.[12].*fc24*) return 1 ;;
esac
}
8 years, 6 months
master - cleanup: indents
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=1a2d0a0c729e80...
Commit: 1a2d0a0c729e80e4cd122532829f3a11e6566823
Parent: b1319e04020c3cb77b3a5c5a765606efa0b34b83
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Oct 22 09:57:44 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Oct 22 22:46:10 2015 +0200
cleanup: indents
---
daemons/dmeventd/dmeventd.c | 8 ++++----
daemons/dmeventd/plugins/raid/dmeventd_raid.c | 4 ++--
lib/metadata/lv_manip.c | 2 +-
3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/daemons/dmeventd/dmeventd.c b/daemons/dmeventd/dmeventd.c
index 9662c0e..6f3bfff 100644
--- a/daemons/dmeventd/dmeventd.c
+++ b/daemons/dmeventd/dmeventd.c
@@ -230,6 +230,7 @@ struct thread_status {
void *dso_private; /* dso per-thread status variable */
/* TODO per-thread mutex */
};
+
static DM_LIST_INIT(_thread_registry);
static DM_LIST_INIT(_thread_registry_unused);
@@ -819,6 +820,7 @@ static sigset_t _unblock_sigalrm(void)
sigemptyset(&set);
sigaddset(&set, SIGALRM);
pthread_sigmask(SIG_UNBLOCK, &set, &old);
+
return old;
}
@@ -1412,7 +1414,7 @@ fail:
* and a complete message is read. Must not block indefinitely.
*/
static int _client_read(struct dm_event_fifos *fifos,
- struct dm_event_daemon_message *msg)
+ struct dm_event_daemon_message *msg)
{
struct timeval t;
unsigned bytes = 0;
@@ -1859,7 +1861,6 @@ static void _daemonize(void)
case -1:
log_sys_error("fork", "");
exit(EXIT_FAILURE);
-
case 0: /* Child */
break;
@@ -2107,8 +2108,6 @@ int main(int argc, char *argv[])
.server_path = DM_EVENT_FIFO_SERVER
};
time_t now, idle_exit_timeout = DMEVENTD_IDLE_EXIT_TIMEOUT;
- //struct sys_log logdata = {DAEMON_NAME, LOG_DAEMON};
-
opterr = 0;
optind = 0;
@@ -2195,6 +2194,7 @@ int main(int argc, char *argv[])
/* Signal parent, letting them know we are ready to go. */
if (!_foreground)
kill(getppid(), SIGTERM);
+
log_notice("dmeventd ready for processing.");
_idle_since = time(NULL);
diff --git a/daemons/dmeventd/plugins/raid/dmeventd_raid.c b/daemons/dmeventd/plugins/raid/dmeventd_raid.c
index 2f200ba..99f2680 100644
--- a/daemons/dmeventd/plugins/raid/dmeventd_raid.c
+++ b/daemons/dmeventd/plugins/raid/dmeventd_raid.c
@@ -42,8 +42,8 @@ static int _process_raid_event(struct dso_state *state, char *params, const char
goto out; /* already reported */
log_error("Device #%d of %s array, %s, has failed.",
- (int)(d - status->dev_health),
- status->raid_type, device);
+ (int)(d - status->dev_health),
+ status->raid_type, device);
state->failed = 1;
if (!dmeventd_lvm2_run_with_lock(state->cmd_lvscan))
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 316710b..738343f 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -4495,7 +4495,7 @@ static int _adjust_policy_params(struct cmd_context *cmd,
if (!lv_snapshot_percent(lv, &percent))
return_0;
if (!(DM_PERCENT_0 < percent && percent <= DM_PERCENT_100) || percent <= policy_threshold)
- return 1; /* nothing to do */
+ return 1; /* nothing to do */
}
lp->extents = policy_amount;
8 years, 6 months
master - cleanup: drop uneeded header file
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=b1319e04020c3c...
Commit: b1319e04020c3cb77b3a5c5a765606efa0b34b83
Parent: 8be60e6a65baf87b12862e07d24bd794608df2f2
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Oct 22 10:40:51 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Oct 22 22:46:10 2015 +0200
cleanup: drop uneeded header file
---
lib/locking/no_locking.c | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/lib/locking/no_locking.c b/lib/locking/no_locking.c
index b1dcb30..613877a 100644
--- a/lib/locking/no_locking.c
+++ b/lib/locking/no_locking.c
@@ -19,8 +19,6 @@
#include "lvm-string.h"
#include "activate.h"
-#include <signal.h>
-
/*
* No locking
*/
8 years, 6 months
master - cleanup: easier to read code
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=8be60e6a65baf8...
Commit: 8be60e6a65baf87b12862e07d24bd794608df2f2
Parent: 39cffa4e9b027162430ea7f3c288256b232a1ed7
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Oct 22 10:57:57 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Oct 22 22:46:10 2015 +0200
cleanup: easier to read code
Avoid using #ifdef code and use 'cmd' instead of 'die'.
---
daemons/dmeventd/dmeventd.c | 14 ++++----------
1 files changed, 4 insertions(+), 10 deletions(-)
diff --git a/daemons/dmeventd/dmeventd.c b/daemons/dmeventd/dmeventd.c
index 606ef30..9662c0e 100644
--- a/daemons/dmeventd/dmeventd.c
+++ b/daemons/dmeventd/dmeventd.c
@@ -1590,11 +1590,8 @@ static int _do_process_request(struct dm_event_daemon_message *msg)
/* Only one caller at a time. */
static void _process_request(struct dm_event_fifos *fifos)
{
- int die;
struct dm_event_daemon_message msg = { 0 };
-#ifdef DEBUG
int cmd;
-#endif
/*
* Read the request from the client (client_read, client_write
* give true on success and false on failure).
@@ -1602,12 +1599,9 @@ static void _process_request(struct dm_event_fifos *fifos)
if (!_client_read(fifos, &msg))
return;
-#ifdef DEBUG
cmd = msg.cmd;
-#endif
- DEBUGLOG(">>> CMD:%s (0x%x) processing...", decode_cmd(cmd), cmd);
- die = (msg.cmd == DM_EVENT_CMD_DIE) ? 1 : 0;
+ DEBUGLOG(">>> CMD:%s (0x%x) processing...", decode_cmd(cmd), cmd);
/* _do_process_request fills in msg (if memory allows for
data, otherwise just cmd and size = 0) */
@@ -1616,11 +1610,11 @@ static void _process_request(struct dm_event_fifos *fifos)
if (!_client_write(fifos, &msg))
stack;
- dm_free(msg.data);
+ DEBUGLOG("<<< CMD:%s (0x%x) completed (result %d).", decode_cmd(cmd), cmd, msg.cmd);
- DEBUGLOG("<<< CMD:%s (0x%x) completed (=%d).", decode_cmd(cmd), cmd, msg.cmd);
+ dm_free(msg.data);
- if (die) {
+ if (cmd == DM_EVENT_CMD_DIE) {
if (unlink(DMEVENTD_PIDFILE))
log_sys_error("unlink", DMEVENTD_PIDFILE);
_exit(0);
8 years, 6 months
master - cleanup: declare vars before code
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=39cffa4e9b0271...
Commit: 39cffa4e9b027162430ea7f3c288256b232a1ed7
Parent: 2af696c32f99b2951bcc7e2a73130e46dc4f383f
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Oct 22 10:33:01 2015 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Oct 22 22:46:10 2015 +0200
cleanup: declare vars before code
---
libdm/libdm-config.c | 9 +++------
1 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/libdm/libdm-config.c b/libdm/libdm-config.c
index b2082c8..c8984b2 100644
--- a/libdm/libdm-config.c
+++ b/libdm/libdm-config.c
@@ -157,21 +157,18 @@ struct dm_config_tree *dm_config_insert_cascaded_tree(struct dm_config_tree *fir
static struct dm_config_node *_config_reverse(struct dm_config_node *head)
{
- if (!head)
- return NULL;
-
struct dm_config_node *left = head, *middle = NULL, *right = NULL;
- do {
+ while (left) {
right = middle;
middle = left;
left = left->sib;
middle->sib = right;
middle->child = _config_reverse(middle->child);
- } while (left);
+ }
return middle;
-};
+}
int dm_config_parse(struct dm_config_tree *cft, const char *start, const char *end)
{
8 years, 6 months