cluster: STABLE3 - config: Add hash_cluster_id to schema
by Lon Hohberger
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 7fde51f8331e11e1a8cfcaa00bc90c9cc5d420f5
Parent: ac01c1edf361561e9831b36f33c10f60d8aa0742
Author: Lon Hohberger <lhh(a)redhat.com>
AuthorDate: Tue Mar 23 16:48:54 2010 -0400
Committer: Lon Hohberger <lhh(a)redhat.com>
CommitterDate: Tue Mar 23 16:48:54 2010 -0400
config: Add hash_cluster_id to schema
Signed-off-by: Lon Hohberger <lhh(a)redhat.com>
---
config/plugins/ldap/99cluster.ldif | 10 ++++++++--
config/plugins/ldap/ldap-base.csv | 3 ++-
config/tools/xml/cluster.rng.in | 3 +++
3 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/config/plugins/ldap/99cluster.ldif b/config/plugins/ldap/99cluster.ldif
index 4039bb6..b4d4812 100644
--- a/config/plugins/ldap/99cluster.ldif
+++ b/config/plugins/ldap/99cluster.ldif
@@ -1,4 +1,4 @@
-# Auto-generated @ 2010-02-10 13:29:29
+# Auto-generated @ 2010-03-23 16:45:04
dn: cn=schema
attributeTypes: (
1.3.6.1.4.1.2312.8.1.1.1 NAME 'rhcsConfig-version'
@@ -67,6 +67,12 @@ attributeTypes: (
SINGLE-VALUE
)
attributeTypes: (
+ 1.3.6.1.4.1.2312.8.1.1.274 NAME 'rhcsHash-cluster-id'
+ EQUALITY caseExactIA5Match
+ SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
+ SINGLE-VALUE
+ )
+attributeTypes: (
1.3.6.1.4.1.2312.8.1.1.45 NAME 'rhcsNodename'
EQUALITY caseExactIA5Match
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
@@ -1543,7 +1549,7 @@ objectClasses: (
objectClasses: (
1.3.6.1.4.1.2312.8.1.2.3 NAME 'rhcsCman' SUP top STRUCTURAL
MUST ( cn )
- MAY ( rhcsDisable-openais $ rhcsKeyfile $ rhcsBroadcast $ rhcsNodename $ rhcsCluster-id $ rhcsPort $ rhcsDebug-mask $ rhcsCcsd-poll $ rhcsShutdown-timeout $ rhcsQuorum-dev-poll $ rhcsDisallowed $ rhcsUpgrading $ rhcsExpected-votes $ rhcsTwo-node )
+ MAY ( rhcsDisable-openais $ rhcsKeyfile $ rhcsBroadcast $ rhcsNodename $ rhcsHash-cluster-id $ rhcsCluster-id $ rhcsPort $ rhcsDebug-mask $ rhcsCcsd-poll $ rhcsShutdown-timeout $ rhcsQuorum-dev-poll $ rhcsDisallowed $ rhcsUpgrading $ rhcsExpected-votes $ rhcsTwo-node )
)
objectClasses: (
1.3.6.1.4.1.2312.8.1.2.8 NAME 'rhcsMulticast' SUP top STRUCTURAL
diff --git a/config/plugins/ldap/ldap-base.csv b/config/plugins/ldap/ldap-base.csv
index 14c8f06..faec32b 100644
--- a/config/plugins/ldap/ldap-base.csv
+++ b/config/plugins/ldap/ldap-base.csv
@@ -1,4 +1,4 @@
-# Max attribute value: 273
+# Max attribute value: 274
# Max object class value: 59
obj,rhcsCluster,cluster,1
obj,rhcsCman,cman,3
@@ -331,3 +331,4 @@ attr,rhcsSerial-params,serial_params,271
attr,rhcsChannel-address,channel_address,272
obj,rhcsClvmd,clvmd,59
attr,rhcsInterface,interface,273
+attr,rhcsHash-cluster-id,hash_cluster_id,274
diff --git a/config/tools/xml/cluster.rng.in b/config/tools/xml/cluster.rng.in
index fd1eaf7..891eeea 100644
--- a/config/tools/xml/cluster.rng.in
+++ b/config/tools/xml/cluster.rng.in
@@ -117,6 +117,9 @@ To validate your cluster.conf against this schema, run:
</attribute>
</optional>
<optional>
+ <attribute name="hash_cluster_id" rha:description="Enable stronger hashing of cluster ID to avoid collisions." />
+ </optional>
+ <optional>
<attribute name="nodename" rha:description="Local node name; this is set internally by cman-preconfig and should never be set by a user."/>
</optional>
<optional>
14 years, 1 month
dlm: master - dlm_controld/libdlmcontrol/dlm_tool: separate plock debug buffer
by David Teigland
Gitweb: http://git.fedorahosted.org/git/dlm.git?p=dlm.git;a=commitdiff;h=bcaea325...
Commit: bcaea3259de4dc961cdf38f06c3635f5ecc5ba8d
Parent: 53c20426085bd9535b829279763a9815311e5816
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Mar 23 15:17:47 2010 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Mar 23 15:17:47 2010 -0500
dlm_controld/libdlmcontrol/dlm_tool: separate plock debug buffer
Add a new circular debug buffer for plock debug messages just
like the normal debug buffer. This lets us do plock debugging
without pushing out all of the normal debugging. New command
"dlm_tool log_plock" dumps the plock debug buffer.
bz 576322
Signed-off-by: David Teigland <teigland(a)redhat.com>
---
dlm/libdlmcontrol/libdlmcontrol.h | 1 +
dlm/libdlmcontrol/main.c | 5 ++
dlm/tool/main.c | 25 ++++++++++-
group/dlm_controld/dlm_controld.h | 1 +
group/dlm_controld/dlm_daemon.h | 30 ++++++++++--
group/dlm_controld/main.c | 60 ++++++++++++++++++++++--
group/dlm_controld/plock.c | 92 +++++++++++++++++++-----------------
7 files changed, 160 insertions(+), 54 deletions(-)
diff --git a/dlm/libdlmcontrol/libdlmcontrol.h b/dlm/libdlmcontrol/libdlmcontrol.h
index c85bd3f..64a3814 100644
--- a/dlm/libdlmcontrol/libdlmcontrol.h
+++ b/dlm/libdlmcontrol/libdlmcontrol.h
@@ -66,6 +66,7 @@ struct dlmc_lockspace {
#define DLMC_NODES_NEXT 3
int dlmc_dump_debug(char *buf);
+int dlmc_dump_log_plock(char *buf);
int dlmc_dump_plocks(char *name, char *buf);
int dlmc_lockspace_info(char *lsname, struct dlmc_lockspace *ls);
int dlmc_node_info(char *lsname, int nodeid, struct dlmc_node *node);
diff --git a/dlm/libdlmcontrol/main.c b/dlm/libdlmcontrol/main.c
index bbdaeb4..0e5c076 100644
--- a/dlm/libdlmcontrol/main.c
+++ b/dlm/libdlmcontrol/main.c
@@ -136,6 +136,11 @@ int dlmc_dump_debug(char *buf)
return do_dump(DLMC_CMD_DUMP_DEBUG, NULL, buf);
}
+int dlmc_dump_log_plock(char *buf)
+{
+ return do_dump(DLMC_CMD_DUMP_LOG_PLOCK, NULL, buf);
+}
+
int dlmc_dump_plocks(char *name, char *buf)
{
return do_dump(DLMC_CMD_DUMP_PLOCKS, name, buf);
diff --git a/dlm/tool/main.c b/dlm/tool/main.c
index a64f909..e98a3cc 100644
--- a/dlm/tool/main.c
+++ b/dlm/tool/main.c
@@ -30,6 +30,7 @@
#define OP_PLOCKS 7
#define OP_LOCKDUMP 8
#define OP_LOCKDEBUG 9
+#define OP_LOG_PLOCK 10
static char *prog_name;
static char *lsname;
@@ -173,7 +174,8 @@ static void print_usage(void)
printf("Usage:\n");
printf("\n");
printf("dlm_tool [options] [join | leave | lockdump | lockdebug |\n"
- " ls | dump | plocks | deadlock_check]\n");
+ " ls | dump | log_plock | plocks |\n"
+ " deadlock_check]\n");
printf("\n");
printf("Options:\n");
printf(" -n Show all node information in ls\n");
@@ -323,6 +325,12 @@ static void decode_arguments(int argc, char **argv)
operation = OP_PLOCKS;
opt_ind = optind + 1;
break;
+ } else if (!strncmp(argv[optind], "log_plock", 9) &&
+ (strlen(argv[optind]) == 9)) {
+ operation = OP_LOG_PLOCK;
+ opt_ind = optind + 1;
+ need_lsname = 0;
+ break;
}
/*
@@ -1248,6 +1256,17 @@ static void do_dump(void)
do_write(STDOUT_FILENO, buf, strlen(buf));
}
+static void do_log_plock(void)
+{
+ char buf[DLMC_DUMP_SIZE];
+
+ memset(buf, 0, sizeof(buf));
+
+ dlmc_dump_log_plock(buf);
+
+ do_write(STDOUT_FILENO, buf, strlen(buf));
+}
+
int main(int argc, char **argv)
{
prog_name = argv[0];
@@ -1280,6 +1299,10 @@ int main(int argc, char **argv)
do_dump();
break;
+ case OP_LOG_PLOCK:
+ do_log_plock();
+ break;
+
case OP_PLOCKS:
do_plocks(lsname);
break;
diff --git a/group/dlm_controld/dlm_controld.h b/group/dlm_controld/dlm_controld.h
index b02bc42..73e4ecc 100644
--- a/group/dlm_controld/dlm_controld.h
+++ b/group/dlm_controld/dlm_controld.h
@@ -20,6 +20,7 @@
#define DLMC_CMD_FS_UNREGISTER 8
#define DLMC_CMD_FS_NOTIFIED 9
#define DLMC_CMD_DEADLOCK_CHECK 10
+#define DLMC_CMD_DUMP_LOG_PLOCK 11
struct dlmc_header {
unsigned int magic;
diff --git a/group/dlm_controld/dlm_daemon.h b/group/dlm_controld/dlm_daemon.h
index 84a3d0e..6b5935e 100644
--- a/group/dlm_controld/dlm_daemon.h
+++ b/group/dlm_controld/dlm_daemon.h
@@ -82,10 +82,6 @@ extern int plock_ci;
extern struct list_head lockspaces;
extern int cluster_quorate;
extern int our_nodeid;
-extern char daemon_debug_buf[256];
-extern char dump_buf[DLMC_DUMP_SIZE];
-extern int dump_point;
-extern int dump_wrap;
extern char plock_dump_buf[DLMC_DUMP_SIZE];
extern int plock_dump_len;
extern uint32_t control_minor;
@@ -93,7 +89,20 @@ extern uint32_t monitor_minor;
extern uint32_t plock_minor;
extern uint32_t old_plock_minor;
+/* circular buffer of log_debug and log_error messages */
+extern char daemon_debug_buf[256];
+extern char dump_buf[DLMC_DUMP_SIZE];
+extern int dump_point;
+extern int dump_wrap;
+
+/* circular buffer of log_plock messages */
+extern char log_plock_line[256];
+extern char log_plock_buf[DLMC_DUMP_SIZE];
+extern int log_plock_point;
+extern int log_plock_wrap;
+
void daemon_dump_save(void);
+void log_plock_save(void);
#define log_level(lvl, fmt, args...) \
do { \
@@ -119,10 +128,19 @@ do { \
#define log_plock(ls, fmt, args...) \
do { \
- snprintf(daemon_debug_buf, 255, "%ld %s " fmt "\n", time(NULL), \
+ snprintf(log_plock_line, 255, "%ld %s " fmt "\n", time(NULL), \
(ls)->name, ##args); \
+ log_plock_save(); \
if (daemon_debug_opt && cfgd_plock_debug) \
- fprintf(stderr, "%s", daemon_debug_buf); \
+ fprintf(stderr, "%s", log_plock_line); \
+} while (0)
+
+#define log_plock_error(ls, fmt, args...) \
+do { \
+ log_level(LOG_ERR, fmt, ##args); \
+ snprintf(log_plock_line, 255, "%ld %s " fmt "\n", time(NULL), \
+ (ls)->name, ##args); \
+ log_plock_save(); \
} while (0)
/* dlm_header types */
diff --git a/group/dlm_controld/main.c b/group/dlm_controld/main.c
index 12ffd79..0ce2c39 100644
--- a/group/dlm_controld/main.c
+++ b/group/dlm_controld/main.c
@@ -436,6 +436,35 @@ static void query_dump_debug(int fd)
do_write(fd, dump_buf, len);
}
+static void query_dump_log_plock(int fd)
+{
+ struct dlmc_header h;
+ int extra_len;
+ int len;
+
+ /* in the case of dump_wrap, extra_len will go in two writes,
+ first the log tail, then the log head */
+ if (log_plock_wrap)
+ extra_len = DLMC_DUMP_SIZE;
+ else
+ extra_len = log_plock_point;
+
+ init_header(&h, DLMC_CMD_DUMP_LOG_PLOCK, NULL, 0, extra_len);
+ do_write(fd, &h, sizeof(h));
+
+ if (log_plock_wrap) {
+ len = DLMC_DUMP_SIZE - log_plock_point;
+ do_write(fd, log_plock_buf + log_plock_point, len);
+ len = log_plock_point;
+ } else
+ len = log_plock_point;
+
+ /* NUL terminate the debug string */
+ log_plock_buf[log_plock_point] = '\0';
+
+ do_write(fd, log_plock_buf, len);
+}
+
static void query_dump_plocks(int fd, char *name)
{
struct lockspace *ls;
@@ -776,6 +805,9 @@ static void *process_queries(void *arg)
case DLMC_CMD_DUMP_DEBUG:
query_dump_debug(f);
break;
+ case DLMC_CMD_DUMP_LOG_PLOCK:
+ query_dump_log_plock(f);
+ break;
case DLMC_CMD_DUMP_PLOCKS:
query_dump_plocks(f, h.name);
break;
@@ -1252,6 +1284,22 @@ void daemon_dump_save(void)
}
}
+void log_plock_save(void)
+{
+ int len, i;
+
+ len = strlen(log_plock_line);
+
+ for (i = 0; i < len; i++) {
+ log_plock_buf[log_plock_point++] = log_plock_line[i];
+
+ if (log_plock_point == DLMC_DUMP_SIZE) {
+ log_plock_point = 0;
+ log_plock_wrap = 1;
+ }
+ }
+}
+
int daemon_debug_opt;
int daemon_quit;
int cluster_down;
@@ -1265,16 +1313,20 @@ int plock_ci;
struct list_head lockspaces;
int cluster_quorate;
int our_nodeid;
-char daemon_debug_buf[256];
-char dump_buf[DLMC_DUMP_SIZE];
-int dump_point;
-int dump_wrap;
char plock_dump_buf[DLMC_DUMP_SIZE];
int plock_dump_len;
uint32_t control_minor;
uint32_t monitor_minor;
uint32_t plock_minor;
uint32_t old_plock_minor;
+char daemon_debug_buf[256];
+char dump_buf[DLMC_DUMP_SIZE];
+int dump_point;
+int dump_wrap;
+char log_plock_line[256];
+char log_plock_buf[DLMC_DUMP_SIZE];
+int log_plock_point;
+int log_plock_wrap;
/* was a config value set on command line?, 0 or 1.
optk is a kernel option, optd is a daemon option */
diff --git a/group/dlm_controld/plock.c b/group/dlm_controld/plock.c
index e0adbc6..7e5b735 100644
--- a/group/dlm_controld/plock.c
+++ b/group/dlm_controld/plock.c
@@ -261,7 +261,7 @@ static int find_resource(struct lockspace *ls, uint64_t number, int create,
r = malloc(sizeof(struct resource));
if (!r) {
- log_error("find_resource no memory %d", errno);
+ log_plock_error(ls, "find_resource no memory %d", errno);
rv = -ENOMEM;
goto out;
}
@@ -749,7 +749,7 @@ static void save_message(struct lockspace *ls, struct dlm_header *hd, int len,
sm->len = len;
sm->nodeid = from;
- log_group(ls, "save %s from %d len %d", msg_name(type), from, len);
+ log_plock(ls, "save %s from %d len %d", msg_name(type), from, len);
list_add_tail(&sm->list, &ls->saved_messages);
}
@@ -770,7 +770,8 @@ static void __receive_plock(struct lockspace *ls, struct dlm_plock_info *in,
do_get(ls, in, r);
break;
default:
- log_error("receive_plock from %d optype %d", from, in->optype);
+ log_plock_error(ls, "receive_plock error from %d optype %d",
+ from, in->optype);
if (from == our_nodeid)
write_result(ls, in, -EINVAL);
}
@@ -810,7 +811,7 @@ static void _receive_plock(struct lockspace *ls, struct dlm_header *hd, int len)
if (!(plock_recv_count % 1000)) {
gettimeofday(&now, NULL);
usec = dt_usec(&plock_recv_time, &now);
- log_group(ls, "plock_recv_count %u time %.3f s",
+ log_plock(ls, "plock_recv_count %u time %.3f s",
plock_recv_count, usec * 1.e-6);
plock_recv_time = now;
}
@@ -819,8 +820,8 @@ static void _receive_plock(struct lockspace *ls, struct dlm_header *hd, int len)
return;
if (from != hd->nodeid || from != info.nodeid) {
- log_error("receive_plock from %d header %d info %d",
- from, hd->nodeid, info.nodeid);
+ log_plock_error(ls, "receive_plock error from %d header %d info %d",
+ from, hd->nodeid, info.nodeid);
return;
}
@@ -834,7 +835,7 @@ static void _receive_plock(struct lockspace *ls, struct dlm_header *hd, int len)
who sent the plock, we need to send_own() and put it on the
pending list to resend once the owner is established. */
- log_debug("receive_plock from %d no r %llx", from,
+ log_plock(ls, "receive_plock from %d no r %llx", from,
(unsigned long long)info.number);
if (from != our_nodeid)
@@ -851,8 +852,8 @@ static void _receive_plock(struct lockspace *ls, struct dlm_header *hd, int len)
/* r not found, rv is -ENOENT, this shouldn't happen because
process_plocks() creates a resource for every op */
- log_error("receive_plock from %d no r %llx %d", from,
- (unsigned long long)info.number, rv);
+ log_plock_error(ls, "receive_plock error from %d no r %llx %d",
+ from, (unsigned long long)info.number, rv);
return;
}
@@ -882,23 +883,21 @@ static void _receive_plock(struct lockspace *ls, struct dlm_header *hd, int len)
__receive_plock(ls, &info, from, r);
} else if (r->owner == -1) {
- log_debug("receive_plock from %d r %llx owner %d", from,
+ log_plock(ls, "receive_plock from %d r %llx owner %d", from,
(unsigned long long)info.number, r->owner);
if (from == our_nodeid)
save_pending_plock(ls, r, &info);
} else if (r->owner != our_nodeid) {
- /* might happen, if frequent change to log_debug */
- log_error("receive_plock from %d r %llx owner %d", from,
+ log_plock(ls, "receive_plock from %d r %llx owner %d", from,
(unsigned long long)info.number, r->owner);
if (from == our_nodeid)
save_pending_plock(ls, r, &info);
} else if (r->owner == our_nodeid) {
- /* might happen, if frequent change to log_debug */
- log_error("receive_plock from %d r %llx owner %d", from,
+ log_plock(ls, "receive_plock from %d r %llx owner %d", from,
(unsigned long long)info.number, r->owner);
if (from == our_nodeid)
@@ -943,7 +942,7 @@ static int send_struct_info(struct lockspace *ls, struct dlm_plock_info *in,
free(buf);
out:
if (rv)
- log_error("send_struct_info error %d", rv);
+ log_plock_error(ls, "send_struct_info error %d", rv);
return rv;
}
@@ -961,7 +960,7 @@ static void send_own(struct lockspace *ls, struct resource *r, int owner)
(pending list is not empty), then we shouldn't send another */
if (!list_empty(&r->pending)) {
- log_debug("send_own %llx already pending",
+ log_plock(ls, "send_own %llx already pending",
(unsigned long long)r->number);
return;
}
@@ -1030,7 +1029,7 @@ static void save_pending_plock(struct lockspace *ls, struct resource *r,
w = malloc(sizeof(struct lock_waiter));
if (!w) {
- log_error("save_pending_plock no mem");
+ log_plock_error(ls, "save_pending_plock no mem");
return;
}
memcpy(&w->info, in, sizeof(struct dlm_plock_info));
@@ -1076,7 +1075,7 @@ static void _receive_own(struct lockspace *ls, struct dlm_header *hd, int len)
memcpy(&info, (char *)hd + sizeof(struct dlm_header), sizeof(info));
info_bswap_in(&info);
- log_plock(ls, "receive own %llx from %u owner %u",
+ log_plock(ls, "receive_own %llx from %u owner %u",
(unsigned long long)info.number, hd->nodeid, info.nodeid);
rv = find_resource(ls, info.number, 1, &r);
@@ -1179,9 +1178,10 @@ static void _receive_own(struct lockspace *ls, struct dlm_header *hd, int len)
}
if (should_not_happen) {
- log_error("receive_own from %u %llx info nodeid %d r owner %d",
- from, (unsigned long long)r->number, info.nodeid,
- r->owner);
+ log_plock_error(ls, "receive_own error from %u %llx "
+ "info nodeid %d r owner %d",
+ from, (unsigned long long)r->number,
+ info.nodeid, r->owner);
}
}
@@ -1195,7 +1195,8 @@ void receive_own(struct lockspace *ls, struct dlm_header *hd, int len)
_receive_own(ls, hd, len);
}
-static void clear_syncing_flag(struct resource *r, struct dlm_plock_info *in)
+static void clear_syncing_flag(struct lockspace *ls, struct resource *r,
+ struct dlm_plock_info *in)
{
struct posix_lock *po;
struct lock_waiter *w;
@@ -1226,10 +1227,14 @@ static void clear_syncing_flag(struct resource *r, struct dlm_plock_info *in)
}
}
- log_error("clear_syncing %llx no match %s %llx-%llx %d/%u/%llx",
- (unsigned long long)r->number, in->ex ? "WR" : "RD",
- (unsigned long long)in->start, (unsigned long long)in->end,
- in->nodeid, in->pid, (unsigned long long)in->owner);
+ log_plock_error(ls, "clear_syncing error %llx no match %s %llx-%llx "
+ "%d/%u/%llx",
+ (unsigned long long)r->number,
+ in->ex ? "WR" : "RD",
+ (unsigned long long)in->start,
+ (unsigned long long)in->end,
+ in->nodeid, in->pid,
+ (unsigned long long)in->owner);
}
static void _receive_sync(struct lockspace *ls, struct dlm_header *hd, int len)
@@ -1249,13 +1254,14 @@ static void _receive_sync(struct lockspace *ls, struct dlm_header *hd, int len)
rv = find_resource(ls, info.number, 0, &r);
if (rv) {
- log_error("receive_sync no r %llx from %d", info.number, from);
+ log_plock_error(ls, "receive_sync error no r %llx from %d",
+ info.number, from);
return;
}
if (from == our_nodeid) {
/* this plock now in sync on all nodes */
- clear_syncing_flag(r, &info);
+ clear_syncing_flag(ls, r, &info);
return;
}
@@ -1286,13 +1292,13 @@ static void _receive_drop(struct lockspace *ls, struct dlm_header *hd, int len)
memcpy(&info, (char *)hd + sizeof(struct dlm_header), sizeof(info));
info_bswap_in(&info);
- log_plock(ls, "receive drop %llx from %u",
+ log_plock(ls, "receive_drop %llx from %u",
(unsigned long long)info.number, from);
rv = find_resource(ls, info.number, 0, &r);
if (rv) {
/* we'll find no r if two nodes sent drop at once */
- log_debug("receive_drop from %d no r %llx", from,
+ log_plock(ls, "receive_drop from %d no r %llx", from,
(unsigned long long)info.number);
return;
}
@@ -1303,15 +1309,15 @@ static void _receive_drop(struct lockspace *ls, struct dlm_header *hd, int len)
- A sent drop, B sent drop, receive drop A, A sent own,
receive own A, receive drop B (this warning on all,
owner A) */
- log_debug("receive_drop from %d r %llx owner %d", from,
+ log_plock(ls, "receive_drop from %d r %llx owner %d", from,
(unsigned long long)r->number, r->owner);
return;
}
if (!list_empty(&r->pending)) {
/* shouldn't happen */
- log_error("receive_drop from %d r %llx pending op", from,
- (unsigned long long)r->number);
+ log_plock_error(ls, "receive_drop error from %d r %llx pending op",
+ from, (unsigned long long)r->number);
return;
}
@@ -1323,7 +1329,7 @@ static void _receive_drop(struct lockspace *ls, struct dlm_header *hd, int len)
free(r);
} else {
/* A sent drop, B sent a plock, receive plock, receive drop */
- log_debug("receive_drop from %d r %llx in use", from,
+ log_plock(ls, "receive_drop from %d r %llx in use", from,
(unsigned long long)r->number);
}
}
@@ -1477,7 +1483,7 @@ void process_plocks(int ci)
ls = find_ls_id(info.fsid);
if (!ls) {
- log_debug("process_plocks: no ls id %x", info.fsid);
+ log_plock(ls, "process_plocks: no ls id %x", info.fsid);
rv = -EEXIST;
goto fail;
}
@@ -1494,7 +1500,7 @@ void process_plocks(int ci)
plock_read_count++;
if (!(plock_read_count % 1000)) {
usec = dt_usec(&plock_read_time, &now) ;
- log_group(ls, "plock_read_count %u time %.3f s delays %u",
+ log_plock(ls, "plock_read_count %u time %.3f s delays %u",
plock_read_count, usec * 1.e-6, plock_rate_delays);
plock_read_time = now;
plock_rate_delays = 0;
@@ -1537,7 +1543,7 @@ void process_saved_plocks(struct lockspace *ls)
if (list_empty(&ls->saved_messages))
return;
- log_group(ls, "process_saved_plocks");
+ log_plock(ls, "process_saved_plocks");
list_for_each_entry_safe(sm, sm2, &ls->saved_messages, list) {
hd = (struct dlm_header *)sm->buf;
@@ -1907,8 +1913,8 @@ void store_plocks(struct lockspace *ls)
else if (!r->owner)
owner = 0;
else {
- log_error("store_plocks owner %d r %llx", r->owner,
- (unsigned long long)r->number);
+ log_plock_error(ls, "store_plocks error owner %d r %llx",
+ r->owner, (unsigned long long)r->number);
continue;
}
@@ -1926,7 +1932,7 @@ void store_plocks(struct lockspace *ls)
pack_section_buf(ls, r);
- log_group(ls, "store_plocks: section size %u id %u \"%s\"",
+ log_plock(ls, "store_plocks: section size %u id %u \"%s\"",
section_len, section_id.idLen, buf);
create_retry:
@@ -2034,7 +2040,7 @@ void retrieve_plocks(struct lockspace *ls)
memset(&buf, 0, sizeof(buf));
snprintf(buf, SECTION_NAME_LEN, "%s", desc.sectionId.id);
- log_group(ls, "retrieve_plocks: section size %llu id %u \"%s\"",
+ log_plock(ls, "retrieve_plocks: section size %llu id %u \"%s\"",
(unsigned long long)iov.dataSize, iov.sectionId.idLen,
buf);
@@ -2055,7 +2061,7 @@ void retrieve_plocks(struct lockspace *ls)
no locks, which exist in ownership mode; the resource
name and owner come from the section id */
- log_group(ls, "retrieve_plocks: ckpt read %llu bytes",
+ log_plock(ls, "retrieve_plocks: ckpt read %llu bytes",
(unsigned long long)iov.readSize);
section_len = iov.readSize;
@@ -2128,7 +2134,7 @@ void purge_plocks(struct lockspace *ls, int nodeid, int unmount)
if (purged)
ls->last_plock_time = time(NULL);
- log_group(ls, "purged %d plocks for %d", purged, nodeid);
+ log_plock(ls, "purged %d plocks for %d", purged, nodeid);
}
int fill_plock_dump_buf(struct lockspace *ls)
14 years, 1 month
dlm: master - man pages: dlm_tool and dlm_controld
by David Teigland
Gitweb: http://git.fedorahosted.org/git/dlm.git?p=dlm.git;a=commitdiff;h=53c20426...
Commit: 53c20426085bd9535b829279763a9815311e5816
Parent: a543de9e57e3fcea7f0912b288a3446910146cdf
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Mar 23 15:16:31 2010 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Mar 23 15:16:31 2010 -0500
man pages: dlm_tool and dlm_controld
sync from STABLE3
Signed-off-by: David Teigland <teigland(a)redhat.com>
---
dlm/man/dlm_tool.8 | 101 ++++++++++++---
group/man/dlm_controld.8 | 320 ++++++++++++++++++++++++++++++++++++----------
2 files changed, 335 insertions(+), 86 deletions(-)
diff --git a/dlm/man/dlm_tool.8 b/dlm/man/dlm_tool.8
index 57e3da3..df9aa64 100644
--- a/dlm/man/dlm_tool.8
+++ b/dlm/man/dlm_tool.8
@@ -1,39 +1,98 @@
-.TH dlm_tool 8
+.TH DLM_TOOL 8 2009-01-20 cluster cluster
.SH NAME
-dlm_tool - A program to join and leave lockspaces and display dlm information
+dlm_tool \- a utility for the dlm and dlm_controld daemon
.SH SYNOPSIS
-.B
-dlm_tool
-[\fIOPTIONS\fR]
-<\fBjoin | leave | lockdump | deadlock_check\fP>
-<\fBname\fP>
+.B dlm_tool
+[COMMAND] [OPTIONS]
+[
+.I name
+]
.SH DESCRIPTION
+.TP
+.B ls
+Display internal dlm_controld state about lockspaces.
+
+.TP
+.B dump
+Dump dlm_controld debug buffer.
+
+.TP
+.B log_plock
+Dump dlm_controld plock debug buffer.
+
+.TP
+.BI plocks " name"
+Dump posix locks from dlm_controld for the lockspace.
+
+.TP
+.BI lockdump " name"
+Minimal display of locks from the lockspace.
+
+.TP
+.BI lockdebug " name"
+Extended display of locks from the lockspace.
+
+.TP
+.BI join " name"
+Join a lockspace.
+
+.TP
+.BI leave " name"
+Leave a lockspace.
-\fBdlm_tool\fP is a program used to join or leave dlm lockspaces, dump
-dlm lock state, and initiate deadlock detection cycles. The name of a
-lockspace follows the subcommand.
+.TP
+.BI deadlock_check " name"
+Start a deadlock detection cycle for the lockspace.
.SH OPTIONS
.TP
-\fB-m\fP
-The permission mode (in octal) of the lockspace device created by join;
-default 0600.
+.B \-n
+Show all node information in ls.
+
+.TP
+.BI \-d " num"
+Resource directory enabled (1) or disabled (0) during join. Default 0.
+
+.TP
+.BI \-e " num"
+Exclusive create off/on (0/1) in join. Default 0.
+
+.TP
+.BI \-f " num"
+FS memory allocation off/on (0/1) in join. Default 0.
+
+.TP
+.BI \-m " mode"
+The permission mode (in octal) of the lockspace device created by join.
+Default 0600.
+
.TP
-\fB-M\fP
+.B \-M
Dump MSTCPY locks in addition to locks held by local processes.
+
+.TP
+.B \-s
+Summary following lockdebug output (experimental, format may change).
+
.TP
-\fB-d\fP <num>
-Resource directory enabled (1) or disabled (0) during join; default 0.
+.B \-v
+Verbose lockdebug output.
+
+.TP
+.B \-w
+Wide lockdebug output.
+
.TP
-\fB-h\fP
-Help. Print out the usage syntax.
+.B \-h
+Print a help message describing available options, then exit.
+
.TP
-\fB-V\fP
-Print version information.
+.B \-V
+Print program version information, then exit.
.SH SEE ALSO
-libdlm(3)
+.BR dlm_controld (8)
diff --git a/group/man/dlm_controld.8 b/group/man/dlm_controld.8
index e8dc1c6..7100f0e 100644
--- a/group/man/dlm_controld.8
+++ b/group/man/dlm_controld.8
@@ -1,81 +1,282 @@
-.TH dlm_controld 8
+.TH DLM_CONTROLD 8 2009-01-18 cluster cluster
.SH NAME
-dlm_controld - daemon that configures dlm according to cluster events
+dlm_controld \- daemon that configures dlm according to cluster events
.SH SYNOPSIS
-.B
-dlm_controld
-[\fIOPTION\fR]...
+.B dlm_controld
+[OPTIONS]
.SH DESCRIPTION
-The dlm lives in the kernel, and the cluster infrastructure (cluster
+The dlm lives in the kernel, and the cluster infrastructure (corosync
membership and group management) lives in user space. The dlm in the
kernel needs to adjust/recover for certain cluster events. It's the job
of dlm_controld to receive these events and reconfigure the kernel dlm as
needed. dlm_controld controls and configures the dlm through sysfs and
-configfs files that are considered dlm-internal interfaces; not a general
-API/ABI.
+configfs files that are considered dlm-internal interfaces.
-The dlm also exports lock state through debugfs so that dlm_controld can
-implement deadlock detection in user space.
+The cman init script usually starts the dlm_controld daemon.
-.SH CONFIGURATION FILE
+.SH OPTIONS
+Command line options override a corresponding setting in cluster.conf.
+
+.TP
+.B \-D
+Enable debugging to stderr and don't fork.
+.br
+See also
+.B dlm_tool dump
+in
+.BR dlm_tool (8).
+
+.TP
+.B \-L
+Enable debugging to log file.
+.br
+See also
+.B logging
+in
+.BR cluster.conf (5).
+
+.TP
+.B \-K
+Enable kernel dlm debugging messages.
+.br
+See also
+.B log_debug
+below.
+
+.TP
+.BI \-r " num"
+dlm kernel lowcomms protocol, 0 tcp, 1 sctp, 2 detect.
+2 selects tcp if corosync rrp_mode is "none", otherwise sctp.
+.br
+Default 2.
+
+.TP
+.BI \-g " num"
+groupd compatibility mode, 0 off, 1 on.
+.br
+Default 0.
+
+.TP
+.BI \-f " num"
+Enable (1) or disable (0) fencing recovery dependency.
+.br
+Default 1.
-Optional cluster.conf settings are placed in the <dlm> section.
+.TP
+.BI \-q " num"
+Enable (1) or disable (0) quorum recovery dependency.
+.br
+Default 0.
+
+.TP
+.BI \-d " num"
+Enable (1) or disable (0) deadlock detection code.
+.br
+Default 0.
-.SS Global settings
+.TP
+.BI \-p " num"
+Enable (1) or disable (0) plock code for cluster fs.
+.br
+Default 1.
+
+.TP
+.BI \-l " num"
+Limit the rate of plock operations, 0 for no limit.
+.br
+Default 0.
+
+.TP
+.BI \-o " num"
+Enable (1) or disable (0) plock ownership.
+.br
+Default 1.
+
+.TP
+.BI \-t " ms"
+Plock ownership drop resources time (milliseconds).
+.br
+Default 10000.
+
+.TP
+.BI \-c " num"
+Plock ownership drop resources count.
+.br
+Default 10.
+
+.TP
+.BI \-a " ms"
+Plock ownership drop resources age (milliseconds).
+.br
+Default 10000.
+
+.TP
+.B \-P
+Enable plock debugging messages (can produce excessive output).
+
+.TP
+.B \-h
+Print a help message describing available options, then exit.
+
+.TP
+.B \-V
+Print program version information, then exit.
+
+
+.SH FILES
+.BR cluster.conf (5)
+is usually located at /etc/cluster/cluster.conf. It is not read directly.
+Other cluster components load the contents into memory, and the values are
+accessed through the libccs library.
+
+Configuration options for dlm (kernel) and dlm_controld are added to the
+<dlm /> section of cluster.conf, within the top level <cluster> section.
+
+.SS Kernel options
+
+.TP
+.B protocol
The network
-.I protocol
-can be set to "tcp" or "sctp". The default is tcp.
+.B protocol
+can be set to tcp, sctp or detect which selects tcp or sctp based on
+the corosync rrp_mode configuration (redundant ring protocol).
+The rrp_mode "none" results in tcp. Default detect.
- <dlm protocol="tcp"/>
+<dlm protocol="detect"/>
+.TP
+.B timewarn
After waiting
-.I timewarn
+.B timewarn
centiseconds, the dlm will emit a warning via netlink. This only applies
to lockspaces created with the DLM_LSFL_TIMEWARN flag, and is used for
-deadlock detection. The default is 500 (5 seconds).
+deadlock detection. Default 500 (5 seconds).
- <dlm timewarn="500"/>
+<dlm timewarn="500"/>
+.TP
+.B log_debug
DLM kernel debug messages can be enabled by setting
-.I log_debug
-to 1. The default is 0.
+.B log_debug
+to 1. Default 0.
+
+<dlm log_debug="0"/>
+
+.TP
+.B clusternode/weight
+The lock directory
+.B weight
+can be specified one the clusternode lines. Weights would usually be
+used in the lock server configurations shown below instead.
+
+<clusternode name="node01" nodeid="1" weight="1"/>
+
+.SS Daemon options
+
+.TP
+.B enable_fencing
+See command line description.
+
+<dlm enable_fencing="1"/>
+
+.TP
+.B enable_quorum
+See command line description.
+
+<dlm enable_quorum="0"/>
+
+.TP
+.B enable_deadlk
+See command line description.
+
+<dlm enable_deadlk="0"/>
+
+.TP
+.B enable_plock
+See command line description.
+
+<dlm enable_plock="1"/>
+
+.TP
+.B plock_rate_limit
+See command line description.
+
+<dlm plock_rate_limit="0"/>
+
+.TP
+.B plock_ownership
+See command line description.
+
+<dlm plock_ownership="1"/>
+
+.TP
+.B drop_resources_time
+See command line description.
+
+<dlm drop_resources_time="10000"/>
+
+.TP
+.B drop_resources_count
+See command line description.
+
+<dlm drop_resources_count="10"/>
+
+.TP
+.B drop_resources_age
+See command line description.
+
+<dlm drop_resources_age="10000"/>
+
+.TP
+.B plock_debug
+Enable (1) or disable (0) plock debugging messages (can produce excessive
+output). Default 0.
+
+<dlm plock_debug="0"/>
- <dlm log_debug="0"/>
.SS Disabling resource directory
Lockspaces usually use a resource directory to keep track of which node is
the master of each resource. The dlm can operate without the resource
directory, though, by statically assigning the master of a resource using
-a hash of the resource name.
+a hash of the resource name. To enable, set the per-lockspace
+.B nodir
+option to 1.
- <dlm>
- <lockspace name="foo" nodir="1">
- </dlm>
+.nf
+<dlm>
+ <lockspace name="foo" nodir="1">
+</dlm>
+.fi
.SS Lock-server configuration
The nodir setting can be combined with node weights to create a
configuration where select node(s) are the master of all resources/locks.
-These "master" nodes can be viewed as "lock servers" for the other nodes.
+These
+.B master
+nodes can be viewed as "lock servers" for the other nodes.
- <dlm>
- <lockspace name="foo" nodir="1">
- <master name="node01"/>
- </lockspace>
- </dlm>
+.nf
+<dlm>
+ <lockspace name="foo" nodir="1">
+ <master name="node01"/>
+ </lockspace>
+</dlm>
or,
- <dlm>
- <lockspace name="foo" nodir="1">
- <master name="node01"/>
- <master name="node02"/>
- </lockspace>
- </dlm>
+<dlm>
+ <lockspace name="foo" nodir="1">
+ <master name="node01"/>
+ <master name="node02"/>
+ </lockspace>
+</dlm>
+.fi
Lock management will be partitioned among the available masters. There
can be any number of masters defined. The designated master nodes will
@@ -87,37 +288,26 @@ disruption, when a non-master node joins/leaves.
There is no special mode in the dlm for this lock server configuration,
it's just a natural consequence of combining the "nodir" option with node
weights. When a lockspace has master nodes defined, the master has a
-default weight of 1 and all non-master nodes have weight of 0. Explicit
-non-zero weights can also be assigned to master nodes, e.g.
+default weight of 1 and all non-master nodes have weight of 0. An explicit
+non-zero
+.B weight
+can also be assigned to master nodes, e.g.
- <dlm>
- <lockspace name="foo" nodir="1">
- <master name="node01" weight="2"/>
- <master name="node02" weight="1"/>
- </lockspace>
- </dlm>
+.nf
+<dlm>
+ <lockspace name="foo" nodir="1">
+ <master name="node01" weight="2"/>
+ <master name="node02" weight="1"/>
+ </lockspace>
+</dlm>
+.fi
In which case node01 will master 2/3 of the total resources and node2 will
master the other 1/3.
-
-.SH OPTIONS
-.TP
-\fB-d\fP <num>
-Enable (1) or disable (0) the deadlock detection code.
-.TP
-\fB-D\fP
-Run the daemon in the foreground and print debug statements to stdout.
-.TP
-\fB-K\fP
-Enable kernel dlm debugging messages.
-.TP
-\fB-V\fP
-Print the version information and exit.
-.TP
-\fB-h\fP
-Print out a help message describing available options, then exit.
-
.SH SEE ALSO
-groupd(8)
+.BR dlm_tool (8),
+.BR fenced (8),
+.BR cman (5),
+.BR cluster.conf (5)
14 years, 1 month
cluster: STABLE3 - dlm_controld/libdlmcontrol/dlm_tool: separate plock debug buffer
by David Teigland
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: ac01c1edf361561e9831b36f33c10f60d8aa0742
Parent: 814faae67c226f6ac9e99438096696479c8aaf2e
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Mar 23 12:28:04 2010 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Mar 23 15:09:59 2010 -0500
dlm_controld/libdlmcontrol/dlm_tool: separate plock debug buffer
Add a new circular debug buffer for plock debug messages just
like the normal debug buffer. This lets us do plock debugging
without pushing out all of the normal debugging. New command
"dlm_tool log_plock" dumps the plock debug buffer.
bz 576322
Signed-off-by: David Teigland <teigland(a)redhat.com>
---
dlm/libdlmcontrol/libdlmcontrol.h | 1 +
dlm/libdlmcontrol/main.c | 5 ++
dlm/man/dlm_tool.8 | 4 ++
dlm/tool/main.c | 25 ++++++++++-
group/dlm_controld/dlm_controld.h | 1 +
group/dlm_controld/dlm_daemon.h | 30 ++++++++++--
group/dlm_controld/main.c | 60 ++++++++++++++++++++++--
group/dlm_controld/plock.c | 92 +++++++++++++++++++-----------------
8 files changed, 164 insertions(+), 54 deletions(-)
diff --git a/dlm/libdlmcontrol/libdlmcontrol.h b/dlm/libdlmcontrol/libdlmcontrol.h
index c85bd3f..64a3814 100644
--- a/dlm/libdlmcontrol/libdlmcontrol.h
+++ b/dlm/libdlmcontrol/libdlmcontrol.h
@@ -66,6 +66,7 @@ struct dlmc_lockspace {
#define DLMC_NODES_NEXT 3
int dlmc_dump_debug(char *buf);
+int dlmc_dump_log_plock(char *buf);
int dlmc_dump_plocks(char *name, char *buf);
int dlmc_lockspace_info(char *lsname, struct dlmc_lockspace *ls);
int dlmc_node_info(char *lsname, int nodeid, struct dlmc_node *node);
diff --git a/dlm/libdlmcontrol/main.c b/dlm/libdlmcontrol/main.c
index f2f6365..5a203a1 100644
--- a/dlm/libdlmcontrol/main.c
+++ b/dlm/libdlmcontrol/main.c
@@ -134,6 +134,11 @@ int dlmc_dump_debug(char *buf)
return do_dump(DLMC_CMD_DUMP_DEBUG, NULL, buf);
}
+int dlmc_dump_log_plock(char *buf)
+{
+ return do_dump(DLMC_CMD_DUMP_LOG_PLOCK, NULL, buf);
+}
+
int dlmc_dump_plocks(char *name, char *buf)
{
return do_dump(DLMC_CMD_DUMP_PLOCKS, name, buf);
diff --git a/dlm/man/dlm_tool.8 b/dlm/man/dlm_tool.8
index 5e61567..df9aa64 100644
--- a/dlm/man/dlm_tool.8
+++ b/dlm/man/dlm_tool.8
@@ -20,6 +20,10 @@ Display internal dlm_controld state about lockspaces.
Dump dlm_controld debug buffer.
.TP
+.B log_plock
+Dump dlm_controld plock debug buffer.
+
+.TP
.BI plocks " name"
Dump posix locks from dlm_controld for the lockspace.
diff --git a/dlm/tool/main.c b/dlm/tool/main.c
index 3f46179..4752008 100644
--- a/dlm/tool/main.c
+++ b/dlm/tool/main.c
@@ -28,6 +28,7 @@
#define OP_PLOCKS 7
#define OP_LOCKDUMP 8
#define OP_LOCKDEBUG 9
+#define OP_LOG_PLOCK 10
static char *prog_name;
static char *lsname;
@@ -171,7 +172,8 @@ static void print_usage(void)
printf("Usage:\n");
printf("\n");
printf("dlm_tool [options] [join | leave | lockdump | lockdebug |\n"
- " ls | dump | plocks | deadlock_check]\n");
+ " ls | dump | log_plock | plocks |\n"
+ " deadlock_check]\n");
printf("\n");
printf("Options:\n");
printf(" -n Show all node information in ls\n");
@@ -321,6 +323,12 @@ static void decode_arguments(int argc, char **argv)
operation = OP_PLOCKS;
opt_ind = optind + 1;
break;
+ } else if (!strncmp(argv[optind], "log_plock", 9) &&
+ (strlen(argv[optind]) == 9)) {
+ operation = OP_LOG_PLOCK;
+ opt_ind = optind + 1;
+ need_lsname = 0;
+ break;
}
/*
@@ -1246,6 +1254,17 @@ static void do_dump(void)
do_write(STDOUT_FILENO, buf, strlen(buf));
}
+static void do_log_plock(void)
+{
+ char buf[DLMC_DUMP_SIZE];
+
+ memset(buf, 0, sizeof(buf));
+
+ dlmc_dump_log_plock(buf);
+
+ do_write(STDOUT_FILENO, buf, strlen(buf));
+}
+
int main(int argc, char **argv)
{
prog_name = argv[0];
@@ -1278,6 +1297,10 @@ int main(int argc, char **argv)
do_dump();
break;
+ case OP_LOG_PLOCK:
+ do_log_plock();
+ break;
+
case OP_PLOCKS:
do_plocks(lsname);
break;
diff --git a/group/dlm_controld/dlm_controld.h b/group/dlm_controld/dlm_controld.h
index b02bc42..73e4ecc 100644
--- a/group/dlm_controld/dlm_controld.h
+++ b/group/dlm_controld/dlm_controld.h
@@ -20,6 +20,7 @@
#define DLMC_CMD_FS_UNREGISTER 8
#define DLMC_CMD_FS_NOTIFIED 9
#define DLMC_CMD_DEADLOCK_CHECK 10
+#define DLMC_CMD_DUMP_LOG_PLOCK 11
struct dlmc_header {
unsigned int magic;
diff --git a/group/dlm_controld/dlm_daemon.h b/group/dlm_controld/dlm_daemon.h
index dd6c7cc..b61a636 100644
--- a/group/dlm_controld/dlm_daemon.h
+++ b/group/dlm_controld/dlm_daemon.h
@@ -85,10 +85,6 @@ extern int plock_ci;
extern struct list_head lockspaces;
extern int cluster_quorate;
extern int our_nodeid;
-extern char daemon_debug_buf[256];
-extern char dump_buf[DLMC_DUMP_SIZE];
-extern int dump_point;
-extern int dump_wrap;
extern char plock_dump_buf[DLMC_DUMP_SIZE];
extern int plock_dump_len;
extern int group_mode;
@@ -97,7 +93,20 @@ extern uint32_t monitor_minor;
extern uint32_t plock_minor;
extern uint32_t old_plock_minor;
+/* circular buffer of log_debug and log_error messages */
+extern char daemon_debug_buf[256];
+extern char dump_buf[DLMC_DUMP_SIZE];
+extern int dump_point;
+extern int dump_wrap;
+
+/* circular buffer of log_plock messages */
+extern char log_plock_line[256];
+extern char log_plock_buf[DLMC_DUMP_SIZE];
+extern int log_plock_point;
+extern int log_plock_wrap;
+
void daemon_dump_save(void);
+void log_plock_save(void);
#define log_level(lvl, fmt, args...) \
do { \
@@ -123,10 +132,19 @@ do { \
#define log_plock(ls, fmt, args...) \
do { \
- snprintf(daemon_debug_buf, 255, "%ld %s " fmt "\n", time(NULL), \
+ snprintf(log_plock_line, 255, "%ld %s " fmt "\n", time(NULL), \
(ls)->name, ##args); \
+ log_plock_save(); \
if (daemon_debug_opt && cfgd_plock_debug) \
- fprintf(stderr, "%s", daemon_debug_buf); \
+ fprintf(stderr, "%s", log_plock_line); \
+} while (0)
+
+#define log_plock_error(ls, fmt, args...) \
+do { \
+ log_level(LOG_ERR, fmt, ##args); \
+ snprintf(log_plock_line, 255, "%ld %s " fmt "\n", time(NULL), \
+ (ls)->name, ##args); \
+ log_plock_save(); \
} while (0)
/* dlm_header types */
diff --git a/group/dlm_controld/main.c b/group/dlm_controld/main.c
index af96527..ce88a83 100644
--- a/group/dlm_controld/main.c
+++ b/group/dlm_controld/main.c
@@ -443,6 +443,35 @@ static void query_dump_debug(int fd)
do_write(fd, dump_buf, len);
}
+static void query_dump_log_plock(int fd)
+{
+ struct dlmc_header h;
+ int extra_len;
+ int len;
+
+ /* in the case of dump_wrap, extra_len will go in two writes,
+ first the log tail, then the log head */
+ if (log_plock_wrap)
+ extra_len = DLMC_DUMP_SIZE;
+ else
+ extra_len = log_plock_point;
+
+ init_header(&h, DLMC_CMD_DUMP_LOG_PLOCK, NULL, 0, extra_len);
+ do_write(fd, &h, sizeof(h));
+
+ if (log_plock_wrap) {
+ len = DLMC_DUMP_SIZE - log_plock_point;
+ do_write(fd, log_plock_buf + log_plock_point, len);
+ len = log_plock_point;
+ } else
+ len = log_plock_point;
+
+ /* NUL terminate the debug string */
+ log_plock_buf[log_plock_point] = '\0';
+
+ do_write(fd, log_plock_buf, len);
+}
+
static void query_dump_plocks(int fd, char *name)
{
struct lockspace *ls;
@@ -804,6 +833,9 @@ static void *process_queries(void *arg)
case DLMC_CMD_DUMP_DEBUG:
query_dump_debug(f);
break;
+ case DLMC_CMD_DUMP_LOG_PLOCK:
+ query_dump_log_plock(f);
+ break;
case DLMC_CMD_DUMP_PLOCKS:
query_dump_plocks(f, h.name);
break;
@@ -1314,6 +1346,22 @@ void daemon_dump_save(void)
}
}
+void log_plock_save(void)
+{
+ int len, i;
+
+ len = strlen(log_plock_line);
+
+ for (i = 0; i < len; i++) {
+ log_plock_buf[log_plock_point++] = log_plock_line[i];
+
+ if (log_plock_point == DLMC_DUMP_SIZE) {
+ log_plock_point = 0;
+ log_plock_wrap = 1;
+ }
+ }
+}
+
int daemon_debug_opt;
int daemon_quit;
int cluster_down;
@@ -1327,10 +1375,6 @@ int plock_ci;
struct list_head lockspaces;
int cluster_quorate;
int our_nodeid;
-char daemon_debug_buf[256];
-char dump_buf[DLMC_DUMP_SIZE];
-int dump_point;
-int dump_wrap;
char plock_dump_buf[DLMC_DUMP_SIZE];
int plock_dump_len;
int group_mode;
@@ -1338,6 +1382,14 @@ uint32_t control_minor;
uint32_t monitor_minor;
uint32_t plock_minor;
uint32_t old_plock_minor;
+char daemon_debug_buf[256];
+char dump_buf[DLMC_DUMP_SIZE];
+int dump_point;
+int dump_wrap;
+char log_plock_line[256];
+char log_plock_buf[DLMC_DUMP_SIZE];
+int log_plock_point;
+int log_plock_wrap;
/* was a config value set on command line?, 0 or 1.
optk is a kernel option, optd is a daemon option */
diff --git a/group/dlm_controld/plock.c b/group/dlm_controld/plock.c
index 54f91ef..3f20f7f 100644
--- a/group/dlm_controld/plock.c
+++ b/group/dlm_controld/plock.c
@@ -262,7 +262,7 @@ static int find_resource(struct lockspace *ls, uint64_t number, int create,
r = malloc(sizeof(struct resource));
if (!r) {
- log_error("find_resource no memory %d", errno);
+ log_plock_error(ls, "find_resource no memory %d", errno);
rv = -ENOMEM;
goto out;
}
@@ -750,7 +750,7 @@ static void save_message(struct lockspace *ls, struct dlm_header *hd, int len,
sm->len = len;
sm->nodeid = from;
- log_group(ls, "save %s from %d len %d", msg_name(type), from, len);
+ log_plock(ls, "save %s from %d len %d", msg_name(type), from, len);
list_add_tail(&sm->list, &ls->saved_messages);
}
@@ -771,7 +771,8 @@ static void __receive_plock(struct lockspace *ls, struct dlm_plock_info *in,
do_get(ls, in, r);
break;
default:
- log_error("receive_plock from %d optype %d", from, in->optype);
+ log_plock_error(ls, "receive_plock error from %d optype %d",
+ from, in->optype);
if (from == our_nodeid)
write_result(ls, in, -EINVAL);
}
@@ -811,7 +812,7 @@ static void _receive_plock(struct lockspace *ls, struct dlm_header *hd, int len)
if (!(plock_recv_count % 1000)) {
gettimeofday(&now, NULL);
usec = dt_usec(&plock_recv_time, &now);
- log_group(ls, "plock_recv_count %u time %.3f s",
+ log_plock(ls, "plock_recv_count %u time %.3f s",
plock_recv_count, usec * 1.e-6);
plock_recv_time = now;
}
@@ -820,8 +821,8 @@ static void _receive_plock(struct lockspace *ls, struct dlm_header *hd, int len)
return;
if (from != hd->nodeid || from != info.nodeid) {
- log_error("receive_plock from %d header %d info %d",
- from, hd->nodeid, info.nodeid);
+ log_plock_error(ls, "receive_plock error from %d header %d info %d",
+ from, hd->nodeid, info.nodeid);
return;
}
@@ -835,7 +836,7 @@ static void _receive_plock(struct lockspace *ls, struct dlm_header *hd, int len)
who sent the plock, we need to send_own() and put it on the
pending list to resend once the owner is established. */
- log_debug("receive_plock from %d no r %llx", from,
+ log_plock(ls, "receive_plock from %d no r %llx", from,
(unsigned long long)info.number);
if (from != our_nodeid)
@@ -852,8 +853,8 @@ static void _receive_plock(struct lockspace *ls, struct dlm_header *hd, int len)
/* r not found, rv is -ENOENT, this shouldn't happen because
process_plocks() creates a resource for every op */
- log_error("receive_plock from %d no r %llx %d", from,
- (unsigned long long)info.number, rv);
+ log_plock_error(ls, "receive_plock error from %d no r %llx %d",
+ from, (unsigned long long)info.number, rv);
return;
}
@@ -883,23 +884,21 @@ static void _receive_plock(struct lockspace *ls, struct dlm_header *hd, int len)
__receive_plock(ls, &info, from, r);
} else if (r->owner == -1) {
- log_debug("receive_plock from %d r %llx owner %d", from,
+ log_plock(ls, "receive_plock from %d r %llx owner %d", from,
(unsigned long long)info.number, r->owner);
if (from == our_nodeid)
save_pending_plock(ls, r, &info);
} else if (r->owner != our_nodeid) {
- /* might happen, if frequent change to log_debug */
- log_error("receive_plock from %d r %llx owner %d", from,
+ log_plock(ls, "receive_plock from %d r %llx owner %d", from,
(unsigned long long)info.number, r->owner);
if (from == our_nodeid)
save_pending_plock(ls, r, &info);
} else if (r->owner == our_nodeid) {
- /* might happen, if frequent change to log_debug */
- log_error("receive_plock from %d r %llx owner %d", from,
+ log_plock(ls, "receive_plock from %d r %llx owner %d", from,
(unsigned long long)info.number, r->owner);
if (from == our_nodeid)
@@ -944,7 +943,7 @@ static int send_struct_info(struct lockspace *ls, struct dlm_plock_info *in,
free(buf);
out:
if (rv)
- log_error("send_struct_info error %d", rv);
+ log_plock_error(ls, "send_struct_info error %d", rv);
return rv;
}
@@ -962,7 +961,7 @@ static void send_own(struct lockspace *ls, struct resource *r, int owner)
(pending list is not empty), then we shouldn't send another */
if (!list_empty(&r->pending)) {
- log_debug("send_own %llx already pending",
+ log_plock(ls, "send_own %llx already pending",
(unsigned long long)r->number);
return;
}
@@ -1031,7 +1030,7 @@ static void save_pending_plock(struct lockspace *ls, struct resource *r,
w = malloc(sizeof(struct lock_waiter));
if (!w) {
- log_error("save_pending_plock no mem");
+ log_plock_error(ls, "save_pending_plock no mem");
return;
}
memcpy(&w->info, in, sizeof(struct dlm_plock_info));
@@ -1077,7 +1076,7 @@ static void _receive_own(struct lockspace *ls, struct dlm_header *hd, int len)
memcpy(&info, (char *)hd + sizeof(struct dlm_header), sizeof(info));
info_bswap_in(&info);
- log_plock(ls, "receive own %llx from %u owner %u",
+ log_plock(ls, "receive_own %llx from %u owner %u",
(unsigned long long)info.number, hd->nodeid, info.nodeid);
rv = find_resource(ls, info.number, 1, &r);
@@ -1180,9 +1179,10 @@ static void _receive_own(struct lockspace *ls, struct dlm_header *hd, int len)
}
if (should_not_happen) {
- log_error("receive_own from %u %llx info nodeid %d r owner %d",
- from, (unsigned long long)r->number, info.nodeid,
- r->owner);
+ log_plock_error(ls, "receive_own error from %u %llx "
+ "info nodeid %d r owner %d",
+ from, (unsigned long long)r->number,
+ info.nodeid, r->owner);
}
}
@@ -1196,7 +1196,8 @@ void receive_own(struct lockspace *ls, struct dlm_header *hd, int len)
_receive_own(ls, hd, len);
}
-static void clear_syncing_flag(struct resource *r, struct dlm_plock_info *in)
+static void clear_syncing_flag(struct lockspace *ls, struct resource *r,
+ struct dlm_plock_info *in)
{
struct posix_lock *po;
struct lock_waiter *w;
@@ -1227,10 +1228,14 @@ static void clear_syncing_flag(struct resource *r, struct dlm_plock_info *in)
}
}
- log_error("clear_syncing %llx no match %s %llx-%llx %d/%u/%llx",
- (unsigned long long)r->number, in->ex ? "WR" : "RD",
- (unsigned long long)in->start, (unsigned long long)in->end,
- in->nodeid, in->pid, (unsigned long long)in->owner);
+ log_plock_error(ls, "clear_syncing error %llx no match %s %llx-%llx "
+ "%d/%u/%llx",
+ (unsigned long long)r->number,
+ in->ex ? "WR" : "RD",
+ (unsigned long long)in->start,
+ (unsigned long long)in->end,
+ in->nodeid, in->pid,
+ (unsigned long long)in->owner);
}
static void _receive_sync(struct lockspace *ls, struct dlm_header *hd, int len)
@@ -1250,13 +1255,14 @@ static void _receive_sync(struct lockspace *ls, struct dlm_header *hd, int len)
rv = find_resource(ls, info.number, 0, &r);
if (rv) {
- log_error("receive_sync no r %llx from %d", info.number, from);
+ log_plock_error(ls, "receive_sync error no r %llx from %d",
+ info.number, from);
return;
}
if (from == our_nodeid) {
/* this plock now in sync on all nodes */
- clear_syncing_flag(r, &info);
+ clear_syncing_flag(ls, r, &info);
return;
}
@@ -1287,13 +1293,13 @@ static void _receive_drop(struct lockspace *ls, struct dlm_header *hd, int len)
memcpy(&info, (char *)hd + sizeof(struct dlm_header), sizeof(info));
info_bswap_in(&info);
- log_plock(ls, "receive drop %llx from %u",
+ log_plock(ls, "receive_drop %llx from %u",
(unsigned long long)info.number, from);
rv = find_resource(ls, info.number, 0, &r);
if (rv) {
/* we'll find no r if two nodes sent drop at once */
- log_debug("receive_drop from %d no r %llx", from,
+ log_plock(ls, "receive_drop from %d no r %llx", from,
(unsigned long long)info.number);
return;
}
@@ -1304,15 +1310,15 @@ static void _receive_drop(struct lockspace *ls, struct dlm_header *hd, int len)
- A sent drop, B sent drop, receive drop A, A sent own,
receive own A, receive drop B (this warning on all,
owner A) */
- log_debug("receive_drop from %d r %llx owner %d", from,
+ log_plock(ls, "receive_drop from %d r %llx owner %d", from,
(unsigned long long)r->number, r->owner);
return;
}
if (!list_empty(&r->pending)) {
/* shouldn't happen */
- log_error("receive_drop from %d r %llx pending op", from,
- (unsigned long long)r->number);
+ log_plock_error(ls, "receive_drop error from %d r %llx pending op",
+ from, (unsigned long long)r->number);
return;
}
@@ -1324,7 +1330,7 @@ static void _receive_drop(struct lockspace *ls, struct dlm_header *hd, int len)
free(r);
} else {
/* A sent drop, B sent a plock, receive plock, receive drop */
- log_debug("receive_drop from %d r %llx in use", from,
+ log_plock(ls, "receive_drop from %d r %llx in use", from,
(unsigned long long)r->number);
}
}
@@ -1478,7 +1484,7 @@ void process_plocks(int ci)
ls = find_ls_id(info.fsid);
if (!ls) {
- log_debug("process_plocks: no ls id %x", info.fsid);
+ log_plock(ls, "process_plocks: no ls id %x", info.fsid);
rv = -EEXIST;
goto fail;
}
@@ -1495,7 +1501,7 @@ void process_plocks(int ci)
plock_read_count++;
if (!(plock_read_count % 1000)) {
usec = dt_usec(&plock_read_time, &now) ;
- log_group(ls, "plock_read_count %u time %.3f s delays %u",
+ log_plock(ls, "plock_read_count %u time %.3f s delays %u",
plock_read_count, usec * 1.e-6, plock_rate_delays);
plock_read_time = now;
plock_rate_delays = 0;
@@ -1538,7 +1544,7 @@ void process_saved_plocks(struct lockspace *ls)
if (list_empty(&ls->saved_messages))
return;
- log_group(ls, "process_saved_plocks");
+ log_plock(ls, "process_saved_plocks");
list_for_each_entry_safe(sm, sm2, &ls->saved_messages, list) {
hd = (struct dlm_header *)sm->buf;
@@ -1908,8 +1914,8 @@ void store_plocks(struct lockspace *ls)
else if (!r->owner)
owner = 0;
else {
- log_error("store_plocks owner %d r %llx", r->owner,
- (unsigned long long)r->number);
+ log_plock_error(ls, "store_plocks error owner %d r %llx",
+ r->owner, (unsigned long long)r->number);
continue;
}
@@ -1927,7 +1933,7 @@ void store_plocks(struct lockspace *ls)
pack_section_buf(ls, r);
- log_group(ls, "store_plocks: section size %u id %u \"%s\"",
+ log_plock(ls, "store_plocks: section size %u id %u \"%s\"",
section_len, section_id.idLen, buf);
create_retry:
@@ -2035,7 +2041,7 @@ void retrieve_plocks(struct lockspace *ls)
memset(&buf, 0, sizeof(buf));
snprintf(buf, SECTION_NAME_LEN, "%s", desc.sectionId.id);
- log_group(ls, "retrieve_plocks: section size %llu id %u \"%s\"",
+ log_plock(ls, "retrieve_plocks: section size %llu id %u \"%s\"",
(unsigned long long)iov.dataSize, iov.sectionId.idLen,
buf);
@@ -2056,7 +2062,7 @@ void retrieve_plocks(struct lockspace *ls)
no locks, which exist in ownership mode; the resource
name and owner come from the section id */
- log_group(ls, "retrieve_plocks: ckpt read %llu bytes",
+ log_plock(ls, "retrieve_plocks: ckpt read %llu bytes",
(unsigned long long)iov.readSize);
section_len = iov.readSize;
@@ -2129,7 +2135,7 @@ void purge_plocks(struct lockspace *ls, int nodeid, int unmount)
if (purged)
ls->last_plock_time = time(NULL);
- log_group(ls, "purged %d plocks for %d", purged, nodeid);
+ log_plock(ls, "purged %d plocks for %d", purged, nodeid);
}
int fill_plock_dump_buf(struct lockspace *ls)
14 years, 1 month
cluster: STABLE3 - cman: Add improved cluster_id hash function
by Christine Caulfield
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 814faae67c226f6ac9e99438096696479c8aaf2e
Parent: e23761e752f496399c51d74c557f302378eb1427
Author: Christine Caulfield <ccaulfie(a)redhat.com>
AuthorDate: Fri Mar 19 13:57:50 2010 +0000
Committer: Christine Caulfield <ccaulfie(a)redhat.com>
CommitterDate: Fri Mar 19 13:57:50 2010 +0000
cman: Add improved cluster_id hash function
Add a new and vastly improved function for converting the cluster name
into a 16bit ID. This is currently disabled by default but can be enabled
with the stanza
<cman hash_cluster_id="yes"/>
in cluster.conf
We might make this the default in future .. watch this space. Or some space
closely related to this one that's less intimidating to read on a Friday
afternoon before you've had tea.
Thanks to Steven Dake for finding and slightly modifying the hash function.
Signed-off-by: Christine Caulfield <ccaulfie(a)redhat.com>
---
cman/daemon/cman-preconfig.c | 119 ++++++++++++++++++++++++++++++++++++++++--
1 files changed, 115 insertions(+), 4 deletions(-)
diff --git a/cman/daemon/cman-preconfig.c b/cman/daemon/cman-preconfig.c
index f27effa..3339f1d 100644
--- a/cman/daemon/cman-preconfig.c
+++ b/cman/daemon/cman-preconfig.c
@@ -49,6 +49,7 @@ static char *mcast_name;
static char *cluster_name;
static char error_reason[1024] = { '\0' };
static hdb_handle_t cluster_parent_handle;
+static int use_hashed_cluster_id = 0;
/*
* Exports the interface for the service
@@ -283,6 +284,99 @@ static int add_ifaddr(struct objdb_iface_ver0 *objdb, char *mcast, char *ifaddr,
return ret;
}
+
+/***
+ *
+ * Fowler/Noll/Vo hash
+ *
+ * The basis of this hash algorithm was taken from an idea sent
+ * as reviewer comments to the IEEE POSIX P1003.2 committee by:
+ *
+ * Phong Vo (http://www.research.att.com/info/kpv/)
+ * Glenn Fowler (http://www.research.att.com/~gsf/)
+ *
+ * In a subsequent ballot round:
+ *
+ * Landon Curt Noll (http://www.isthe.com/chongo/)
+ *
+ * improved on their algorithm. Some people tried this hash
+ * and found that it worked rather well. In an EMail message
+ * to Landon, they named it the ``Fowler/Noll/Vo'' or FNV hash.
+ *
+ * FNV hashes are designed to be fast while maintaining a low
+ * collision rate. The FNV speed allows one to quickly hash lots
+ * of data while maintaining a reasonable collision rate. See:
+ *
+ * http://www.isthe.com/chongo/tech/comp/fnv/index.html
+ *
+ * for more details as well as other forms of the FNV hash.
+ ***
+ *
+ * To use the recommended 32 bit FNV-1a hash, pass FNV1_32A_INIT as the
+ * Fnv32_t hashval argument to fnv_32a_buf() or fnv_32a_str().
+ *
+ ***
+ *
+ * Please do not copyright this code. This code is in the public domain.
+ *
+ * LANDON CURT NOLL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO
+ * EVENT SHALL LANDON CURT NOLL BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
+ * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
+ * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ *
+ * By:
+ * chongo <Landon Curt Noll> /\oo/\
+ * http://www.isthe.com/chongo/
+ *
+ * Share and Enjoy! :-)
+ */
+
+/*
+ * Modified to be a little more simple to understand and to provide a 16 bit
+ * value rather then 32 bit for cluster id generation
+ *
+ * sdake(a)redhat.com
+ */
+
+/* 32 bit magic FNV-1a prime */
+#define FNV_32_PRIME ((uint32_t)0x01000193)
+
+/* Default initialization for FNV-1a */
+#define FNV_32_INIT ((uint32_t)0x811c9dc5)
+
+static uint16_t generate_hashed_cluster_id(char *str)
+{
+ unsigned char *s = (unsigned char *)str;
+ uint32_t hval = FNV_32_INIT;
+ uint32_t ret;
+
+ /*
+ * FNV-1a hash each octet in the buffer
+ */
+ while (*s) {
+ /*
+ * xor the bottom with the current octet
+ */
+ hval ^= (uint32_t)*s++;
+ /*
+ * multiply by the 32 bit FNV magic prime mod 2^32
+ */
+ hval *= FNV_32_PRIME;
+ }
+
+ /*
+ * Use XOR folding as recommended by authors of algorithm
+ * to create a different hash size that is a power of two
+ */
+ ret = (hval >> 16) ^ (hval & 0xFFFF);
+
+ sprintf(error_reason, "Generated hashed cluster id for '%s' is %d\n", str, ret);
+ return (ret);
+}
+
static uint16_t generate_cluster_id(char *name)
{
int i;
@@ -916,8 +1010,12 @@ static int set_noccs_defaults(struct objdb_iface_ver0 *objdb)
return -1;
}
- if (!cluster_id)
- cluster_id = generate_cluster_id(cluster_name);
+ if (!cluster_id) {
+ if (use_hashed_cluster_id)
+ cluster_id = generate_hashed_cluster_id(cluster_name);
+ else
+ cluster_id = generate_cluster_id(cluster_name);
+ }
if (!nodename_env) {
int error;
@@ -1084,6 +1182,7 @@ static int get_cman_globals(struct objdb_iface_ver0 *objdb)
{
hdb_handle_t object_handle;
hdb_handle_t find_handle;
+ char *use_hash;
objdb_get_string(objdb, cluster_parent_handle, "name", &cluster_name);
@@ -1096,11 +1195,21 @@ static int get_cman_globals(struct objdb_iface_ver0 *objdb)
if (!key_filename)
objdb_get_string(objdb, object_handle, "keyfile", &key_filename);
+ objdb_get_string(objdb, object_handle, "hash_cluster_id", &use_hash);
+ if (use_hash) {
+ if (strncasecmp(use_hash, "yes", 3) == 0 || strncasecmp(use_hash, "on", 2) == 0)
+ use_hashed_cluster_id = 1;
+ }
+
if (!cluster_id)
objdb_get_int(objdb, object_handle, "cluster_id", &cluster_id, 0);
- if (!cluster_id)
- cluster_id = generate_cluster_id(cluster_name);
+ if (!cluster_id) {
+ if (use_hashed_cluster_id)
+ cluster_id = generate_hashed_cluster_id(cluster_name);
+ else
+ cluster_id = generate_cluster_id(cluster_name);
+ }
}
objdb->object_find_destroy(find_handle);
return 0;
@@ -1202,6 +1311,8 @@ static void setup_old_compat(struct objdb_iface_ver0 *objdb, hdb_handle_t cluste
hdb_handle_t totem_handle;
hdb_handle_t gfs_handle;
char *value;
+
+ use_hashed_cluster_id = 0;
/* Set groupd to backwards compatibility mode */
groupd_handle = find_or_create_object(objdb, "group", cluster_handle);
14 years, 1 month
cluster: STABLE3 - GFS2: fsck.gfs2 segfault - osi_tree "each_safe" patch
by Bob Peterson
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: e23761e752f496399c51d74c557f302378eb1427
Parent: 11f4970cfaa3f7448a0f1c78f1e9ce4bd2fb43df
Author: Bob Peterson <rpeterso(a)redhat.com>
AuthorDate: Wed Mar 17 09:46:09 2010 -0500
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Wed Mar 17 09:46:09 2010 -0500
GFS2: fsck.gfs2 segfault - osi_tree "each_safe" patch
There are a few places in fsck.gfs2 where each element of the
new rbtrees are processed. Some of those places delete
items from the rbtree, which means I need to use the equivalent
of osi_list_foreach_safe. In other words, I needed to prevent
rbtree deletes from interfering with the next() function.
The result was a segfault in fsck.gfs2 in a few places. This
patch implements the "safe" rbtree traversal and fixes the problem.
rhbz#574215
---
gfs2/fsck/link.c | 2 --
gfs2/fsck/pass1b.c | 10 ++++++----
gfs2/fsck/pass3.c | 5 +++--
gfs2/fsck/pass4.c | 5 +++--
4 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/gfs2/fsck/link.c b/gfs2/fsck/link.c
index 0314074..5bb3ae2 100644
--- a/gfs2/fsck/link.c
+++ b/gfs2/fsck/link.c
@@ -67,8 +67,6 @@ int decrement_link(uint64_t inode_no, uint64_t referenced_from,
ii = inodetree_find(inode_no);
/* If the list has entries, look for one that matches
* inode_no */
- log_err( _("Decrementing %"PRIu64" (0x%" PRIx64 ") to %d\n"),
- inode_no, inode_no, ii->counted_links);
if(ii) {
ii->counted_links--;
log_debug( _("Directory %lld (0x%llx) decremented counted "
diff --git a/gfs2/fsck/pass1b.c b/gfs2/fsck/pass1b.c
index 5554325..680eb38 100644
--- a/gfs2/fsck/pass1b.c
+++ b/gfs2/fsck/pass1b.c
@@ -168,12 +168,13 @@ static int find_dentry(struct gfs2_inode *ip, struct gfs2_dirent *de,
struct gfs2_buffer_head *bh, char *filename,
uint16_t *count, void *priv)
{
- struct osi_node *n;
+ struct osi_node *n, *next = NULL;
osi_list_t *tmp2;
struct duptree *b;
int found;
- for (n = osi_first(&dup_blocks); n; n = osi_next(n)) {
+ for (n = osi_first(&dup_blocks); n; n = next) {
+ next = osi_next(n);
b = (struct duptree *)n;
found = 0;
osi_list_foreach(tmp2, &b->ref_invinode_list) {
@@ -600,7 +601,7 @@ int pass1b(struct gfs2_sbd *sbp)
struct duptree *b;
uint64_t i;
uint8_t q;
- struct osi_node *n;
+ struct osi_node *n, *next = NULL;
int rc = FSCK_OK;
log_info( _("Looking for duplicate blocks...\n"));
@@ -650,7 +651,8 @@ int pass1b(struct gfs2_sbd *sbp)
* it later */
log_info( _("Handling duplicate blocks\n"));
out:
- for (n = osi_first(&dup_blocks); n; n = osi_next(n)) {
+ for (n = osi_first(&dup_blocks); n; n = next) {
+ next = osi_next(n);
b = (struct duptree *)n;
if (!skip_this_pass && !rc) /* no error & not asked to skip the rest */
handle_dup_blk(sbp, b);
diff --git a/gfs2/fsck/pass3.c b/gfs2/fsck/pass3.c
index a15c63f..e1fe5a5 100644
--- a/gfs2/fsck/pass3.c
+++ b/gfs2/fsck/pass3.c
@@ -172,7 +172,7 @@ static struct dir_info *mark_and_return_parent(struct gfs2_sbd *sbp,
*/
int pass3(struct gfs2_sbd *sbp)
{
- struct osi_node *tmp;
+ struct osi_node *tmp, *next = NULL;
struct dir_info *di, *tdi;
struct gfs2_inode *ip;
uint8_t q;
@@ -193,7 +193,8 @@ int pass3(struct gfs2_sbd *sbp)
* find a parent, put in lost+found.
*/
log_info( _("Checking directory linkage.\n"));
- for (tmp = osi_first(&dirtree); tmp; tmp = osi_next(tmp)) {
+ for (tmp = osi_first(&dirtree); tmp; tmp = next) {
+ next = osi_next(tmp);
di = (struct dir_info *)tmp;
while(!di->checked) {
/* FIXME: Change this so it returns success or
diff --git a/gfs2/fsck/pass4.c b/gfs2/fsck/pass4.c
index d79f8e5..0fd0aac 100644
--- a/gfs2/fsck/pass4.c
+++ b/gfs2/fsck/pass4.c
@@ -40,7 +40,7 @@ static int fix_link_count(struct inode_info *ii, struct gfs2_inode *ip)
}
static int scan_inode_list(struct gfs2_sbd *sbp) {
- struct osi_node *tmp;
+ struct osi_node *tmp, *next = NULL;
struct inode_info *ii;
struct gfs2_inode *ip;
int lf_addition = 0;
@@ -48,9 +48,10 @@ static int scan_inode_list(struct gfs2_sbd *sbp) {
/* FIXME: should probably factor this out into a generic
* scanning fxn */
- for (tmp = osi_first(&inodetree); tmp; tmp = osi_next(tmp)) {
+ for (tmp = osi_first(&inodetree); tmp; tmp = next) {
if (skip_this_pass || fsck_abort) /* if asked to skip the rest */
return 0;
+ next = osi_next(tmp);
if(!(ii = (struct inode_info *)tmp)) {
log_crit( _("osi_tree broken in scan_info_list!!\n"));
exit(FSCK_ERROR);
14 years, 1 month
gfs2-utils: master - GFS2: fsck.gfs2 segfault - osi_tree "each_safe" patch
by Bob Peterson
Gitweb: http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitd...
Commit: 4b29c515f2c2e22c55a6c3a0de0e219adbb6275a
Parent: 3c4002c3101cb5e893295408fb819f77c285b6d0
Author: Bob Peterson <rpeterso(a)redhat.com>
AuthorDate: Wed Mar 17 09:46:09 2010 -0500
Committer: Bob Peterson <rpeterso(a)redhat.com>
CommitterDate: Wed Mar 17 09:52:08 2010 -0500
GFS2: fsck.gfs2 segfault - osi_tree "each_safe" patch
There are a few places in fsck.gfs2 where each element of the
new rbtrees are processed. Some of those places delete
items from the rbtree, which means I need to use the equivalent
of osi_list_foreach_safe. In other words, I needed to prevent
rbtree deletes from interfering with the next() function.
The result was a segfault in fsck.gfs2 in a few places. This
patch implements the "safe" rbtree traversal and fixes the problem.
rhbz#574215
---
gfs2/fsck/link.c | 2 --
gfs2/fsck/pass1b.c | 10 ++++++----
gfs2/fsck/pass3.c | 5 +++--
gfs2/fsck/pass4.c | 5 +++--
4 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/gfs2/fsck/link.c b/gfs2/fsck/link.c
index 0996fa9..9b518a8 100644
--- a/gfs2/fsck/link.c
+++ b/gfs2/fsck/link.c
@@ -69,8 +69,6 @@ int decrement_link(uint64_t inode_no, uint64_t referenced_from,
ii = inodetree_find(inode_no);
/* If the list has entries, look for one that matches
* inode_no */
- log_err( _("Decrementing %"PRIu64" (0x%" PRIx64 ") to %d\n"),
- inode_no, inode_no, ii->counted_links);
if(ii) {
ii->counted_links--;
log_debug( _("Directory %lld (0x%llx) decremented counted "
diff --git a/gfs2/fsck/pass1b.c b/gfs2/fsck/pass1b.c
index 29f98e0..c3290c2 100644
--- a/gfs2/fsck/pass1b.c
+++ b/gfs2/fsck/pass1b.c
@@ -170,12 +170,13 @@ static int find_dentry(struct gfs2_inode *ip, struct gfs2_dirent *de,
struct gfs2_buffer_head *bh, char *filename,
uint16_t *count, void *priv)
{
- struct osi_node *n;
+ struct osi_node *n, *next = NULL;
osi_list_t *tmp2;
struct duptree *b;
int found;
- for (n = osi_first(&dup_blocks); n; n = osi_next(n)) {
+ for (n = osi_first(&dup_blocks); n; n = next) {
+ next = osi_next(n);
b = (struct duptree *)n;
found = 0;
osi_list_foreach(tmp2, &b->ref_invinode_list) {
@@ -602,7 +603,7 @@ int pass1b(struct gfs2_sbd *sbp)
struct duptree *b;
uint64_t i;
uint8_t q;
- struct osi_node *n;
+ struct osi_node *n, *next = NULL;
int rc = FSCK_OK;
log_info( _("Looking for duplicate blocks...\n"));
@@ -652,7 +653,8 @@ int pass1b(struct gfs2_sbd *sbp)
* it later */
log_info( _("Handling duplicate blocks\n"));
out:
- for (n = osi_first(&dup_blocks); n; n = osi_next(n)) {
+ for (n = osi_first(&dup_blocks); n; n = next) {
+ next = osi_next(n);
b = (struct duptree *)n;
if (!skip_this_pass && !rc) /* no error & not asked to skip the rest */
handle_dup_blk(sbp, b);
diff --git a/gfs2/fsck/pass3.c b/gfs2/fsck/pass3.c
index bd583df..50b15da 100644
--- a/gfs2/fsck/pass3.c
+++ b/gfs2/fsck/pass3.c
@@ -174,7 +174,7 @@ static struct dir_info *mark_and_return_parent(struct gfs2_sbd *sbp,
*/
int pass3(struct gfs2_sbd *sbp)
{
- struct osi_node *tmp;
+ struct osi_node *tmp, *next = NULL;
struct dir_info *di, *tdi;
struct gfs2_inode *ip;
uint8_t q;
@@ -195,7 +195,8 @@ int pass3(struct gfs2_sbd *sbp)
* find a parent, put in lost+found.
*/
log_info( _("Checking directory linkage.\n"));
- for (tmp = osi_first(&dirtree); tmp; tmp = osi_next(tmp)) {
+ for (tmp = osi_first(&dirtree); tmp; tmp = next) {
+ next = osi_next(tmp);
di = (struct dir_info *)tmp;
while(!di->checked) {
/* FIXME: Change this so it returns success or
diff --git a/gfs2/fsck/pass4.c b/gfs2/fsck/pass4.c
index 9db27d9..da98523 100644
--- a/gfs2/fsck/pass4.c
+++ b/gfs2/fsck/pass4.c
@@ -42,7 +42,7 @@ static int fix_link_count(struct inode_info *ii, struct gfs2_inode *ip)
}
static int scan_inode_list(struct gfs2_sbd *sbp) {
- struct osi_node *tmp;
+ struct osi_node *tmp, *next = NULL;
struct inode_info *ii;
struct gfs2_inode *ip;
int lf_addition = 0;
@@ -50,9 +50,10 @@ static int scan_inode_list(struct gfs2_sbd *sbp) {
/* FIXME: should probably factor this out into a generic
* scanning fxn */
- for (tmp = osi_first(&inodetree); tmp; tmp = osi_next(tmp)) {
+ for (tmp = osi_first(&inodetree); tmp; tmp = next) {
if (skip_this_pass || fsck_abort) /* if asked to skip the rest */
return 0;
+ next = osi_next(tmp);
if(!(ii = (struct inode_info *)tmp)) {
log_crit( _("osi_tree broken in scan_info_list!!\n"));
exit(FSCK_ERROR);
14 years, 1 month
cluster: RHEL55 - fencing: SNMP fence agents don't fail
by Jan Friesse
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 78e7ffd2488b53e627482e78d9f7a23d0b4ba514
Parent: e685b407d5fa266bc99563932b2336aff2489363
Author: Jan Friesse <jfriesse(a)redhat.com>
AuthorDate: Tue Mar 16 13:43:06 2010 +0100
Committer: Jan Friesse <jfriesse(a)redhat.com>
CommitterDate: Tue Mar 16 13:47:53 2010 +0100
fencing: SNMP fence agents don't fail
Net-SNMP command-line utilities have interesting "feature"
causing too short pass-phrase (shorter then 8 characters)
write error but sadly, not return error code. In such case,
fencing can be considered successful even if it is not.
Patch fixes this by:
- Pass v3 options only for v3 mode
- Search for Error string in snmpcmd output
RHBZ#573834
---
fence/agents/lib/fencing_snmp.py.py | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/fence/agents/lib/fencing_snmp.py.py b/fence/agents/lib/fencing_snmp.py.py
index 1519457..1146222 100644
--- a/fence/agents/lib/fencing_snmp.py.py
+++ b/fence/agents/lib/fencing_snmp.py.py
@@ -58,12 +58,20 @@ class FencingSnmp:
self.complete_missed_params()
#mapping from our option to snmpcmd option
- mapping=(('d','v'), ('c','c'),('b','a'),('E','l'),('B','x'),('P','X'),('p','A'),('l','u'))
+ mapping=(('d','v'),('c','c'))
for item in mapping:
if (self.options.has_key("-"+item[0])):
cmd+=" -%s '%s'"%(item[1],self.quote_for_run(self.options["-"+item[0]]))
+ # Some options make sense only for v3 (and for v1/2c can cause "problems")
+ if (self.options.has_key("-d")) and (self.options["-d"] == "3"):
+ # Mapping from our options to snmpcmd options for v3
+ mapping_v3=(('b','a'),('E','l'),('B','x'),('P','X'),('p','A'),('l','u'))
+ for item in mapping_v3:
+ if (self.options.has_key("-"+item[0])):
+ cmd+=" -%s '%s'"%(item[1],self.quote_for_run(self.options["-"+item[0]]))
+
force_ipvx=""
if (self.options.has_key("-6")):
@@ -86,7 +94,8 @@ class FencingSnmp:
fail(EC_TIMED_OUT)
self.log_command(res_output)
- if (res_code!=0):
+
+ if (res_code!=0) or (re.search("^Error ", res_output, re.MULTILINE) != None):
fail_usage("Returned %d: %s"%(res_code,res_output))
except pexpect.ExceptionPexpect:
fail_usage("Cannot run command %s"%(command))
14 years, 1 month
cluster: STABLE3 - fencing: SNMP fence agents don't fail
by Jan Friesse
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=...
Commit: 11f4970cfaa3f7448a0f1c78f1e9ce4bd2fb43df
Parent: ab02e00776c03abec5669869d58e2b77205fc993
Author: Jan Friesse <jfriesse(a)redhat.com>
AuthorDate: Tue Mar 16 13:46:35 2010 +0100
Committer: Jan Friesse <jfriesse(a)redhat.com>
CommitterDate: Tue Mar 16 13:46:35 2010 +0100
fencing: SNMP fence agents don't fail
Net-SNMP command-line utilities have interesting "feature"
causing too short pass-phrase (shorter then 8 characters)
write error but sadly, not return error code. In such case,
fencing can be considered successful even if it is not.
Patch fixes this by:
- Pass v3 options only for v3 mode
- Search for Error string in snmpcmd output
RHBZ#574027
---
fence/agents/lib/fencing_snmp.py.py | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/fence/agents/lib/fencing_snmp.py.py b/fence/agents/lib/fencing_snmp.py.py
index 94f5af5..4f55795 100644
--- a/fence/agents/lib/fencing_snmp.py.py
+++ b/fence/agents/lib/fencing_snmp.py.py
@@ -58,12 +58,20 @@ class FencingSnmp:
self.complete_missed_params()
#mapping from our option to snmpcmd option
- mapping=(('d','v'), ('c','c'),('b','a'),('E','l'),('B','x'),('P','X'),('p','A'),('l','u'))
+ mapping=(('d','v'),('c','c'))
for item in mapping:
if (self.options.has_key("-"+item[0])):
cmd+=" -%s '%s'"%(item[1],self.quote_for_run(self.options["-"+item[0]]))
+ # Some options make sense only for v3 (and for v1/2c can cause "problems")
+ if (self.options.has_key("-d")) and (self.options["-d"] == "3"):
+ # Mapping from our options to snmpcmd options for v3
+ mapping_v3=(('b','a'),('E','l'),('B','x'),('P','X'),('p','A'),('l','u'))
+ for item in mapping_v3:
+ if (self.options.has_key("-"+item[0])):
+ cmd+=" -%s '%s'"%(item[1],self.quote_for_run(self.options["-"+item[0]]))
+
force_ipvx=""
if (self.options.has_key("-6")):
@@ -86,7 +94,8 @@ class FencingSnmp:
fail(EC_TIMED_OUT)
self.log_command(res_output)
- if (res_code!=0):
+
+ if (res_code!=0) or (re.search("^Error ", res_output, re.MULTILINE) != None):
fail_usage("Returned %d: %s"%(res_code,res_output))
except pexpect.ExceptionPexpect:
fail_usage("Cannot run command %s"%(command))
14 years, 1 month
fence-agents: master - fencing: SNMP fence agents don't fail
by Jan Friesse
Gitweb: http://git.fedorahosted.org/git/fence-agents.git?p=fence-agents.git;a=com...
Commit: fa9d0561d813b2d2002623e0aad665a5949fcc59
Parent: 928565680d90fea362c00a2883abc4d8578a4787
Author: Jan Friesse <jfriesse(a)redhat.com>
AuthorDate: Tue Mar 16 11:12:30 2010 +0100
Committer: Jan Friesse <jfriesse(a)redhat.com>
CommitterDate: Tue Mar 16 11:12:30 2010 +0100
fencing: SNMP fence agents don't fail
Net-SNMP command-line utilities have interesting "feature"
causing too short pass-phrase (shorter then 8 characters)
write error but sadly, not return error code. In such case,
fencing can be considered successful even if it is not.
Patch fixes this by:
- Pass v3 options only for v3 mode
- Search for Error string in snmpcmd output
---
fence/agents/lib/fencing_snmp.py.py | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/fence/agents/lib/fencing_snmp.py.py b/fence/agents/lib/fencing_snmp.py.py
index 94f5af5..4f55795 100644
--- a/fence/agents/lib/fencing_snmp.py.py
+++ b/fence/agents/lib/fencing_snmp.py.py
@@ -58,12 +58,20 @@ class FencingSnmp:
self.complete_missed_params()
#mapping from our option to snmpcmd option
- mapping=(('d','v'), ('c','c'),('b','a'),('E','l'),('B','x'),('P','X'),('p','A'),('l','u'))
+ mapping=(('d','v'),('c','c'))
for item in mapping:
if (self.options.has_key("-"+item[0])):
cmd+=" -%s '%s'"%(item[1],self.quote_for_run(self.options["-"+item[0]]))
+ # Some options make sense only for v3 (and for v1/2c can cause "problems")
+ if (self.options.has_key("-d")) and (self.options["-d"] == "3"):
+ # Mapping from our options to snmpcmd options for v3
+ mapping_v3=(('b','a'),('E','l'),('B','x'),('P','X'),('p','A'),('l','u'))
+ for item in mapping_v3:
+ if (self.options.has_key("-"+item[0])):
+ cmd+=" -%s '%s'"%(item[1],self.quote_for_run(self.options["-"+item[0]]))
+
force_ipvx=""
if (self.options.has_key("-6")):
@@ -86,7 +94,8 @@ class FencingSnmp:
fail(EC_TIMED_OUT)
self.log_command(res_output)
- if (res_code!=0):
+
+ if (res_code!=0) or (re.search("^Error ", res_output, re.MULTILINE) != None):
fail_usage("Returned %d: %s"%(res_code,res_output))
except pexpect.ExceptionPexpect:
fail_usage("Cannot run command %s"%(command))
14 years, 1 month