From mboxrd@z Thu Jan 1 00:00:00 1970 From: jbrassow@sourceware.org Date: 14 Feb 2007 17:44:10 -0000 Subject: [Cluster-devel] cluster/cmirror-kernel/src dm-cmirror-client.c ... Message-ID: <20070214174410.25253.qmail@sourceware.org> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit CVSROOT: /cvs/cluster Module name: cluster Branch: RHEL4 Changes by: jbrassow at sourceware.org 2007-02-14 17:44:08 Modified files: cmirror-kernel/src: dm-cmirror-client.c dm-cmirror-common.h dm-cmirror-server.c dm-cmirror-xfr.h Log message: Changes to fix the following bugs: Bug 228104: greater than 2 legged cluster mirrors do not down ... Bug 228056: lvconvert should give warning if we don't support ... When converting from 3-way to 2-way mirror, the UUID for the mirror stays the same. This creates conflicting entries in the cluster logging code. I've added an additional identifier to allow for unique identification in these cases. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cmirror-kernel/src/dm-cmirror-client.c.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.1.2.35&r2=1.1.2.36 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cmirror-kernel/src/dm-cmirror-common.h.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.1.2.10&r2=1.1.2.11 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cmirror-kernel/src/dm-cmirror-server.c.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.1.2.20&r2=1.1.2.21 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/cmirror-kernel/src/dm-cmirror-xfr.h.diff?cvsroot=cluster&only_with_tag=RHEL4&r1=1.1.2.1&r2=1.1.2.2 --- cluster/cmirror-kernel/src/Attic/dm-cmirror-client.c 2007/02/02 17:22:55 1.1.2.35 +++ cluster/cmirror-kernel/src/Attic/dm-cmirror-client.c 2007/02/14 17:44:07 1.1.2.36 @@ -257,6 +257,7 @@ lr.u.lr_starter = my_id; lr.u.lr_coordinator = initial_server; memcpy(lr.lr_uuid, lc->uuid, MAX_NAME_LEN); + lr.lr_uuid_ref = lc->uuid_ref; memset(&saddr_in, 0, sizeof(struct sockaddr_cl)); @@ -342,6 +343,7 @@ lr->u.lr_int_rtn = (*result) ? 1 : 0; memcpy(lr->lr_uuid, lc->uuid, MAX_NAME_LEN); + lr->lr_uuid_ref = lc->uuid_ref; memset(&saddr_in, 0, sizeof(struct sockaddr_in)); @@ -630,16 +632,19 @@ } atomic_set(&lc->in_sync, -1); + lc->uuid_ref = 1; list_for_each_entry(tmp_lc, &log_list_head, log_list){ if(!strncmp(tmp_lc->uuid, lc->uuid, MAX_NAME_LEN)){ - DMERR("Log already exists with uuid, %s", - lc->uuid + (strlen(lc->uuid) - 8)); - error = -EINVAL; - goto fail; + lc->uuid_ref = (lc->uuid_ref > tmp_lc->uuid_ref) ? + lc->uuid_ref : tmp_lc->uuid_ref + 1; } } + DMDEBUG("Creating %s (%d)", + lc->uuid + (strlen(lc->uuid) - 8), + lc->uuid_ref); + list_add(&lc->log_list, &log_list_head); INIT_LIST_HEAD(&lc->region_users); @@ -744,10 +749,15 @@ struct log_c *lc = (struct log_c *) log->context; struct region_state *rs, *tmp_rs; + DMDEBUG("Removing %s (%d)", + lc->uuid + (strlen(lc->uuid) - 8), + lc->uuid_ref); + if (!list_empty(&clear_region_list)) DMINFO("Leaving while clear region requests remain."); list_del_init(&lc->log_list); + if ((lc->server_id == my_id) && !atomic_read(&lc->suspended)) consult_server(lc, 0, LRT_MASTER_LEAVING, NULL); @@ -767,6 +777,7 @@ spin_unlock(®ion_state_lock); + if (lc->log_dev) disk_dtr(log); else --- cluster/cmirror-kernel/src/Attic/dm-cmirror-common.h 2006/07/27 23:11:55 1.1.2.10 +++ cluster/cmirror-kernel/src/Attic/dm-cmirror-common.h 2007/02/14 17:44:07 1.1.2.11 @@ -129,6 +129,7 @@ * Cluster log fields */ char uuid[MAX_NAME_LEN]; + int uuid_ref; atomic_t in_sync; /* like sync_count, except all or nothing */ struct list_head log_list; --- cluster/cmirror-kernel/src/Attic/dm-cmirror-server.c 2007/02/02 17:22:55 1.1.2.20 +++ cluster/cmirror-kernel/src/Attic/dm-cmirror-server.c 2007/02/14 17:44:07 1.1.2.21 @@ -645,11 +645,12 @@ } } -static struct log_c *get_log_context(char *uuid){ +static struct log_c *get_log_context(char *uuid, int uuid_ref){ struct log_c *lc, *r = NULL; list_for_each_entry(lc, &log_list_head, log_list){ - if(!strncmp(lc->uuid, uuid, MAX_NAME_LEN)){ + if (!strncmp(lc->uuid, uuid, MAX_NAME_LEN) && + (uuid_ref == lc->uuid_ref)) { if (r) report_duplicate_log(lc); else @@ -866,7 +867,7 @@ if(error < sizeof(struct log_request)){ DMERR("Cluster mirror log server received incomplete message."); } - lc = get_log_context(lr.lr_uuid); + lc = get_log_context(lr.lr_uuid, lr.lr_uuid_ref); if(lr.lr_type == LRT_ELECTION || lr.lr_type == LRT_SELECTION || --- cluster/cmirror-kernel/src/Attic/dm-cmirror-xfr.h 2005/07/27 16:09:31 1.1.2.1 +++ cluster/cmirror-kernel/src/Attic/dm-cmirror-xfr.h 2007/02/14 17:44:07 1.1.2.2 @@ -41,6 +41,7 @@ }; } u; char lr_uuid[MAX_NAME_LEN]; + int lr_uuid_ref; }; int my_recvmsg(struct socket *sock, struct msghdr *msg,