Author: pjd
Date: Mon Mar 21 14:50:12 2011
New Revision: 219830
URL: http://svn.freebsd.org/changeset/base/219830

Log:
  Detect situation where resource internal identifier differs.
  This means that both nodes have separately managed resources that don't
  have the same data.
  
  MFC after:    1 week

Modified:
  head/sbin/hastd/secondary.c

Modified: head/sbin/hastd/secondary.c
==============================================================================
--- head/sbin/hastd/secondary.c Mon Mar 21 14:29:35 2011        (r219829)
+++ head/sbin/hastd/secondary.c Mon Mar 21 14:50:12 2011        (r219830)
@@ -259,6 +259,19 @@ init_remote(struct hast_resource *res, s
                        memset(map, 0xff, mapsize);
                }
                nv_add_uint8(nvout, HAST_SYNCSRC_PRIMARY, "syncsrc");
+       } else if (res->hr_resuid != resuid) {
+               char errmsg[256];
+
+               (void)snprintf(errmsg, sizeof(errmsg),
+                   "Resource unique ID mismatch (primary=%ju, secondary=%ju).",
+                   (uintmax_t)resuid, (uintmax_t)res->hr_resuid);
+               pjdlog_error("%s", errmsg);
+               nv_add_string(nvout, errmsg, "errmsg");
+               if (hast_proto_send(res, res->hr_remotein, nvout, NULL, 0) < 0) 
{
+                       pjdlog_exit(EX_TEMPFAIL, "Unable to send response to 
%s",
+                           res->hr_remoteaddr);
+               }
+               exit(EX_CONFIG);
        } else if (
            /* Is primary is out-of-date? */
            (res->hr_secondary_localcnt > res->hr_primary_remotecnt &&
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to