public inbox for cluster-cvs@sourceware.org help / color / mirror / Atom feed
From: David Teigland <teigland@fedoraproject.org> To: cluster-cvs-relay@redhat.com Subject: master - dlm_controld: enable calls into deadlock code Date: Wed, 05 Nov 2008 22:06:00 -0000 [thread overview] Message-ID: <20081105220504.DF14F120346@lists.fedorahosted.org> (raw) Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=c9d4b193e943a01c171f88a18d586868dacab1f2 Commit: c9d4b193e943a01c171f88a18d586868dacab1f2 Parent: a99e1b740729edfa1b3b40cab24bb9250a71a1e8 Author: David Teigland <teigland@redhat.com> AuthorDate: Wed Nov 5 14:09:15 2008 -0600 Committer: David Teigland <teigland@redhat.com> CommitterDate: Wed Nov 5 15:49:23 2008 -0600 dlm_controld: enable calls into deadlock code for handling a confchg during a deadlock cycle. Also remove some old compat code. Signed-off-by: David Teigland <teigland@redhat.com> --- group/dlm_controld/cpg.c | 6 +-- group/dlm_controld/deadlock.c | 91 ++++----------------------------------- group/dlm_controld/dlm_daemon.h | 5 ++ 3 files changed, 15 insertions(+), 87 deletions(-) diff --git a/group/dlm_controld/cpg.c b/group/dlm_controld/cpg.c index 44bd6eb..50182e4 100644 --- a/group/dlm_controld/cpg.c +++ b/group/dlm_controld/cpg.c @@ -1320,16 +1320,12 @@ static void confchg_cb(cpg_handle_t handle, struct cpg_name *group_name, list_for_each_entry(memb, &cg->removed, list) purge_plocks(ls, memb->nodeid, 0); -#if 0 - /* deadlock code needs to adjust per a confchg, is this the right - way/place for this? */ + apply_changes(ls); deadlk_confchg(ls, member_list, member_list_entries, left_list, left_list_entries, joined_list, joined_list_entries); -#endif - apply_changes(ls); } static void dlm_header_in(struct dlm_header *hd) diff --git a/group/dlm_controld/deadlock.c b/group/dlm_controld/deadlock.c index 9eccaae..853de0e 100644 --- a/group/dlm_controld/deadlock.c +++ b/group/dlm_controld/deadlock.c @@ -148,6 +148,9 @@ void setup_deadlock(void) { SaAisErrorT rv; + if (!cfgd_enable_deadlk) + return; + rv = saCkptInitialize(&global_ckpt_h, &callbacks, &version); if (rv != SA_AIS_OK) log_error("ckpt init error %d", rv); @@ -331,80 +334,6 @@ static void parse_r_name(char *line, char *name) #define LOCK_LINE_MAX 1024 -/* old/original way of dumping (only master state) in 5.1 kernel; - does deadlock detection based on pid instead of xid */ - -static int read_debugfs_master(struct lockspace *ls) -{ - FILE *file; - char path[PATH_MAX]; - char line[LOCK_LINE_MAX]; - struct dlm_rsb *r; - struct dlm_lkb *lkb; - struct pack_lock lock; - char r_name[65]; - unsigned long long xid; - unsigned int waiting; - int r_len; - int rv; - - snprintf(path, PATH_MAX, "/sys/kernel/debug/dlm/%s_master", ls->name); - - file = fopen(path, "r"); - if (!file) - return -1; - - /* skip the header on the first line */ - if (!fgets(line, LOCK_LINE_MAX, file)) { - log_error("Unable to read %s: %d", path, errno); - goto out; - } - - while (fgets(line, LOCK_LINE_MAX, file)) { - memset(&lock, 0, sizeof(struct pack_lock)); - - rv = sscanf(line, "%x %d %x %u %llu %x %hhd %hhd %hhd %u %d", - &lock.id, - &lock.nodeid, - &lock.remid, - &lock.ownpid, - &xid, - &lock.exflags, - &lock.status, - &lock.grmode, - &lock.rqmode, - &waiting, - &r_len); - - if (rv != 11) { - log_error("invalid debugfs line %d: %s", rv, line); - goto out; - } - - memset(r_name, 0, sizeof(r_name)); - parse_r_name(line, r_name); - - r = get_resource(ls, r_name, r_len); - if (!r) - break; - - /* we want lock.xid to be zero before calling add_lock - so it will treat this like the full master copy (not - partial). then set the xid manually at the end to - ownpid (there will be no process copy to merge and - get the xid from in 5.1) */ - - set_copy(&lock); - lkb = add_lock(ls, r, our_nodeid, &lock); - if (!lkb) - break; - lkb->lock.xid = lock.ownpid; - } - out: - fclose(file); - return 0; -} - static int read_debugfs_locks(struct lockspace *ls) { FILE *file; @@ -1037,13 +966,8 @@ void receive_cycle_start(struct lockspace *ls, struct dlm_header *hd, int len) rv = read_debugfs_locks(ls); if (rv < 0) { - /* compat for RHEL5.1 kernels */ - rv = read_debugfs_master(ls); - if (rv < 0) { - log_error("can't read dlm debugfs file: %s", - strerror(errno)); - return; - } + log_error("can't read dlm debugfs file: %s", strerror(errno)); + return; } write_checkpoint(ls); @@ -1151,13 +1075,16 @@ static void node_left(struct lockspace *ls, int nodeid, int reason) static void purge_locks(struct lockspace *ls, int nodeid); -static void deadlk_confchg(struct lockspace *ls, +void deadlk_confchg(struct lockspace *ls, struct cpg_address *member_list, int member_list_entries, struct cpg_address *left_list, int left_list_entries, struct cpg_address *joined_list, int joined_list_entries) { int i; + if (!cfgd_enable_deadlk) + return; + if (!ls->deadlk_confchg_init) { ls->deadlk_confchg_init = 1; for (i = 0; i < member_list_entries; i++) diff --git a/group/dlm_controld/dlm_daemon.h b/group/dlm_controld/dlm_daemon.h index a84f541..ef8ee36 100644 --- a/group/dlm_controld/dlm_daemon.h +++ b/group/dlm_controld/dlm_daemon.h @@ -260,6 +260,11 @@ void receive_checkpoint_ready(struct lockspace *ls, struct dlm_header *hd, void receive_cycle_start(struct lockspace *ls, struct dlm_header *hd, int len); void receive_cycle_end(struct lockspace *ls, struct dlm_header *hd, int len); void receive_cancel_lock(struct lockspace *ls, struct dlm_header *hd, int len); +void deadlk_confchg(struct lockspace *ls, + struct cpg_address *member_list, int member_list_entries, + struct cpg_address *left_list, int left_list_entries, + struct cpg_address *joined_list, int joined_list_entries); + /* main.c */ int do_read(int fd, void *buf, size_t count);
reply other threads:[~2008-11-05 22:06 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20081105220504.DF14F120346@lists.fedorahosted.org \ --to=teigland@fedoraproject.org \ --cc=cluster-cvs-relay@redhat.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).