[DRBD-cvs] svn commit by phil - r2976 - branches/drbd-8.0/user - Rasto reported this. When one uses "drbdsetup /dev/drbd

drbd-cvs at lists.linbit.com drbd-cvs at lists.linbit.com
Sun Jul 22 09:55:29 CEST 2007


Author: phil
Date: 2007-07-22 09:55:29 +0200 (Sun, 22 Jul 2007)
New Revision: 2976

Modified:
   branches/drbd-8.0/user/drbdsetup.c
Log:
Rasto reported this.
  When one uses "drbdsetup /dev/drbd0 events --all-devices" we 
  send to the kernel 256 get_state requests. After receiving
  that reply packets we ignored all real state broadcasts
  with sequence numbers small then 256.
  Fixed that.


Modified: branches/drbd-8.0/user/drbdsetup.c
===================================================================
--- branches/drbd-8.0/user/drbdsetup.c	2007-07-19 11:09:26 UTC (rev 2975)
+++ branches/drbd-8.0/user/drbdsetup.c	2007-07-22 07:55:29 UTC (rev 2976)
@@ -1273,7 +1273,7 @@
 	struct drbd_nl_cfg_reply *reply;
 	struct drbd_tag_list *tl;
 	struct option *lo;
-	unsigned int seq=0;
+	unsigned int b_seq=0, r_seq=0;
 	int sk_nl,c,cont=1,rr,i,last;
 	int unfiltered=0, all_devices=0;
 	int wfc_timeout=0, degr_wfc_timeout=0,timeout_ms;
@@ -1368,8 +1368,17 @@
 
 		// dump_tag_list(reply->tag_list);
 
-		if(!unfiltered && cn_reply->seq <= seq) continue;
-		seq = cn_reply->seq;
+		/* There are two value spaces for sequence numbers. The first
+		   is the one created by this drbdsetup instance, the kernel's
+		   reply packets simply echo those sequence numbers.
+		   The second is created by the kernel's broadcast packets. */
+		if(cn_reply->ack==0) { // broadcasts
+			if(!unfiltered && cn_reply->seq <= b_seq) continue;
+			b_seq = cn_reply->seq;
+		} else { // replies to drbdsetup packes
+			if(!unfiltered && cn_reply->seq <= r_seq) continue;
+			r_seq = cn_reply->seq;
+		}
 
 		if( all_devices || minor == reply->minor ) {
 			cont=cm->ep.proc_event(cn_reply->seq, reply);



More information about the drbd-cvs mailing list