* [Cluster-devel] cluster/group/gfs_controld lock_dlm.h main.c
@ 2006-07-14 18:56 teigland
0 siblings, 0 replies; 3+ messages in thread
From: teigland @ 2006-07-14 18:56 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: cluster
Changes by: teigland at sourceware.org 2006-07-14 18:56:10
Modified files:
group/gfs_controld: lock_dlm.h main.c
Log message:
keep a 1MB circular buffer of debug messages, they can be dumped out
by running 'group_tool dump gfs'
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/gfs_controld/lock_dlm.h.diff?cvsroot=cluster&r1=1.4&r2=1.5
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/gfs_controld/main.c.diff?cvsroot=cluster&r1=1.4&r2=1.5
--- cluster/group/gfs_controld/lock_dlm.h 2006/07/13 21:28:45 1.4
+++ cluster/group/gfs_controld/lock_dlm.h 2006/07/14 18:56:10 1.5
@@ -43,6 +43,7 @@
#define MAX_CLIENTS 8
#define MAX_MSGLEN 2048
#define MAX_OPTIONS_LEN 1024
+#define DUMP_SIZE (1024 * 1024)
#define LOCK_DLM_GROUP_LEVEL 2
#define LOCK_DLM_GROUP_NAME "gfs"
@@ -67,11 +68,17 @@
extern char *prog_name;
extern int daemon_debug_opt;
extern char daemon_debug_buf[256];
+extern char dump_buf[DUMP_SIZE];
+extern int dump_point;
+extern int dump_wrap;
+
+extern void daemon_dump_save(void);
#define log_debug(fmt, args...) \
do { \
snprintf(daemon_debug_buf, 255, "%ld " fmt "\n", time(NULL), ##args); \
if (daemon_debug_opt) fprintf(stderr, "%s", daemon_debug_buf); \
+ daemon_dump_save(); \
} while (0)
#define log_group(g, fmt, args...) \
@@ -79,6 +86,7 @@
snprintf(daemon_debug_buf, 255, "%ld %s " fmt "\n", time(NULL), \
(g)->name, ##args); \
if (daemon_debug_opt) fprintf(stderr, "%s", daemon_debug_buf); \
+ daemon_dump_save(); \
} while (0)
#define log_error(fmt, args...) \
--- cluster/group/gfs_controld/main.c 2006/07/13 21:28:45 1.4
+++ cluster/group/gfs_controld/main.c 2006/07/14 18:56:10 1.5
@@ -125,6 +125,24 @@
return write(client[ci].fd, buf, len);
}
+static int do_dump(int ci)
+{
+ int rv, len;
+
+ if (dump_wrap) {
+ len = DUMP_SIZE - dump_point;
+ rv = write(client[ci].fd, dump_buf + dump_point, len);
+ if (rv != len)
+ log_debug("write error %d errno %d", rv, errno);
+ }
+ len = dump_point;
+
+ rv = write(client[ci].fd, dump_buf, len);
+ if (rv != len)
+ log_debug("write error %d errno %d", rv, errno);
+ return 0;
+}
+
static int process_client(int ci)
{
char *cmd, *dir, *type, *proto, *table, *extra;
@@ -163,7 +181,10 @@
rv = do_unmount(ci, dir);
else if (!strcmp(cmd, "remount"))
rv = do_remount(ci, dir, argv[3]);
- else
+ else if (!strcmp(cmd, "dump")) {
+ do_dump(ci);
+ return 0;
+ } else
rv = -EINVAL;
sprintf(out, "%d", rv);
@@ -492,7 +513,26 @@
return loop();
}
+void daemon_dump_save(void)
+{
+ int len, i;
+
+ len = strlen(daemon_debug_buf);
+
+ for (i = 0; i < len; i++) {
+ dump_buf[dump_point++] = daemon_debug_buf[i];
+
+ if (dump_point == DUMP_SIZE) {
+ dump_point = 0;
+ dump_wrap = 1;
+ }
+ }
+}
+
char *prog_name;
int daemon_debug_opt;
char daemon_debug_buf[256];
+char dump_buf[DUMP_SIZE];
+int dump_point;
+int dump_wrap;
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Cluster-devel] cluster/group/gfs_controld lock_dlm.h main.c
@ 2007-06-12 20:05 teigland
0 siblings, 0 replies; 3+ messages in thread
From: teigland @ 2007-06-12 20:05 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: cluster
Branch: RHEL5
Changes by: teigland at sourceware.org 2007-06-12 20:05:12
Modified files:
group/gfs_controld: lock_dlm.h main.c
Log message:
log an error message if we see mount.gfs killed before it's done
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/gfs_controld/lock_dlm.h.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.21.2.6&r2=1.21.2.7
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/gfs_controld/main.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.18.2.11&r2=1.18.2.12
--- cluster/group/gfs_controld/lock_dlm.h 2006/12/20 19:14:41 1.21.2.6
+++ cluster/group/gfs_controld/lock_dlm.h 2007/06/12 20:05:12 1.21.2.7
@@ -289,6 +289,7 @@
void got_mount_result(struct mountgroup *mg, int result, int ci, int another);
int client_send(int ci, char *buf, int len);
+int get_sysfs(struct mountgroup *mg, char *field, char *buf, int len);
int send_group_message(struct mountgroup *mg, int len, char *buf);
void update_flow_control_status(void);
--- cluster/group/gfs_controld/main.c 2007/04/26 19:01:42 1.18.2.11
+++ cluster/group/gfs_controld/main.c 2007/06/12 20:05:12 1.18.2.12
@@ -39,6 +39,7 @@
extern struct list_head mounts;
extern struct list_head withdrawn_mounts;
+extern group_handle_t gh;
int no_withdraw;
int no_plock;
uint32_t plock_rate_limit = DEFAULT_PLOCK_RATE_LIMIT;
@@ -171,9 +172,66 @@
}
}
+/* I don't think we really want to try to do anything if mount.gfs is killed,
+ because I suspect there are various corner cases where we might not do the
+ right thing. Even without the corner cases things still don't work out
+ too nicely. Best to just tell people not to kill a mount or unmount
+ because doing so can leave things (kernel, group, mtab) in inconsistent
+ states that can't be straightened out properly without a reboot. */
+
+static void mount_client_dead(struct mountgroup *mg, int ci)
+{
+ char buf[MAXLINE];
+ int rv;
+
+ if (ci != mg->mount_client) {
+ log_error("mount client mismatch %d %d", ci, mg->mount_client);
+ return;
+ }
+
+ /* is checking sysfs really a reliable way of telling whether the
+ kernel has been mounted or not? might the kernel mount just not
+ have reached the sysfs registration yet? */
+
+ memset(buf, 0, sizeof(buf));
+
+ rv = get_sysfs(mg, "id", buf, sizeof(buf));
+ if (!rv) {
+ log_error("mount_client_dead ci %d sysfs id %s", ci, buf);
+#if 0
+ /* finish the mount, although there will be no mtab entry
+ which will confuse umount causing it to do the kernel
+ umount but not call umount.gfs */
+ got_mount_result(mg, 0, ci, client[ci].another_mount);
+#endif
+ return;
+ }
+
+ log_error("mount_client_dead ci %d no sysfs entry for fs", ci);
+
+#if 0
+ mp = find_mountpoint_client(mg, ci);
+ if (mp) {
+ list_del(&mp->list);
+ free(mp);
+ }
+ group_leave(gh, mg->name);
+#endif
+}
+
static void client_dead(int ci)
{
+ struct mountgroup *mg;
+
log_debug("client %d fd %d dead", ci, client[ci].fd);
+
+ /* if the dead mount client is mount.gfs and we've not received
+ a mount result, then try to put things into a clean state */
+
+ mg = client[ci].mg;
+ if (mg && mg->mount_client && mg->mount_client_fd)
+ mount_client_dead(mg, ci);
+
close(client[ci].fd);
client[ci].fd = -1;
pollfd[ci].fd = -1;
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Cluster-devel] cluster/group/gfs_controld lock_dlm.h main.c
@ 2007-06-12 20:04 teigland
0 siblings, 0 replies; 3+ messages in thread
From: teigland @ 2007-06-12 20:04 UTC (permalink / raw)
To: cluster-devel.redhat.com
CVSROOT: /cvs/cluster
Module name: cluster
Changes by: teigland at sourceware.org 2007-06-12 20:04:41
Modified files:
group/gfs_controld: lock_dlm.h main.c
Log message:
log an error message if we see mount.gfs killed before it's done
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/gfs_controld/lock_dlm.h.diff?cvsroot=cluster&r1=1.27&r2=1.28
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/gfs_controld/main.c.diff?cvsroot=cluster&r1=1.29&r2=1.30
--- cluster/group/gfs_controld/lock_dlm.h 2006/12/20 19:13:13 1.27
+++ cluster/group/gfs_controld/lock_dlm.h 2007/06/12 20:04:41 1.28
@@ -289,6 +289,7 @@
void got_mount_result(struct mountgroup *mg, int result, int ci, int another);
int client_send(int ci, char *buf, int len);
+int get_sysfs(struct mountgroup *mg, char *field, char *buf, int len);
int send_group_message(struct mountgroup *mg, int len, char *buf);
void update_flow_control_status(void);
--- cluster/group/gfs_controld/main.c 2007/04/26 19:01:34 1.29
+++ cluster/group/gfs_controld/main.c 2007/06/12 20:04:41 1.30
@@ -39,6 +39,7 @@
extern struct list_head mounts;
extern struct list_head withdrawn_mounts;
+extern group_handle_t gh;
int no_withdraw;
int no_plock;
uint32_t plock_rate_limit = DEFAULT_PLOCK_RATE_LIMIT;
@@ -171,9 +172,66 @@
}
}
+/* I don't think we really want to try to do anything if mount.gfs is killed,
+ because I suspect there are various corner cases where we might not do the
+ right thing. Even without the corner cases things still don't work out
+ too nicely. Best to just tell people not to kill a mount or unmount
+ because doing so can leave things (kernel, group, mtab) in inconsistent
+ states that can't be straightened out properly without a reboot. */
+
+static void mount_client_dead(struct mountgroup *mg, int ci)
+{
+ char buf[MAXLINE];
+ int rv;
+
+ if (ci != mg->mount_client) {
+ log_error("mount client mismatch %d %d", ci, mg->mount_client);
+ return;
+ }
+
+ /* is checking sysfs really a reliable way of telling whether the
+ kernel has been mounted or not? might the kernel mount just not
+ have reached the sysfs registration yet? */
+
+ memset(buf, 0, sizeof(buf));
+
+ rv = get_sysfs(mg, "id", buf, sizeof(buf));
+ if (!rv) {
+ log_error("mount_client_dead ci %d sysfs id %s", ci, buf);
+#if 0
+ /* finish the mount, although there will be no mtab entry
+ which will confuse umount causing it to do the kernel
+ umount but not call umount.gfs */
+ got_mount_result(mg, 0, ci, client[ci].another_mount);
+#endif
+ return;
+ }
+
+ log_error("mount_client_dead ci %d no sysfs entry for fs", ci);
+
+#if 0
+ mp = find_mountpoint_client(mg, ci);
+ if (mp) {
+ list_del(&mp->list);
+ free(mp);
+ }
+ group_leave(gh, mg->name);
+#endif
+}
+
static void client_dead(int ci)
{
+ struct mountgroup *mg;
+
log_debug("client %d fd %d dead", ci, client[ci].fd);
+
+ /* if the dead mount client is mount.gfs and we've not received
+ a mount result, then try to put things into a clean state */
+
+ mg = client[ci].mg;
+ if (mg && mg->mount_client && mg->mount_client_fd)
+ mount_client_dead(mg, ci);
+
close(client[ci].fd);
client[ci].fd = -1;
pollfd[ci].fd = -1;
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-06-12 20:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-14 18:56 [Cluster-devel] cluster/group/gfs_controld lock_dlm.h main.c teigland
2007-06-12 20:04 teigland
2007-06-12 20:05 teigland
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.