[DRBD-cvs] svn commit by phil - r2651 - in trunk: testing user - * Fixed bugs in drbdmeta's is_attached() function. It s

drbd-cvs at lists.linbit.com drbd-cvs at lists.linbit.com
Tue Jan 2 21:03:23 CET 2007


Author: phil
Date: 2007-01-02 21:03:21 +0100 (Tue, 02 Jan 2007)
New Revision: 2651

Modified:
   trunk/testing/Makefile
   trunk/testing/access_and_verify.c
   trunk/user/drbdmeta.c
Log:
* Fixed bugs in drbdmeta's is_attached() function. It should
  work now with outr current module, that might have not all
  minors allocated.
* Fixed some issues with some tests


Modified: trunk/testing/Makefile
===================================================================
--- trunk/testing/Makefile	2007-01-02 13:47:28 UTC (rev 2650)
+++ trunk/testing/Makefile	2007-01-02 20:03:21 UTC (rev 2651)
@@ -1,4 +1,4 @@
-PROGRAMS=show_size  access_and_verify ioctl_structs_sizes drbd_states
+PROGRAMS=show_size  access_and_verify #drbd_states
 CFLAGS=-Wall -I../drbd
 
 all: $(PROGRAMS)

Modified: trunk/testing/access_and_verify.c
===================================================================
--- trunk/testing/access_and_verify.c	2007-01-02 13:47:28 UTC (rev 2650)
+++ trunk/testing/access_and_verify.c	2007-01-02 20:03:21 UTC (rev 2651)
@@ -218,7 +218,8 @@
 
   if( write(fd,datab,block_size) != block_size ) 
     {
-      fprintf(stderr,"Write to device failed\n");
+      perror("Write to device failed");
+      fprintf(stderr,"block=%lu\n",block);
       exit(20);
     }
 
@@ -241,6 +242,7 @@
   else 
     {
       block++;
+      block = block % ( device_size / block_size );
       sequence--;
     }
 

Modified: trunk/user/drbdmeta.c
===================================================================
--- trunk/user/drbdmeta.c	2007-01-02 13:47:28 UTC (rev 2650)
+++ trunk/user/drbdmeta.c	2007-01-02 20:03:21 UTC (rev 2651)
@@ -2378,7 +2378,7 @@
 {
 	FILE *pr;
 	char token[40];
-	int rv=1;
+	int rv=-1;
 	long m,cm=-1;
 	char *p;
 
@@ -2388,6 +2388,7 @@
 	while(fget_token(token,40,pr) != EOF) {
 		m=strtol(token,&p,10);
 		if(*p==':' && p-token == (long)strlen(token)-1 ) cm=m;
+		if( cm == minor && rv == -1 ) rv=1;
 		if( cm == minor ) {
 			if(!strcmp(token,"cs:Unconfigured")) rv = 0;
 			if(!strncmp(token,"ds:Diskless",11)) rv = 0;
@@ -2395,6 +2396,7 @@
 	}
 	fclose(pr);
 
+	if(rv == -1) rv = 0; // minor not found -> not attached.
 	return rv;
 }
 



More information about the drbd-cvs mailing list