* [Cluster-devel] [PATCHv2 dlm-tool 0/9] dlm-tool: pending fixes/cleanups dlm-tool patches
@ 2023-03-07 17:12 Alexander Aring
2023-03-07 17:12 ` [Cluster-devel] [PATCHv2 dlm-tool 1/9] dlm_tool: add fail functionality if dump failed Alexander Aring
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: Alexander Aring @ 2023-03-07 17:12 UTC (permalink / raw)
To: cluster-devel.redhat.com
Hi,
this is a resend of a subset of pending dlm-tool patches just without
the dlm_controld functionality to plot the dlm_controld posix cluster-wide
lock states over time. I split this feature out to have at first those
cleanups in fixes/dlm userspace instead of doing a new feature at the
same time now which has more things to dicuss about.
- Alex
Alexander Aring (9):
dlm_tool: add fail functionality if dump failed
dlm_controld: always create logdir
dlm_controld: move processing of saved messages to plock level
dlm_controld: remove ls parameter
dlm_controld: constify timeval of dt_usec()
dlm_controld: add gcc format printf attribute to log_level
dlm_controld: use write_result()
dlm_controld: be sure we stop lockspaces before shutdown
dlm_controld: constify name_in in log_level()
dlm_controld/daemon_cpg.c | 16 ++++++++--
dlm_controld/dlm_daemon.h | 3 +-
dlm_controld/lib.c | 25 +++++++++-------
dlm_controld/libdlmcontrol.h | 10 +++----
dlm_controld/logging.c | 36 +++++++++++------------
dlm_controld/plock.c | 25 ++++++++--------
dlm_tool/main.c | 57 +++++++++++++++++++++++++++---------
7 files changed, 108 insertions(+), 64 deletions(-)
--
2.31.1
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Cluster-devel] [PATCHv2 dlm-tool 1/9] dlm_tool: add fail functionality if dump failed
2023-03-07 17:12 [Cluster-devel] [PATCHv2 dlm-tool 0/9] dlm-tool: pending fixes/cleanups dlm-tool patches Alexander Aring
@ 2023-03-07 17:12 ` Alexander Aring
2023-03-07 17:13 ` [Cluster-devel] [PATCHv2 dlm-tool 2/9] dlm_controld: always create logdir Alexander Aring
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Alexander Aring @ 2023-03-07 17:12 UTC (permalink / raw)
To: cluster-devel.redhat.com
Currently dlm_controld sets a embedded data int value of dlm_controld
dump functionality failed for e.g. if lockspace cannot be found. The
dlm_tool does not parse this possible error functionality and will exit
successfully. This patch will add dlm_tool fail functionality if
dlm_controld sets an embedded data error value.
---
dlm_controld/lib.c | 25 +++++++++-------
dlm_controld/libdlmcontrol.h | 10 +++----
dlm_tool/main.c | 57 +++++++++++++++++++++++++++---------
3 files changed, 62 insertions(+), 30 deletions(-)
diff --git a/dlm_controld/lib.c b/dlm_controld/lib.c
index 2888ad05..a21150f2 100644
--- a/dlm_controld/lib.c
+++ b/dlm_controld/lib.c
@@ -109,7 +109,7 @@ static void init_header(struct dlmc_header *h, int cmd, char *name,
static char copy_buf[DLMC_DUMP_SIZE];
-static int do_dump(int cmd, char *name, char *buf)
+static int do_dump(int cmd, char *name, char *buf, int *data)
{
struct dlmc_header h;
int fd, rv, len;
@@ -118,6 +118,8 @@ static int do_dump(int cmd, char *name, char *buf)
init_header(&h, cmd, name, 0);
+ *data = 0;
+
fd = do_connect(DLMC_QUERY_SOCK_PATH);
if (fd < 0) {
rv = fd;
@@ -134,6 +136,7 @@ static int do_dump(int cmd, char *name, char *buf)
if (rv < 0)
goto out_close;
+ *data = h.data;
len = h.len - sizeof(h);
if (len <= 0 || len > DLMC_DUMP_SIZE)
@@ -150,29 +153,29 @@ static int do_dump(int cmd, char *name, char *buf)
return rv;
}
-int dlmc_dump_debug(char *buf)
+int dlmc_dump_debug(char *buf, int *data)
{
- return do_dump(DLMC_CMD_DUMP_DEBUG, NULL, buf);
+ return do_dump(DLMC_CMD_DUMP_DEBUG, NULL, buf, data);
}
-int dlmc_dump_config(char *buf)
+int dlmc_dump_config(char *buf, int *data)
{
- return do_dump(DLMC_CMD_DUMP_CONFIG, NULL, buf);
+ return do_dump(DLMC_CMD_DUMP_CONFIG, NULL, buf, data);
}
-int dlmc_dump_log_plock(char *buf)
+int dlmc_dump_log_plock(char *buf, int *data)
{
- return do_dump(DLMC_CMD_DUMP_LOG_PLOCK, NULL, buf);
+ return do_dump(DLMC_CMD_DUMP_LOG_PLOCK, NULL, buf, data);
}
-int dlmc_dump_plocks(char *name, char *buf)
+int dlmc_dump_plocks(char *name, char *buf, int *data)
{
- return do_dump(DLMC_CMD_DUMP_PLOCKS, name, buf);
+ return do_dump(DLMC_CMD_DUMP_PLOCKS, name, buf, data);
}
-int dlmc_dump_run(char *buf)
+int dlmc_dump_run(char *buf, int *data)
{
- return do_dump(DLMC_CMD_DUMP_RUN, NULL, buf);
+ return do_dump(DLMC_CMD_DUMP_RUN, NULL, buf, data);
}
int dlmc_reload_config(void)
diff --git a/dlm_controld/libdlmcontrol.h b/dlm_controld/libdlmcontrol.h
index a8654f3e..08f04c39 100644
--- a/dlm_controld/libdlmcontrol.h
+++ b/dlm_controld/libdlmcontrol.h
@@ -80,11 +80,11 @@ struct dlmc_lockspace {
#define DLMC_STATUS_VERBOSE 0x00000001
-int dlmc_dump_debug(char *buf);
-int dlmc_dump_config(char *buf);
-int dlmc_dump_run(char *buf);
-int dlmc_dump_log_plock(char *buf);
-int dlmc_dump_plocks(char *name, char *buf);
+int dlmc_dump_debug(char *buf, int *data);
+int dlmc_dump_config(char *buf, int *data);
+int dlmc_dump_run(char *buf, int *data);
+int dlmc_dump_log_plock(char *buf, int *data);
+int dlmc_dump_plocks(char *name, char *buf, int *data);
int dlmc_lockspace_info(char *lsname, struct dlmc_lockspace *ls);
int dlmc_node_info(char *lsname, int nodeid, struct dlmc_node *node);
/* caller need to free *lss */
diff --git a/dlm_tool/main.c b/dlm_tool/main.c
index 50f0cae9..52fd5b89 100644
--- a/dlm_tool/main.c
+++ b/dlm_tool/main.c
@@ -1466,36 +1466,51 @@ static void do_fence_ack(char *name)
dlmc_fence_ack(name);
}
-static void do_plocks(char *name)
+static int do_plocks(char *name)
{
char buf[DLMC_DUMP_SIZE];
+ int rv, data;
memset(buf, 0, sizeof(buf));
- dlmc_dump_plocks(name, buf);
+ rv = dlmc_dump_plocks(name, buf, &data);
+ if (rv)
+ return rv;
+ else if (data)
+ return data;
buf[DLMC_DUMP_SIZE-1] = '\0';
do_write(STDOUT_FILENO, buf, strlen(buf));
+
+ return 0;
}
-static void do_dump(int op)
+static int do_dump(int op)
{
+ int rv = -EOPNOTSUPP, data;
char buf[DLMC_DUMP_SIZE];
memset(buf, 0, sizeof(buf));
if (op == OP_DUMP)
- dlmc_dump_debug(buf);
+ rv = dlmc_dump_debug(buf, &data);
else if (op == OP_DUMP_CONFIG)
- dlmc_dump_config(buf);
+ rv = dlmc_dump_config(buf, &data);
else if (op == OP_DUMP_RUN)
- dlmc_dump_run(buf);
+ rv = dlmc_dump_run(buf, &data);
+
+ if (rv)
+ return rv;
+ else if (data)
+ return data;
buf[DLMC_DUMP_SIZE-1] = '\0';
do_write(STDOUT_FILENO, buf, strlen(buf));
printf("\n");
+
+ return 0;
}
static void do_reload_config(void)
@@ -1514,18 +1529,25 @@ static void do_set_config(void)
printf("set_config done\n");
}
-static void do_log_plock(void)
+static int do_log_plock(void)
{
char buf[DLMC_DUMP_SIZE];
+ int rv, data;
memset(buf, 0, sizeof(buf));
- dlmc_dump_log_plock(buf);
+ rv = dlmc_dump_log_plock(buf, &data);
+ if (rv)
+ return rv;
+ else if (data)
+ return data;
buf[DLMC_DUMP_SIZE-1] = '\0';
do_write(STDOUT_FILENO, buf, strlen(buf));
printf("\n");
+
+ return 0;
}
static int do_run(int op)
@@ -1576,6 +1598,7 @@ int main(int argc, char **argv)
{
prog_name = argv[0];
decode_arguments(argc, argv);
+ int rv = 0;
switch (operation) {
@@ -1605,11 +1628,11 @@ int main(int argc, char **argv)
break;
case OP_DUMP:
- do_dump(operation);
+ rv = do_dump(operation);
break;
case OP_DUMP_CONFIG:
- do_dump(operation);
+ rv = do_dump(operation);
break;
case OP_RELOAD_CONFIG:
@@ -1621,11 +1644,11 @@ int main(int argc, char **argv)
break;
case OP_LOG_PLOCK:
- do_log_plock();
+ rv = do_log_plock();
break;
case OP_PLOCKS:
- do_plocks(lsname);
+ rv = do_plocks(lsname);
break;
case OP_DEADLOCK_CHECK:
@@ -1654,9 +1677,15 @@ int main(int argc, char **argv)
break;
case OP_DUMP_RUN:
- do_dump(operation);
+ rv = do_dump(operation);
break;
}
- return 0;
+
+ if (rv < 0) {
+ fprintf(stderr, "failed: %s\n", strerror(-rv));
+ return EXIT_FAILURE;
+ }
+
+ return EXIT_SUCCESS;
}
--
2.31.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [Cluster-devel] [PATCHv2 dlm-tool 2/9] dlm_controld: always create logdir
2023-03-07 17:12 [Cluster-devel] [PATCHv2 dlm-tool 0/9] dlm-tool: pending fixes/cleanups dlm-tool patches Alexander Aring
2023-03-07 17:12 ` [Cluster-devel] [PATCHv2 dlm-tool 1/9] dlm_tool: add fail functionality if dump failed Alexander Aring
@ 2023-03-07 17:13 ` Alexander Aring
2023-03-07 17:13 ` [Cluster-devel] [PATCHv2 dlm-tool 3/9] dlm_controld: move processing of saved messages to plock level Alexander Aring
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Alexander Aring @ 2023-03-07 17:13 UTC (permalink / raw)
To: cluster-devel.redhat.com
Currently the logdir will be created only if logfile does contain a
string. To add another logfiles we simple create the logdir always on
startup.
---
dlm_controld/logging.c | 34 +++++++++++++++++-----------------
1 file changed, 17 insertions(+), 17 deletions(-)
diff --git a/dlm_controld/logging.c b/dlm_controld/logging.c
index 2c57138c..3298ef99 100644
--- a/dlm_controld/logging.c
+++ b/dlm_controld/logging.c
@@ -38,27 +38,27 @@ void init_logging(void)
set_logfile_priority();
- if (logfile[0]) {
- old_umask = umask(0077);
- rv = mkdir(SYS_VARDIR, 0700);
- if (rv < 0 && errno != EEXIST) {
- umask(old_umask);
- goto skip_logfile;
- }
+ old_umask = umask(0077);
+ rv = mkdir(SYS_VARDIR, 0700);
+ if (rv < 0 && errno != EEXIST) {
+ umask(old_umask);
+ goto skip_logfile;
+ }
- rv = mkdir(SYS_LOGDIR, 0700);
- if (rv < 0 && errno != EEXIST) {
- umask(old_umask);
- goto skip_logfile;
- }
+ rv = mkdir(SYS_LOGDIR, 0700);
+ if (rv < 0 && errno != EEXIST) {
+ umask(old_umask);
+ goto skip_logfile;
+ }
- rv = mkdir(LOGDIR, 0700);
- if (rv < 0 && errno != EEXIST) {
- umask(old_umask);
- goto skip_logfile;
- }
+ rv = mkdir(LOGDIR, 0700);
+ if (rv < 0 && errno != EEXIST) {
umask(old_umask);
+ goto skip_logfile;
+ }
+ umask(old_umask);
+ if (logfile[0]) {
logfile_fp = fopen(logfile, "a+");
if (logfile_fp != NULL) {
int fd = fileno(logfile_fp);
--
2.31.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [Cluster-devel] [PATCHv2 dlm-tool 3/9] dlm_controld: move processing of saved messages to plock level
2023-03-07 17:12 [Cluster-devel] [PATCHv2 dlm-tool 0/9] dlm-tool: pending fixes/cleanups dlm-tool patches Alexander Aring
2023-03-07 17:12 ` [Cluster-devel] [PATCHv2 dlm-tool 1/9] dlm_tool: add fail functionality if dump failed Alexander Aring
2023-03-07 17:13 ` [Cluster-devel] [PATCHv2 dlm-tool 2/9] dlm_controld: always create logdir Alexander Aring
@ 2023-03-07 17:13 ` Alexander Aring
2023-03-07 17:13 ` [Cluster-devel] [PATCHv2 dlm-tool 4/9] dlm_controld: remove ls parameter Alexander Aring
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Alexander Aring @ 2023-03-07 17:13 UTC (permalink / raw)
To: cluster-devel.redhat.com
Ad the loglevel is for save plock messages during corosync resource
membership upate. This patch will put the processing of saved messages
on the same loglevel.
---
dlm_controld/plock.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlm_controld/plock.c b/dlm_controld/plock.c
index 692787e2..c2c80360 100644
--- a/dlm_controld/plock.c
+++ b/dlm_controld/plock.c
@@ -1612,7 +1612,7 @@ void process_saved_plocks(struct lockspace *ls)
struct dlm_header *hd;
int count = 0;
- log_dlock(ls, "process_saved_plocks begin");
+ log_plock(ls, "process_saved_plocks begin");
if (list_empty(&ls->saved_messages))
goto out;
@@ -1643,7 +1643,7 @@ void process_saved_plocks(struct lockspace *ls)
count++;
}
out:
- log_dlock(ls, "process_saved_plocks %d done", count);
+ log_plock(ls, "process_saved_plocks %d done", count);
}
/* locks still marked SYNCING should not go into the ckpt; the new node
--
2.31.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [Cluster-devel] [PATCHv2 dlm-tool 4/9] dlm_controld: remove ls parameter
2023-03-07 17:12 [Cluster-devel] [PATCHv2 dlm-tool 0/9] dlm-tool: pending fixes/cleanups dlm-tool patches Alexander Aring
` (2 preceding siblings ...)
2023-03-07 17:13 ` [Cluster-devel] [PATCHv2 dlm-tool 3/9] dlm_controld: move processing of saved messages to plock level Alexander Aring
@ 2023-03-07 17:13 ` Alexander Aring
2023-03-07 17:13 ` [Cluster-devel] [PATCHv2 dlm-tool 5/9] dlm_controld: constify timeval of dt_usec() Alexander Aring
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Alexander Aring @ 2023-03-07 17:13 UTC (permalink / raw)
To: cluster-devel.redhat.com
The ls parameter in write_result() is not used, so we can remove it.
---
dlm_controld/plock.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/dlm_controld/plock.c b/dlm_controld/plock.c
index c2c80360..462c9212 100644
--- a/dlm_controld/plock.c
+++ b/dlm_controld/plock.c
@@ -684,8 +684,7 @@ static int add_waiter(struct lockspace *ls, struct resource *r,
return 0;
}
-static void write_result(struct lockspace *ls, struct dlm_plock_info *in,
- int rv)
+static void write_result(struct dlm_plock_info *in, int rv)
{
int write_rv;
@@ -719,7 +718,7 @@ static void do_waiters(struct lockspace *ls, struct resource *r)
rv = lock_internal(ls, r, in);
if (in->nodeid == our_nodeid)
- write_result(ls, in, rv);
+ write_result(in, rv);
free(w);
}
@@ -744,7 +743,7 @@ static void do_lock(struct lockspace *ls, struct dlm_plock_info *in,
out:
if (in->nodeid == our_nodeid && rv != -EINPROGRESS)
- write_result(ls, in, rv);
+ write_result(in, rv);
do_waiters(ls, r);
put_resource(ls, r);
@@ -768,7 +767,7 @@ static void do_unlock(struct lockspace *ls, struct dlm_plock_info *in,
}
if (in->nodeid == our_nodeid)
- write_result(ls, in, rv);
+ write_result(in, rv);
skip_result:
do_waiters(ls, r);
@@ -787,7 +786,7 @@ static void do_get(struct lockspace *ls, struct dlm_plock_info *in,
else
rv = 0;
- write_result(ls, in, rv);
+ write_result(in, rv);
put_resource(ls, r);
}
@@ -830,7 +829,7 @@ static void __receive_plock(struct lockspace *ls, struct dlm_plock_info *in,
log_elock(ls, "receive_plock error from %d optype %d",
from, in->optype);
if (from == our_nodeid)
- write_result(ls, in, -EINVAL);
+ write_result(in, -EINVAL);
}
}
--
2.31.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [Cluster-devel] [PATCHv2 dlm-tool 5/9] dlm_controld: constify timeval of dt_usec()
2023-03-07 17:12 [Cluster-devel] [PATCHv2 dlm-tool 0/9] dlm-tool: pending fixes/cleanups dlm-tool patches Alexander Aring
` (3 preceding siblings ...)
2023-03-07 17:13 ` [Cluster-devel] [PATCHv2 dlm-tool 4/9] dlm_controld: remove ls parameter Alexander Aring
@ 2023-03-07 17:13 ` Alexander Aring
2023-03-07 17:13 ` [Cluster-devel] [PATCHv2 dlm-tool 6/9] dlm_controld: add gcc format printf attribute to log_level Alexander Aring
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Alexander Aring @ 2023-03-07 17:13 UTC (permalink / raw)
To: cluster-devel.redhat.com
Those parameters are only used read only. We don't change any data where
those pointers point to.
---
dlm_controld/plock.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlm_controld/plock.c b/dlm_controld/plock.c
index 462c9212..8b052a94 100644
--- a/dlm_controld/plock.c
+++ b/dlm_controld/plock.c
@@ -198,7 +198,7 @@ static unsigned long time_diff_ms(struct timeval *begin, struct timeval *end)
return (result.tv_sec * 1000) + (result.tv_usec / 1000);
}
-static uint64_t dt_usec(struct timeval *start, struct timeval *stop)
+static uint64_t dt_usec(const struct timeval *start, const struct timeval *stop)
{
uint64_t dt;
--
2.31.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [Cluster-devel] [PATCHv2 dlm-tool 6/9] dlm_controld: add gcc format printf attribute to log_level
2023-03-07 17:12 [Cluster-devel] [PATCHv2 dlm-tool 0/9] dlm-tool: pending fixes/cleanups dlm-tool patches Alexander Aring
` (4 preceding siblings ...)
2023-03-07 17:13 ` [Cluster-devel] [PATCHv2 dlm-tool 5/9] dlm_controld: constify timeval of dt_usec() Alexander Aring
@ 2023-03-07 17:13 ` Alexander Aring
2023-03-07 17:13 ` [Cluster-devel] [PATCHv2 dlm-tool 7/9] dlm_controld: use write_result() Alexander Aring
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Alexander Aring @ 2023-03-07 17:13 UTC (permalink / raw)
To: cluster-devel.redhat.com
This patch will add __attribute__ (( format( printf, 3, 4 ) ) to
log_level() functionality which has a format string as parameter. With
this change we enable compiler warnings if format string and applied
parameters do not match. We had some couple of warnings which this patch
fixes as well.
---
dlm_controld/daemon_cpg.c | 2 +-
dlm_controld/dlm_daemon.h | 1 +
dlm_controld/plock.c | 3 ++-
3 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/dlm_controld/daemon_cpg.c b/dlm_controld/daemon_cpg.c
index e6a03a28..2e0634d4 100644
--- a/dlm_controld/daemon_cpg.c
+++ b/dlm_controld/daemon_cpg.c
@@ -2080,7 +2080,7 @@ int receive_run_reply(struct dlm_header *hd, int len)
return 0;
if (len != sizeof(struct run_reply)) {
- log_debug("receive_run_reply %s bad len %s expect %d",
+ log_debug("receive_run_reply %s bad len %d expect %zu",
rep->uuid, len, sizeof(struct run_reply));
run->info.reply_count++;
run->info.need_replies--;
diff --git a/dlm_controld/dlm_daemon.h b/dlm_controld/dlm_daemon.h
index f0bad90f..94a9238f 100644
--- a/dlm_controld/dlm_daemon.h
+++ b/dlm_controld/dlm_daemon.h
@@ -216,6 +216,7 @@ EXTERN struct list_head run_ops;
#define LOG_PLOCK 0x00010000
#define LOG_NONE 0x00001111
+__attribute__ (( format( printf, 3, 4 ) ))
void log_level(char *name_in, uint32_t level_in, const char *fmt, ...);
#define log_error(fmt, args...) log_level(NULL, LOG_ERR, fmt, ##args)
diff --git a/dlm_controld/plock.c b/dlm_controld/plock.c
index 8b052a94..2f0392c3 100644
--- a/dlm_controld/plock.c
+++ b/dlm_controld/plock.c
@@ -1925,7 +1925,8 @@ void receive_plocks_data(struct lockspace *ls, struct dlm_header *hd, int len)
/* no locks should be included for owned resources */
if (owner && count) {
- log_elock(ls, "recv_plocks_data %d:%u n %llu o %d bad count %u",
+ log_elock(ls, "recv_plocks_data %d:%u n %llu o %d bad count %" PRIu32,
+ hd->nodeid, hd->msgdata,
(unsigned long long)num, owner, count);
goto fail_free;
}
--
2.31.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [Cluster-devel] [PATCHv2 dlm-tool 7/9] dlm_controld: use write_result()
2023-03-07 17:12 [Cluster-devel] [PATCHv2 dlm-tool 0/9] dlm-tool: pending fixes/cleanups dlm-tool patches Alexander Aring
` (5 preceding siblings ...)
2023-03-07 17:13 ` [Cluster-devel] [PATCHv2 dlm-tool 6/9] dlm_controld: add gcc format printf attribute to log_level Alexander Aring
@ 2023-03-07 17:13 ` Alexander Aring
2023-03-07 17:13 ` [Cluster-devel] [PATCHv2 dlm-tool 8/9] dlm_controld: be sure we stop lockspaces before shutdown Alexander Aring
2023-03-07 17:13 ` [Cluster-devel] [PATCHv2 dlm-tool 9/9] dlm_controld: constify name_in in log_level() Alexander Aring
8 siblings, 0 replies; 10+ messages in thread
From: Alexander Aring @ 2023-03-07 17:13 UTC (permalink / raw)
To: cluster-devel.redhat.com
This patch will use write_result() instead of code the same code again
what write_result() is doing.
Reported-by: Andreas Gruenbacher <agruenba@redhat.com>
---
dlm_controld/plock.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/dlm_controld/plock.c b/dlm_controld/plock.c
index 2f0392c3..24ad777a 100644
--- a/dlm_controld/plock.c
+++ b/dlm_controld/plock.c
@@ -1600,8 +1600,7 @@ void process_plocks(int ci)
#else
if (!(info.flags & DLM_PLOCK_FL_CLOSE)) {
#endif
- info.rv = rv;
- rv = write(plock_device_fd, &info, sizeof(info));
+ write_result(&info, rv);
}
}
--
2.31.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [Cluster-devel] [PATCHv2 dlm-tool 8/9] dlm_controld: be sure we stop lockspaces before shutdown
2023-03-07 17:12 [Cluster-devel] [PATCHv2 dlm-tool 0/9] dlm-tool: pending fixes/cleanups dlm-tool patches Alexander Aring
` (6 preceding siblings ...)
2023-03-07 17:13 ` [Cluster-devel] [PATCHv2 dlm-tool 7/9] dlm_controld: use write_result() Alexander Aring
@ 2023-03-07 17:13 ` Alexander Aring
2023-03-07 17:13 ` [Cluster-devel] [PATCHv2 dlm-tool 9/9] dlm_controld: constify name_in in log_level() Alexander Aring
8 siblings, 0 replies; 10+ messages in thread
From: Alexander Aring @ 2023-03-07 17:13 UTC (permalink / raw)
To: cluster-devel.redhat.com
The dlm_controld shutdown process will drop all dlm configfs entries of
dlm communication settings regarding corosync address configuration.
This will end in an socket close in the dlm subsystem of the connection
which belongs to it. Newly introduced kernel warnings will check if the
lockspace is stopped before we close the socket connection. This is
necessary because no new dlm messages should be triggered afterwards. To
be sure dlm_controld does stop the lockspaces we will make sure that it
does it always in close_cpg_daemon. Currently there is a missing handle
to stop all lockspaces when there is no cpg_handle_daemon anymore.
---
dlm_controld/daemon_cpg.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/dlm_controld/daemon_cpg.c b/dlm_controld/daemon_cpg.c
index 2e0634d4..10c80ddc 100644
--- a/dlm_controld/daemon_cpg.c
+++ b/dlm_controld/daemon_cpg.c
@@ -2527,6 +2527,15 @@ int setup_cpg_daemon(void)
return -1;
}
+static void stop_lockspaces(void)
+{
+ struct lockspace *ls;
+
+ list_for_each_entry(ls, &lockspaces, list) {
+ cpg_stop_kernel(ls);
+ }
+}
+
void close_cpg_daemon(void)
{
struct lockspace *ls;
@@ -2534,8 +2543,11 @@ void close_cpg_daemon(void)
struct cpg_name name;
int i = 0;
- if (!cpg_handle_daemon)
+ if (!cpg_handle_daemon) {
+ stop_lockspaces();
return;
+ }
+
if (cluster_down)
goto fin;
--
2.31.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [Cluster-devel] [PATCHv2 dlm-tool 9/9] dlm_controld: constify name_in in log_level()
2023-03-07 17:12 [Cluster-devel] [PATCHv2 dlm-tool 0/9] dlm-tool: pending fixes/cleanups dlm-tool patches Alexander Aring
` (7 preceding siblings ...)
2023-03-07 17:13 ` [Cluster-devel] [PATCHv2 dlm-tool 8/9] dlm_controld: be sure we stop lockspaces before shutdown Alexander Aring
@ 2023-03-07 17:13 ` Alexander Aring
8 siblings, 0 replies; 10+ messages in thread
From: Alexander Aring @ 2023-03-07 17:13 UTC (permalink / raw)
To: cluster-devel.redhat.com
This patch will constify the name_in parameter of log_level() which is
only used as readonly pointer.
---
dlm_controld/dlm_daemon.h | 2 +-
dlm_controld/logging.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlm_controld/dlm_daemon.h b/dlm_controld/dlm_daemon.h
index 94a9238f..86b37603 100644
--- a/dlm_controld/dlm_daemon.h
+++ b/dlm_controld/dlm_daemon.h
@@ -217,7 +217,7 @@ EXTERN struct list_head run_ops;
#define LOG_NONE 0x00001111
__attribute__ (( format( printf, 3, 4 ) ))
-void log_level(char *name_in, uint32_t level_in, const char *fmt, ...);
+void log_level(const char *name_in, uint32_t level_in, const char *fmt, ...);
#define log_error(fmt, args...) log_level(NULL, LOG_ERR, fmt, ##args)
#define log_debug(fmt, args...) log_level(NULL, LOG_DEBUG, fmt, ##args)
diff --git a/dlm_controld/logging.c b/dlm_controld/logging.c
index 3298ef99..f1f23f3f 100644
--- a/dlm_controld/logging.c
+++ b/dlm_controld/logging.c
@@ -151,7 +151,7 @@ static void log_save_str(int len, char *log_buf, unsigned int *point,
*wrap = w;
}
-void log_level(char *name_in, uint32_t level_in, const char *fmt, ...)
+void log_level(const char *name_in, uint32_t level_in, const char *fmt, ...)
{
va_list ap;
char name[NAME_ID_SIZE + 2];
--
2.31.1
^ permalink raw reply related [flat|nested] 10+ messages in thread
end of thread, other threads:[~2023-03-07 17:13 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-07 17:12 [Cluster-devel] [PATCHv2 dlm-tool 0/9] dlm-tool: pending fixes/cleanups dlm-tool patches Alexander Aring
2023-03-07 17:12 ` [Cluster-devel] [PATCHv2 dlm-tool 1/9] dlm_tool: add fail functionality if dump failed Alexander Aring
2023-03-07 17:13 ` [Cluster-devel] [PATCHv2 dlm-tool 2/9] dlm_controld: always create logdir Alexander Aring
2023-03-07 17:13 ` [Cluster-devel] [PATCHv2 dlm-tool 3/9] dlm_controld: move processing of saved messages to plock level Alexander Aring
2023-03-07 17:13 ` [Cluster-devel] [PATCHv2 dlm-tool 4/9] dlm_controld: remove ls parameter Alexander Aring
2023-03-07 17:13 ` [Cluster-devel] [PATCHv2 dlm-tool 5/9] dlm_controld: constify timeval of dt_usec() Alexander Aring
2023-03-07 17:13 ` [Cluster-devel] [PATCHv2 dlm-tool 6/9] dlm_controld: add gcc format printf attribute to log_level Alexander Aring
2023-03-07 17:13 ` [Cluster-devel] [PATCHv2 dlm-tool 7/9] dlm_controld: use write_result() Alexander Aring
2023-03-07 17:13 ` [Cluster-devel] [PATCHv2 dlm-tool 8/9] dlm_controld: be sure we stop lockspaces before shutdown Alexander Aring
2023-03-07 17:13 ` [Cluster-devel] [PATCHv2 dlm-tool 9/9] dlm_controld: constify name_in in log_level() Alexander Aring
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).