[DRBD-cvs] r1924 - in branches/drbd-0.7: . drbd user

drbd-cvs at lists.linbit.com drbd-cvs at lists.linbit.com
Thu Aug 25 14:46:40 CEST 2005


Author: phil
Date: 2005-08-25 14:46:37 +0200 (Thu, 25 Aug 2005)
New Revision: 1924

Modified:
   branches/drbd-0.7/ChangeLog
   branches/drbd-0.7/drbd.spec.in
   branches/drbd-0.7/drbd/drbd_receiver.c
   branches/drbd-0.7/user/drbdadm_main.c
Log:
* Allow "drbdadm -- --size=XXX resize r0"
* DRBD no longer goes into StandAlone mode, if there is an random network 
  error during the handshake phase, instead it retries the to connect.
  Only critical problems, e.g. incompatible protocols will cause it 
  to go into StandAlone mode.



Modified: branches/drbd-0.7/ChangeLog
===================================================================
--- branches/drbd-0.7/ChangeLog	2005-08-25 09:28:22 UTC (rev 1923)
+++ branches/drbd-0.7/ChangeLog	2005-08-25 12:46:37 UTC (rev 1924)
@@ -20,6 +20,7 @@
    * The "size" option is now allowed in the disk section
    * A new "disable-ip-verification" option for the global section
    * The "disable-io-hints" option is not longer available.
+   * Allow "drbdadm -- --size=XXX resize r0".
  * Fixed a potential very unlikely race condition that in the end would
    trigger an ERR in drbd_actlog.c:607. Actually I never saw this trigger.
  * Fixed a logic bug in _drbd_process_ee() that, paired with a race condition
@@ -28,6 +29,10 @@
  * Added the "disable_bd_claim" module parameter, to allow users, WHO 
    KNOW WHAT THEY DO, to read-access the data on the secondary node.
  * Allow "drbdadm invalidate" only in StandAlone and Connected states. 
+ * DRBD no longer goes into StandAlone mode, if there is an random network 
+   error during the handshake phase, instead it retries the to connect.
+   Only critical problems, e.g. incompatible protocols will cause it 
+   to go into StandAlone mode.
 
 0.7.11 (api:77/proto:74)
 -----

Modified: branches/drbd-0.7/drbd/drbd_receiver.c
===================================================================
--- branches/drbd-0.7/drbd/drbd_receiver.c	2005-08-25 09:28:22 UTC (rev 1923)
+++ branches/drbd-0.7/drbd/drbd_receiver.c	2005-08-25 12:46:37 UTC (rev 1924)
@@ -689,9 +689,17 @@
 
 STATIC int drbd_do_handshake(drbd_dev *mdev);
 
+/*
+ * return values:
+ *   1 yess, we have a valid connection
+ *   0 oops, did not work out, please try again
+ *  -1 peer talks different language,
+ *     no point in trying again, please go standalone.
+ */
 int drbd_connect(drbd_dev *mdev)
 {
 	struct socket *sock,*msock;
+	int h;
 
 	D_ASSERT(mdev->cstate!=Unconfigured);
 	D_ASSERT(!mdev->data.socket);
@@ -720,12 +728,12 @@
 				sock_release(sock);
 			}
 		}
-		if(mdev->cstate==Unconnected) return 0;
+		if(mdev->cstate==Unconnected) return -1;
 		if(signal_pending(current)) {
 			drbd_flush_signals(current);
 			smp_rmb();
 			if (get_t_state(&mdev->receiver) == Exiting)
-				return 0;
+				return -1;
 		}
 	}
 
@@ -767,9 +775,8 @@
 	set_cstate(mdev,WFReportParams);
 	D_ASSERT(mdev->asender.task == NULL);
 
-	if (!drbd_do_handshake(mdev)) {
-		return 0;
-	}
+	h = drbd_do_handshake(mdev);
+	if (h <= 0) return h;
 
 	clear_bit(ON_PRI_INC_HUMAN,&mdev->flags);
 	clear_bit(ON_PRI_INC_TIMEOUTEX,&mdev->flags);
@@ -1954,6 +1961,13 @@
 	return ok;
 }
 
+/*
+ * return values:
+ *   1 yess, we have a valid connection
+ *   0 oops, did not work out, please try again
+ *  -1 peer talks different language,
+ *     no point in trying again, please go standalone.
+ */
 STATIC int drbd_do_handshake(drbd_dev *mdev)
 {
 	// ASSERT current == mdev->receiver ...
@@ -1970,17 +1984,17 @@
 	if (p->head.command == ReportParams) {
 		ERR("expected HandShake packet, received ReportParams...\n");
 		ERR("peer probaly runs some incompatible 0.7 -preX version\n");
-		return 0;
+		return -1;
 	} else if (p->head.command != HandShake) {
 		ERR( "expected HandShake packet, received: %s (0x%04x)\n",
 		     cmdname(p->head.command), p->head.command );
-		return 0;
+		return -1;
 	}
 
 	if (p->head.length != expect) {
 		ERR( "expected HandShake length: %u, received: %u\n",
 		     expect, p->head.length );
-		return 0;
+		return -1;
 	}
 
 	rv = drbd_recv(mdev, &p->head.payload, expect);
@@ -2012,7 +2026,7 @@
 		ERR( "incompatible DRBD dialects: "
 		     "I support %u, peer wants %u\n",
 		     PRO_VERSION, p->protocol_version );
-		return 0;
+		return -1;
 	}
 
 	return 1;
@@ -2022,19 +2036,26 @@
 {
 	drbd_dev *mdev = thi->mdev;
 	int minor = (int)(mdev-drbd_conf);
+	int h;
 
 	sprintf(current->comm, "drbd%d_receiver", minor);
 
 	/* printk(KERN_INFO DEVICE_NAME ": receiver living/m=%d\n", minor); */
 
 	while (TRUE) {
-		if (!drbd_connect(mdev)) {
-			WARN("Discarding network configuration.\n");
+		h = drbd_connect(mdev);
+		if (h <= 0) {
 			/* FIXME DISKLESS StandAlone
 			 * does not make much sense...
 			 * drbd_disconnect should set cstate properly...
 			 */
 			drbd_disconnect(mdev);
+			if (h == 0) {
+				schedule_timeout(HZ);
+				continue;
+			}
+
+			WARN("Discarding network configuration.\n");
 			set_cstate(mdev,StandAlone);
 			break;
 		}

Modified: branches/drbd-0.7/drbd.spec.in
===================================================================
--- branches/drbd-0.7/drbd.spec.in	2005-08-25 09:28:22 UTC (rev 1923)
+++ branches/drbd-0.7/drbd.spec.in	2005-08-25 12:46:37 UTC (rev 1924)
@@ -206,6 +206,7 @@
    * The "size" option is now allowed in the disk section
    * A new "disable-ip-verification" option for the global section
    * The "disable-io-hints" option is not longer available.
+   * Allow "drbdadm -- --size=XXX resize r0".
  * Fixed a potential very unlikely race condition that in the end would
    trigger an ERR in drbd_actlog.c:607. Actually I never saw this trigger.
  * Fixed a logic bug in _drbd_process_ee() that, paired with a race condition
@@ -214,6 +215,10 @@
  * Added the "disable_bd_claim" module parameter, to allow users, WHO 
    KNOW WHAT THEY DO, to read-access the data on the secondary node.
  * Allow "drbdadm invalidate" only in StandAlone and Connected states. 
+ * DRBD no longer goes into StandAlone mode, if there is an random network 
+   error during the handshake phase, instead it retries the to connect.
+   Only critical problems, e.g. incompatible protocols will cause it 
+   to go into StandAlone mode.
 
 * Tue Jun  7 2005 19:13:00 +0200 Lars Ellenberg <lars at linbit.com>
 - drbd (0.7.11-1)

Modified: branches/drbd-0.7/user/drbdadm_main.c
===================================================================
--- branches/drbd-0.7/user/drbdadm_main.c	2005-08-25 09:28:22 UTC (rev 1923)
+++ branches/drbd-0.7/user/drbdadm_main.c	2005-08-25 12:46:37 UTC (rev 1924)
@@ -543,13 +543,16 @@
 {
   char* argv[20];
   struct d_option* opt;
-  int argc=0;
+  int i,argc=0;
 
   argv[argc++]=drbdsetup;
   argv[argc++]=res->me->device;
   argv[argc++]="resize";
   opt=find_opt(res->disk_options,"size");
   if(opt) ssprintf(argv[argc++],"--%s=%s",opt->name,opt->value);
+  for(i=0;i<soi;i++) {
+    argv[argc++]=setup_opts[i];
+  }
   argv[argc++]=0;
 
   return m_system(argv,SLEEPS_SHORT);



More information about the drbd-cvs mailing list