[DRBD-cvs] svn commit by phil - r2580 - in trunk: . drbd drbd/linux
- Implemented item 20 of the ROADMAP ( do not allow to co
drbd-cvs at lists.linbit.com
drbd-cvs at lists.linbit.com
Fri Nov 3 15:04:45 CET 2006
Author: phil
Date: 2006-11-03 15:04:43 +0100 (Fri, 03 Nov 2006)
New Revision: 2580
Modified:
trunk/ROADMAP
trunk/drbd/drbd_int.h
trunk/drbd/drbd_main.c
trunk/drbd/drbd_receiver.c
trunk/drbd/linux/drbd_config.h
Log:
Implemented item 20 of the ROADMAP ( do not allow to connect in
case the configs do not match)
Modified: trunk/ROADMAP
===================================================================
--- trunk/ROADMAP 2006-11-03 11:22:09 UTC (rev 2579)
+++ trunk/ROADMAP 2006-11-03 14:04:43 UTC (rev 2580)
@@ -567,11 +567,12 @@
the config is valid, from a viewpoint of the whole cluster.
E.g.
protocol equal
- cram-hmac-alg equal
after-sb-0pri / discard-local/remote equal / reciprocal
after-sb-1pri equal
after-sb-2pri equal
- syncer/group equal
+ want_lose reciprocal
+ two_primaries equal
+ 99% DONE
21 Write barriers in the kernel
In Linux-2.6 write barriers in the block-io layer are represented as
Modified: trunk/drbd/drbd_int.h
===================================================================
--- trunk/drbd/drbd_int.h 2006-11-03 11:22:09 UTC (rev 2579)
+++ trunk/drbd/drbd_int.h 2006-11-03 14:04:43 UTC (rev 2580)
@@ -474,6 +474,11 @@
typedef struct {
Drbd_Header head;
u32 protocol;
+ u32 after_sb_0p;
+ u32 after_sb_1p;
+ u32 after_sb_2p;
+ u32 want_lose;
+ u32 two_primaries;
} __attribute((packed)) Drbd_Protocol_Packet;
typedef struct {
Modified: trunk/drbd/drbd_main.c
===================================================================
--- trunk/drbd/drbd_main.c 2006-11-03 11:22:09 UTC (rev 2579)
+++ trunk/drbd/drbd_main.c 2006-11-03 14:04:43 UTC (rev 2580)
@@ -1260,7 +1260,12 @@
{
Drbd_Protocol_Packet p;
- p.protocol = cpu_to_be32(mdev->net_conf->wire_protocol);
+ p.protocol = cpu_to_be32(mdev->net_conf->wire_protocol);
+ p.after_sb_0p = cpu_to_be32(mdev->net_conf->after_sb_0p);
+ p.after_sb_1p = cpu_to_be32(mdev->net_conf->after_sb_1p);
+ p.after_sb_2p = cpu_to_be32(mdev->net_conf->after_sb_2p);
+ p.want_lose = cpu_to_be32(mdev->net_conf->want_lose);
+ p.two_primaries = cpu_to_be32(mdev->net_conf->two_primaries);
return drbd_send_cmd(mdev,USE_DATA_SOCKET,ReportProtocol,
(Drbd_Header*)&p,sizeof(p));
Modified: trunk/drbd/drbd_receiver.c
===================================================================
--- trunk/drbd/drbd_receiver.c 2006-11-03 11:22:09 UTC (rev 2579)
+++ trunk/drbd/drbd_receiver.c 2006-11-03 14:04:43 UTC (rev 2580)
@@ -1978,32 +1978,77 @@
return rv;
}
+/* returns 1 if invalid */
+STATIC int cmp_after_sb(enum after_sb_handler peer, enum after_sb_handler self)
+{
+ // DiscardRemote - DiscardLocal is valid
+ if( (peer == DiscardRemote && self == DiscardLocal) ||
+ (self == DiscardRemote && peer == DiscardLocal) ) return 0;
+
+ // any other things with DiscardRemote or DiscardLocal are invalid
+ if( peer == DiscardRemote || peer == DiscardLocal ||
+ self == DiscardRemote || self == DiscardLocal ) return 1;
+
+ // everything else is valid if they are equal on both sides.
+ if( peer == self ) return 0;
+
+ // everything es is invalid.
+ return 1;
+}
+
STATIC int receive_protocol(drbd_dev *mdev, Drbd_Header *h)
{
Drbd_Protocol_Packet *p = (Drbd_Protocol_Packet*)h;
+ int p_proto, p_after_sb_0p, p_after_sb_1p, p_after_sb_2p;
+ int p_want_lose, p_two_primaries;
+
ERR_IF(h->length != (sizeof(*p)-sizeof(*h))) return FALSE;
if (drbd_recv(mdev, h->payload, h->length) != h->length)
return FALSE;
- if(be32_to_cpu(p->protocol)!=mdev->net_conf->wire_protocol) {
- int peer_proto = be32_to_cpu(p->protocol);
- if (DRBD_PROT_A <= peer_proto && peer_proto <= DRBD_PROT_C) {
- ERR("incompatible communication protocols: "
- "me %c, peer %c\n",
- 'A'-1+mdev->net_conf->wire_protocol,
- 'A'-1+peer_proto);
- } else {
- ERR("incompatible communication protocols: "
- "me %c, peer [%d]\n",
- 'A'-1+mdev->net_conf->wire_protocol,
- peer_proto);
- }
- drbd_force_state(mdev,NS(conn,Disconnecting));
- return FALSE;
+ p_proto = be32_to_cpu(p->protocol);
+ p_after_sb_0p = be32_to_cpu(p->after_sb_0p);
+ p_after_sb_1p = be32_to_cpu(p->after_sb_1p);
+ p_after_sb_2p = be32_to_cpu(p->after_sb_2p);
+ p_want_lose = be32_to_cpu(p->want_lose);
+ p_two_primaries = be32_to_cpu(p->two_primaries);
+
+ if( p_proto != mdev->net_conf->wire_protocol) {
+ ERR("incompatible communication protocols\n");
+ goto disconnect;
}
+ if( cmp_after_sb(p_after_sb_0p, mdev->net_conf->after_sb_0p) ) {
+ ERR("incompatible after-sb-0pri settings\n");
+ goto disconnect;
+ }
+
+ if( cmp_after_sb(p_after_sb_1p, mdev->net_conf->after_sb_1p) ) {
+ ERR("incompatible after-sb-1pri settings\n");
+ goto disconnect;
+ }
+
+ if( cmp_after_sb(p_after_sb_2p, mdev->net_conf->after_sb_2p) ) {
+ ERR("incompatible after-sb-2pri settings\n");
+ goto disconnect;
+ }
+
+ if( p_want_lose && mdev->net_conf->want_lose ) {
+ ERR("both sides have the 'want_lose' flag set\n");
+ goto disconnect;
+ }
+
+ if( p_two_primaries != mdev->net_conf->two_primaries ) {
+ ERR("incompatible setting of the two-primaries options\n");
+ goto disconnect;
+ }
+
return TRUE;
+
+ disconnect:
+ drbd_force_state(mdev,NS(conn,Disconnecting));
+ return FALSE;
}
STATIC int receive_SyncParam(drbd_dev *mdev,Drbd_Header *h)
Modified: trunk/drbd/linux/drbd_config.h
===================================================================
--- trunk/drbd/linux/drbd_config.h 2006-11-03 11:22:09 UTC (rev 2579)
+++ trunk/drbd/linux/drbd_config.h 2006-11-03 14:04:43 UTC (rev 2580)
@@ -22,9 +22,9 @@
extern const char * drbd_buildtag(void);
-#define REL_VERSION "8.0pre5"
+#define REL_VERSION "8.0pre6"
#define API_VERSION 85
-#define PRO_VERSION 84
+#define PRO_VERSION 85
// undef if you need the workaround in drbd_receiver
#define HAVE_UML_TO_VIRT 1
More information about the drbd-cvs
mailing list