From drbd-user@lists.linbit.com  Wed Aug  4 14:44:56 2004
From: drbd-user@lists.linbit.com (drbd-user@lists.linbit.com)
Date: Wed,  4 Aug 2004 15:44:56 +0200 (CEST)
Subject: [DRBD-cvs] r1482 - trunk
Message-ID: <20040804134456.958123BE6E@garcon.linbit.com>

Author: lars
Date: 2004-08-04 15:44:54 +0200 (Wed, 04 Aug 2004)
New Revision: 1482

Modified:
   trunk/Makefile
Log:
tgz will no longer automatically update .filelist,
so the tgz and therefore rpm target will work within
an extracted tarball, too.
to generate a distribution tarball, use make tarball,
which will regenerate .filelist

Modified: trunk/Makefile
===================================================================
--- trunk/Makefile	2004-08-02 16:36:19 UTC (rev 1481)
+++ trunk/Makefile	2004-08-04 13:44:54 UTC (rev 1482)
@@ -128,7 +128,13 @@
 	for d in documentation/{ja,pt_BR}; do test -e $$d/Makefile && echo drbd-$(DIST_VERSION)/$$d/Makefile >> .filelist ; done
 	@echo "./.filelist updated."
 
-tgz: .filelist
+# tgz will no longer automatically update .filelist,
+# so the tgz and therefore rpm target will work within
+# an extracted tarball, too.
+# to generate a distribution tarball, use make tarball,
+# which will regenerate .filelist 
+tgz:
+	test -e .filelist
 	ln -sf drbd/linux/drbd_config.h drbd_config.h
 	rm -f drbd-$(DIST_VERSION)
 	ln -s . drbd-$(DIST_VERSION)


From drbd-user@lists.linbit.com  Wed Aug  4 14:50:16 2004
From: drbd-user@lists.linbit.com (drbd-user@lists.linbit.com)
Date: Wed,  4 Aug 2004 15:50:16 +0200 (CEST)
Subject: [DRBD-cvs] r1483 - trunk
Message-ID: <20040804135016.C52E03BE6E@garcon.linbit.com>

Author: lars
Date: 2004-08-04 15:50:14 +0200 (Wed, 04 Aug 2004)
New Revision: 1483

Modified:
   trunk/Makefile
Log:
 "... use make tarball, **which will regenerate .filelist**" grpmf. :-/

Modified: trunk/Makefile
===================================================================
--- trunk/Makefile	2004-08-04 13:44:54 UTC (rev 1482)
+++ trunk/Makefile	2004-08-04 13:50:14 UTC (rev 1483)
@@ -153,7 +153,7 @@
 	       	false;			\
 	fi
 
-tarball: check_all_committed distclean doc tgz
+tarball: check_all_committed distclean doc .filelist tgz
 all tools doc .filelist: drbd/drbd_buildtag.c
 
 KDIR := $(shell echo /lib/modules/`uname -r`/build)


From drbd-user@lists.linbit.com  Fri Aug  6 13:25:51 2004
From: drbd-user@lists.linbit.com (drbd-user@lists.linbit.com)
Date: Fri,  6 Aug 2004 14:25:51 +0200 (CEST)
Subject: [DRBD-cvs] r1484 - trunk/drbd
Message-ID: <20040806122551.50A963BE6E@garcon.linbit.com>

Author: phil
Date: 2004-08-06 14:25:49 +0200 (Fri, 06 Aug 2004)
New Revision: 1484

Modified:
   trunk/drbd/drbd_fs.c
   trunk/drbd/drbd_int.h
Log:
Commited LGE's suggestion. (Made 2<<16 to 1<<16)


Modified: trunk/drbd/drbd_fs.c
===================================================================
--- trunk/drbd/drbd_fs.c	2004-08-04 13:50:14 UTC (rev 1483)
+++ trunk/drbd/drbd_fs.c	2004-08-06 12:25:49 UTC (rev 1484)
@@ -369,7 +369,18 @@
 	if ( new_conf.meta_index == -1 ) i = 1;
 	else i = new_conf.meta_index+1;
 
-	if( drbd_get_capacity(bdev2) < 2*MD_RESERVED_SIZE*i ) {
+	/* for internal, we need to check agains <= (then we have a drbd with
+	 * zero size, but meta data...) to be on the safe side, I require 64MB
+	 * minimal data storage area for drbd with internal meta data (thats
+	 * 192 total).  if someone wants to use that small devices, she can use
+	 * drbd 0.6 anyways...
+	 *
+	 * FIXME this is arbitrary and needs to be reconsidered as soon as we
+	 * move to flexible size meta data.
+	 */
+	if( drbd_get_capacity(bdev2) < 2*MD_RESERVED_SIZE*i
+				+ (new_conf.meta_index == -1) ? (1<<16) : 0 )
+	{
 		retcode = MDDeviceTooSmall;
 		goto release_bdev2_fail_ioctl;
 	}

Modified: trunk/drbd/drbd_int.h
===================================================================
--- trunk/drbd/drbd_int.h	2004-08-04 13:50:14 UTC (rev 1483)
+++ trunk/drbd/drbd_int.h	2004-08-06 12:25:49 UTC (rev 1484)
@@ -870,7 +870,7 @@
    * either at the end of the backing device
    * or on a seperate meta data device. */
 
-#define MD_RESERVED_SIZE ( 128 * (1<<10) )  // 128 MB  ( in units of kb )
+#define MD_RESERVED_SIZE ( 128LU * (1<<10) )  // 128 MB  ( in units of kb )
 // The following numbers are sectors
 #define MD_GC_OFFSET 0
 #define MD_AL_OFFSET 8      // 8 Sectors after start of meta area


From drbd-user@lists.linbit.com  Fri Aug  6 13:47:52 2004
From: drbd-user@lists.linbit.com (drbd-user@lists.linbit.com)
Date: Fri,  6 Aug 2004 14:47:52 +0200 (CEST)
Subject: [DRBD-cvs] r1485 - in trunk: . debian drbd/linux
Message-ID: <20040806124752.D8D8A3BE6E@garcon.linbit.com>

Author: phil
Date: 2004-08-06 14:47:50 +0200 (Fri, 06 Aug 2004)
New Revision: 1485

Modified:
   trunk/ChangeLog
   trunk/debian/changelog
   trunk/drbd.spec.in
   trunk/drbd/linux/drbd_config.h
Log:
Preparing the 0.7.2 release


Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2004-08-06 12:25:49 UTC (rev 1484)
+++ trunk/ChangeLog	2004-08-06 12:47:50 UTC (rev 1485)
@@ -1,3 +1,15 @@
+0.7.2 (api:75/proto:74)
+-----
+  *) Propper handling of backing storage devices that occasionally fail 
+     READA (=read ahead) requests. (E.g. LVM and MD)
+  *) DRBD now fails READA requests itself, if a resynchronisation is running
+     and it would need to fetch the block from its peer.
+  *) "drbdadm adjust" had a race, which caused random errors. ( Missing
+     waitpid() ). Fixed now.
+  *) Popper substract SyncPause times from the syncer performance numbers.
+  *) Fix to the syncer progress bar in /proc/drbd.
+  *) Fix to debian build rules.
+	 
 0.7.1 (api:75/proto:74)
 -----
   *) Upgrade instructions for 0.6.x -> 0.7.0 and 0.7.0 -> 0.7.1

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2004-08-06 12:25:49 UTC (rev 1484)
+++ trunk/debian/changelog	2004-08-06 12:47:50 UTC (rev 1485)
@@ -1,3 +1,17 @@
+drbd (0.7.2-1) unstable; urgency=low
+
+  * Propper handling of backing storage devices that occasionally fail 
+    READA (=read ahead) requests. (E.g. LVM and MD)
+  * DRBD now fails READA requests itself, if a resynchronisation is running
+    and it would need to fetch the block from its peer.
+  * "drbdadm adjust" had a race, which caused random errors. ( Missing
+    waitpid() ). Fixed now.
+  * Popper substract SyncPause times from the syncer performance numbers.
+  * Fix to the syncer progress bar in /proc/drbd.
+  * Fix to debian build rules.
+
+ -- Philipp Reisner <phil@linbit.com>  Fri, 6 Aug 2004 14:44:31 +0200
+
 drbd (0.7.1-1) unstable; urgency=low
 
   * Upgrade instructions for 0.6.x -> 0.7.0 and 0.7.0 -> 0.7.1

Modified: trunk/drbd/linux/drbd_config.h
===================================================================
--- trunk/drbd/linux/drbd_config.h	2004-08-06 12:25:49 UTC (rev 1484)
+++ trunk/drbd/linux/drbd_config.h	2004-08-06 12:47:50 UTC (rev 1485)
@@ -22,7 +22,7 @@
 
 extern const char * drbd_buildtag(void);
 
-#define REL_VERSION "0.7.1"
+#define REL_VERSION "0.7.2"
 #define API_VERSION 75
 #define PRO_VERSION 74
 

Modified: trunk/drbd.spec.in
===================================================================
--- trunk/drbd.spec.in	2004-08-06 12:25:49 UTC (rev 1484)
+++ trunk/drbd.spec.in	2004-08-06 12:47:50 UTC (rev 1485)
@@ -177,6 +177,18 @@
 /sbin/depmod -a -F /boot/System.map-%{kernelversion} %{kernelversion} >/dev/null 2>&1 || true
 
 %changelog
+* Fri Aug 06 2004 14:44:31 +0200 Philipp Reisner <phil@linbit.com>
+- drbd (0.7.2-1)
+  * Propper handling of backing storage devices that occasionally fail 
+    READA (=read ahead) requests. (E.g. LVM and MD)
+  * DRBD now fails READA requests itself, if a resynchronisation is running
+    and it would need to fetch the block from its peer.
+  * "drbdadm adjust" had a race, which caused random errors. ( Missing
+    waitpid() ). Fixed now.
+  * Popper substract SyncPause times from the syncer performance numbers.
+  * Fix to the syncer progress bar in /proc/drbd.
+  * Fix to debian build rules.
+
 * Fri Jul 30 2004 13:50:38 +0200 Philipp Reisner <phil@linbit.com>
 - drbd (0.7.1-1)
   * Upgrade instructions for 0.6.x -> 0.7.0 and 0.7.0 -> 0.7.1


From drbd-user@lists.linbit.com  Fri Aug  6 13:52:07 2004
From: drbd-user@lists.linbit.com (drbd-user@lists.linbit.com)
Date: Fri,  6 Aug 2004 14:52:07 +0200 (CEST)
Subject: [DRBD-cvs] r1486 - tags
Message-ID: <20040806125207.B8CC93BE6E@garcon.linbit.com>

Author: phil
Date: 2004-08-06 14:52:05 +0200 (Fri, 06 Aug 2004)
New Revision: 1486

Added:
   tags/drbd-0.7.2/
Log:
Tagging 0.7.2


Copied: tags/drbd-0.7.2 (from rev 1485, trunk)


From drbd-user@lists.linbit.com  Tue Aug 10 12:49:23 2004
From: drbd-user@lists.linbit.com (drbd-user@lists.linbit.com)
Date: Tue, 10 Aug 2004 13:49:23 +0200 (CEST)
Subject: [DRBD-cvs] r1487 - in trunk: . debian drbd
Message-ID: <20040810114923.BF23F3BE6E@garcon.linbit.com>

Author: lars
Date: 2004-08-10 13:49:20 +0200 (Tue, 10 Aug 2004)
New Revision: 1487

Modified:
   trunk/ChangeLog
   trunk/debian/changelog
   trunk/drbd.spec.in
   trunk/drbd/drbd_fs.c
Log:
ispelled changelogs

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2004-08-06 12:52:05 UTC (rev 1486)
+++ trunk/ChangeLog	2004-08-10 11:49:20 UTC (rev 1487)
@@ -1,12 +1,12 @@
 0.7.2 (api:75/proto:74)
 -----
-  *) Propper handling of backing storage devices that occasionally fail 
+  *) Proper handling of backing storage devices that occasionally fail 
      READA (=read ahead) requests. (E.g. LVM and MD)
   *) DRBD now fails READA requests itself, if a resynchronisation is running
      and it would need to fetch the block from its peer.
   *) "drbdadm adjust" had a race, which caused random errors. ( Missing
      waitpid() ). Fixed now.
-  *) Popper substract SyncPause times from the syncer performance numbers.
+  *) Proper subtract SyncPause times from the syncer performance numbers.
   *) Fix to the syncer progress bar in /proc/drbd.
   *) Fix to debian build rules.
 	 

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2004-08-06 12:52:05 UTC (rev 1486)
+++ trunk/debian/changelog	2004-08-10 11:49:20 UTC (rev 1487)
@@ -1,12 +1,12 @@
 drbd (0.7.2-1) unstable; urgency=low
 
-  * Propper handling of backing storage devices that occasionally fail 
+  * Proper handling of backing storage devices that occasionally fail 
     READA (=read ahead) requests. (E.g. LVM and MD)
   * DRBD now fails READA requests itself, if a resynchronisation is running
     and it would need to fetch the block from its peer.
   * "drbdadm adjust" had a race, which caused random errors. ( Missing
     waitpid() ). Fixed now.
-  * Popper substract SyncPause times from the syncer performance numbers.
+  * Proper subtract SyncPause times from the syncer performance numbers.
   * Fix to the syncer progress bar in /proc/drbd.
   * Fix to debian build rules.
 
@@ -57,12 +57,12 @@
   * A fix to a generic bug in the bitmap code introduced with the -pre9
     release (with the 64 bit work)
   * A fix to a bug in the bitmap code only relevant for 64 bit platforms.
-  * Better 2.4.x compatibility and compatiblity to 2.4.x vendor kernels.
+  * Better 2.4.x compatibility and compatibility to 2.4.x vendor kernels.
   * Improvements in the way to deal with incompatible protocol releases.
   * Added the "dialog-refresh" config option.
 
   changes up to -pre9:
-  * Reenabled zero copy IO for protocols B and C. (Zero copy IO is not
+  * Re-enabled zero copy IO for protocols B and C. (Zero copy IO is not
     used with protocol A)
   * Implemented the unpopular user dialog in the boot process.
   * Some fixes for Linux-2.4.x compatibility.

Modified: trunk/drbd/drbd_fs.c
===================================================================
--- trunk/drbd/drbd_fs.c	2004-08-06 12:52:05 UTC (rev 1486)
+++ trunk/drbd/drbd_fs.c	2004-08-10 11:49:20 UTC (rev 1487)
@@ -370,9 +370,9 @@
 	else i = new_conf.meta_index+1;
 
 	/* for internal, we need to check agains <= (then we have a drbd with
-	 * zero size, but meta data...) to be on the safe side, I require 64MB
+	 * zero size, but meta data...) to be on the safe side, I require 32MB
 	 * minimal data storage area for drbd with internal meta data (thats
-	 * 192 total).  if someone wants to use that small devices, she can use
+	 * 160 total).  if someone wants to use that small devices, she can use
 	 * drbd 0.6 anyways...
 	 *
 	 * FIXME this is arbitrary and needs to be reconsidered as soon as we

Modified: trunk/drbd.spec.in
===================================================================
--- trunk/drbd.spec.in	2004-08-06 12:52:05 UTC (rev 1486)
+++ trunk/drbd.spec.in	2004-08-10 11:49:20 UTC (rev 1487)
@@ -179,13 +179,13 @@
 %changelog
 * Fri Aug 06 2004 14:44:31 +0200 Philipp Reisner <phil@linbit.com>
 - drbd (0.7.2-1)
-  * Propper handling of backing storage devices that occasionally fail 
+  * Proper handling of backing storage devices that occasionally fail 
     READA (=read ahead) requests. (E.g. LVM and MD)
   * DRBD now fails READA requests itself, if a resynchronisation is running
     and it would need to fetch the block from its peer.
   * "drbdadm adjust" had a race, which caused random errors. ( Missing
     waitpid() ). Fixed now.
-  * Popper substract SyncPause times from the syncer performance numbers.
+  * Proper subtract SyncPause times from the syncer performance numbers.
   * Fix to the syncer progress bar in /proc/drbd.
   * Fix to debian build rules.
 


From drbd-user@lists.linbit.com  Wed Aug 11 18:17:40 2004
From: drbd-user@lists.linbit.com (drbd-user@lists.linbit.com)
Date: Wed, 11 Aug 2004 19:17:40 +0200 (CEST)
Subject: [DRBD-cvs] r1488 - trunk/user
Message-ID: <20040811171740.8F1343BE6E@garcon.linbit.com>

Author: lars
Date: 2004-08-11 19:17:37 +0200 (Wed, 11 Aug 2004)
New Revision: 1488

Modified:
   trunk/user/Makefile
Log:
fix missing dependencies on drbd_config.h

Modified: trunk/user/Makefile
===================================================================
--- trunk/user/Makefile	2004-08-10 11:49:20 UTC (rev 1487)
+++ trunk/user/Makefile	2004-08-11 17:17:37 UTC (rev 1488)
@@ -64,5 +64,5 @@
 
 ###dependencies
 drbdadm_adjust.o: drbdadm.h drbdadm_adjust.c
-drbdadm_main.o: drbdadm.h drbdadm_main.c
+drbdadm_main.o: drbdadm.h drbdadm_main.c ../drbd/linux/drbd_config.h
 drbdsetup.o: ../drbd/linux/drbd.h ../drbd/linux/drbd_config.h


From drbd-user@lists.linbit.com  Thu Aug 12 09:06:34 2004
From: drbd-user@lists.linbit.com (drbd-user@lists.linbit.com)
Date: Thu, 12 Aug 2004 10:06:34 +0200 (CEST)
Subject: [DRBD-cvs] r1489 - trunk/drbd
Message-ID: <20040812080634.56F443BE6E@garcon.linbit.com>

Author: phil
Date: 2004-08-12 10:06:31 +0200 (Thu, 12 Aug 2004)
New Revision: 1489

Modified:
   trunk/drbd/drbd_main.c
Log:
[Patch by Pavel Semerad]. Also use the drbd_devfs_name on Linux-2.4.x


Modified: trunk/drbd/drbd_main.c
===================================================================
--- trunk/drbd/drbd_main.c	2004-08-11 17:17:37 UTC (rev 1488)
+++ trunk/drbd/drbd_main.c	2004-08-12 08:06:31 UTC (rev 1489)
@@ -1825,7 +1825,7 @@
 )
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
-	devfs_handle = devfs_mk_dir (NULL, "nbd", NULL);
+	devfs_handle = devfs_mk_dir (NULL, drbd_devfs_name, NULL);
 	devfs_register_series(devfs_handle, "%u", minor_count,
 			      DEVFS_FL_DEFAULT, MAJOR_NR, 0,
 			      S_IFBLK | S_IRUSR | S_IWUSR,


From drbd-user@lists.linbit.com  Sat Aug 14 13:29:45 2004
From: drbd-user@lists.linbit.com (drbd-user@lists.linbit.com)
Date: Sat, 14 Aug 2004 14:29:45 +0200 (CEST)
Subject: [DRBD-cvs] r1490 - trunk/drbd
Message-ID: <20040814122945.D66D53BE6E@garcon.linbit.com>

Author: lars
Date: 2004-08-14 14:29:43 +0200 (Sat, 14 Aug 2004)
New Revision: 1490

Modified:
   trunk/drbd/drbd_main.c
   trunk/drbd/drbd_receiver.c
   trunk/drbd/drbd_worker.c
Log:
make the RHEL3 happy (page_count no longer in mm.h, but in mm_inline.h)

Modified: trunk/drbd/drbd_main.c
===================================================================
--- trunk/drbd/drbd_main.c	2004-08-12 08:06:31 UTC (rev 1489)
+++ trunk/drbd/drbd_main.c	2004-08-14 12:29:43 UTC (rev 1490)
@@ -45,6 +45,7 @@
 #include <linux/proc_fs.h>
 #include <linux/init.h>
 #include <linux/mm.h>
+#include <linux/mm_inline.h>
 #include <linux/slab.h>
 #include <linux/devfs_fs_kernel.h>
 

Modified: trunk/drbd/drbd_receiver.c
===================================================================
--- trunk/drbd/drbd_receiver.c	2004-08-12 08:06:31 UTC (rev 1489)
+++ trunk/drbd/drbd_receiver.c	2004-08-14 12:29:43 UTC (rev 1490)
@@ -39,6 +39,7 @@
 #include <linux/fs.h>
 #include <linux/file.h>
 #include <linux/mm.h>
+#include <linux/mm_inline.h>
 #include <linux/slab.h>
 #include <linux/smp_lock.h>
 #include <linux/pkt_sched.h>

Modified: trunk/drbd/drbd_worker.c
===================================================================
--- trunk/drbd/drbd_worker.c	2004-08-12 08:06:31 UTC (rev 1489)
+++ trunk/drbd/drbd_worker.c	2004-08-14 12:29:43 UTC (rev 1490)
@@ -31,7 +31,8 @@
 #include <linux/sched.h>
 #include <linux/smp_lock.h>
 #include <linux/wait.h>
-#define __KERNEL_SYSCALLS__
+#include <linux/mm.h>
+#include <linux/mm_inline.h> // for the page_count macro on RH/Fedora
 #include <linux/slab.h>
 
 #include <linux/drbd.h>


From drbd-user@lists.linbit.com  Tue Aug 17 14:44:42 2004
From: drbd-user@lists.linbit.com (drbd-user@lists.linbit.com)
Date: Tue, 17 Aug 2004 15:44:42 +0200 (CEST)
Subject: [DRBD-cvs] r1491 - in trunk: drbd testing
Message-ID: <20040817134442.A5F983BE6E@garcon.linbit.com>

Author: lars
Date: 2004-08-17 15:44:40 +0200 (Tue, 17 Aug 2004)
New Revision: 1491

Modified:
   trunk/drbd/drbd_main.c
   trunk/drbd/drbd_receiver.c
   trunk/drbd/drbd_worker.c
   trunk/testing/read_gc.pl
   trunk/testing/write_gc.pl
Log:
linux 2.4.X does not have mm_inline.h
added MDF_FullSync to read/write gc.pl

Modified: trunk/drbd/drbd_main.c
===================================================================
--- trunk/drbd/drbd_main.c	2004-08-14 12:29:43 UTC (rev 1490)
+++ trunk/drbd/drbd_main.c	2004-08-17 13:44:40 UTC (rev 1491)
@@ -45,7 +45,9 @@
 #include <linux/proc_fs.h>
 #include <linux/init.h>
 #include <linux/mm.h>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 #include <linux/mm_inline.h>
+#endif
 #include <linux/slab.h>
 #include <linux/devfs_fs_kernel.h>
 

Modified: trunk/drbd/drbd_receiver.c
===================================================================
--- trunk/drbd/drbd_receiver.c	2004-08-14 12:29:43 UTC (rev 1490)
+++ trunk/drbd/drbd_receiver.c	2004-08-17 13:44:40 UTC (rev 1491)
@@ -39,7 +39,9 @@
 #include <linux/fs.h>
 #include <linux/file.h>
 #include <linux/mm.h>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 #include <linux/mm_inline.h>
+#endif
 #include <linux/slab.h>
 #include <linux/smp_lock.h>
 #include <linux/pkt_sched.h>

Modified: trunk/drbd/drbd_worker.c
===================================================================
--- trunk/drbd/drbd_worker.c	2004-08-14 12:29:43 UTC (rev 1490)
+++ trunk/drbd/drbd_worker.c	2004-08-17 13:44:40 UTC (rev 1491)
@@ -32,7 +32,9 @@
 #include <linux/smp_lock.h>
 #include <linux/wait.h>
 #include <linux/mm.h>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 #include <linux/mm_inline.h> // for the page_count macro on RH/Fedora
+#endif
 #include <linux/slab.h>
 
 #include <linux/drbd.h>

Modified: trunk/testing/read_gc.pl
===================================================================
--- trunk/testing/read_gc.pl	2004-08-14 12:29:43 UTC (rev 1490)
+++ trunk/testing/read_gc.pl	2004-08-17 13:44:40 UTC (rev 1491)
@@ -42,10 +42,15 @@
 
     die "state file corrupt" if($MagicNr != DRBD_MD_MAGIC);
 
-    printf(" %6s | %3s | %3d | %3d | %3d | %3d | %3s | %3s | %6d KB\n",
-	   $resource,$Flags & 0x01 ? "1/c" : "0/i",$HumanCnt,$TimeoutCnt,
-	   $ConnectedCnt,$ArbitraryCnt,$Flags & 0x02 ? "1/p" : "0/s",
-	   $Flags & 0x04 ? "1/c" : "0/n",$size);
+    printf(" %6s | %3s | %3d | %3d | %3d | %3d | %3s | %3s | %3s | %6d KB\n",
+	   $resource,
+	   $Flags & 0x01 ? "1/c" : "0/i", # is consistent
+	                                  # (may become sync source)
+	   $HumanCnt, $TimeoutCnt, $ConnectedCnt, $ArbitraryCnt,
+	   $Flags & 0x02 ? "1/p" : "0/s", # last state
+	   $Flags & 0x04 ? "1/c" : "0/n", # was connected
+	   $Flags & 0x08 ? "yes" : " no", # wants full sync
+	   $size);
 
     ioctl(GCF,BLKFLSBUF,0);  # Ask the buffer cache to forget this buffer. 
 
@@ -61,15 +66,16 @@
     @resources = sort(split(' ',`drbdadm sh-resources`));
 
     print <<EOS;
-                                     ConnectedInd |
-                                  lastState |     |
-                         ArbitraryCnt |     |     |
-                   ConnectedCnt |     |     |     |
-               TimeoutCnt |     |     |     |     |
-           HumanCnt |     |     |     |     |     |
-   Consistent |     |     |     |     |     |     |
-resource|     |     |     |     |     |     |     |   Size
---------+-----+-----+-----+-----+-----+-----+-----+----------+
+                                           WantFullSync |
+                                     ConnectedInd |     |
+                                  lastState |     |     |
+                         ArbitraryCnt |     |     |     |
+                   ConnectedCnt |     |     |     |     |
+               TimeoutCnt |     |     |     |     |     |
+           HumanCnt |     |     |     |     |     |     |
+   Consistent |     |     |     |     |     |     |     |
+resource|     |     |     |     |     |     |     |     |   Size
+--------+-----+-----+-----+-----+-----+-----+-----+-----+----------+
 EOS
 
     for $res (@resources) {

Modified: trunk/testing/write_gc.pl
===================================================================
--- trunk/testing/write_gc.pl	2004-08-14 12:29:43 UTC (rev 1490)
+++ trunk/testing/write_gc.pl	2004-08-17 13:44:40 UTC (rev 1491)
@@ -23,7 +23,8 @@
 sub write_gc_file
 {
     my ($md_dev,$md_index,$del_al,$Consistent,$HumanCnt,$TimeoutCnt,
-	$ConnectedCnt,$ArbitraryCnt,$lastState,$ConnectedInd) = @_;
+	$ConnectedCnt,$ArbitraryCnt,$lastState,$ConnectedInd,
+	$WantFullSync) = @_;
     my ($Flags,$rr,$pos,$md_start,$out);
 
     ensure_default(\$Consistent,"Consistent",1);
@@ -33,6 +34,7 @@
     ensure_default(\$ArbitraryCnt,"ArbitraryCnt",1);
     ensure_default(\$lastState,"lastState",0);
     ensure_default(\$ConnectedInd,"ConnectedInd",0);
+    ensure_default(\$WantFullSync,"WantFullSync",0);
 
     sysopen (GCF,$md_dev,O_WRONLY)
 	or die "can not open GC file";
@@ -57,6 +59,7 @@
     if($Consistent)    { $Flags |= 0x01; }
     if($lastState)     { $Flags |= 0x02; }
     if($ConnectedInd)  { $Flags |= 0x04; }
+    if($WantFullSync)  { $Flags |= 0x08; }
 
     $out = pack("N6", $Flags,$HumanCnt,$TimeoutCnt,$ConnectedCnt,
 		$ArbitraryCnt, DRBD_MD_MAGIC);
@@ -115,4 +118,3 @@
 
 
 main(@ARGV);
-


From drbd-user@lists.linbit.com  Wed Aug 18 21:01:44 2004
From: drbd-user@lists.linbit.com (drbd-user@lists.linbit.com)
Date: Wed, 18 Aug 2004 22:01:44 +0200 (CEST)
Subject: [DRBD-cvs] r1492 - trunk/scripts
Message-ID: <20040818200144.D68743BE6E@garcon.linbit.com>

Author: lars
Date: 2004-08-18 22:01:40 +0200 (Wed, 18 Aug 2004)
New Revision: 1492

Modified:
   trunk/scripts/drbd
Log:
 drbd status: be nice to heartbeat! 

Modified: trunk/scripts/drbd
===================================================================
--- trunk/scripts/drbd	2004-08-17 13:44:40 UTC (rev 1491)
+++ trunk/scripts/drbd	2004-08-18 20:01:40 UTC (rev 1492)
@@ -72,10 +72,14 @@
 	echo "."
 	;;
     status)
+	# NEEDS to be heartbeat friendly...
+	# so: put some "OK" in the output.
 	if [ -e $PROC_DRBD ]; then
+	    echo "drbd driver loaded OK; device status:"
 	    cat $PROC_DRBD
 	    exit 0
 	else
+	    echo >&2 "drbd not loaded"
 	    exit 3
 	fi
 	;;


From drbd-user@lists.linbit.com  Thu Aug 19 09:48:28 2004
From: drbd-user@lists.linbit.com (drbd-user@lists.linbit.com)
Date: Thu, 19 Aug 2004 10:48:28 +0200 (CEST)
Subject: [DRBD-cvs] r1493 - trunk/debian
Message-ID: <20040819084828.3B16F3BE6E@garcon.linbit.com>

Author: phil
Date: 2004-08-19 10:48:25 +0200 (Thu, 19 Aug 2004)
New Revision: 1493

Modified:
   trunk/debian/drbd.postinst
Log:
Fixed debian's postinst script to create /dev/drbd? instead of /dev/nb?


Modified: trunk/debian/drbd.postinst
===================================================================
--- trunk/debian/drbd.postinst	2004-08-18 20:01:40 UTC (rev 1492)
+++ trunk/debian/drbd.postinst	2004-08-19 08:48:25 UTC (rev 1493)
@@ -5,6 +5,10 @@
 fi
 
 # Make sure /dev/nb[0-7] devices exist
-cd /dev; for a in `seq 0 7`; do MAKEDEV nb$a; done
+# cd /dev; for a in `seq 0 7`; do MAKEDEV nb$a; done
 
+for i in `seq 0 15` ; do 
+    test -b /dev/drbd$i || mknod /dev/drbd$i b 147 $i; 
+done
+
 #DEBHELPER#


From drbd-user@lists.linbit.com  Fri Aug 20 14:07:27 2004
From: drbd-user@lists.linbit.com (drbd-user@lists.linbit.com)
Date: Fri, 20 Aug 2004 15:07:27 +0200 (CEST)
Subject: [DRBD-cvs] r1494 - trunk/drbd
Message-ID: <20040820130727.9B3FE3BE6E@garcon.linbit.com>

Author: lars
Date: 2004-08-20 15:07:22 +0200 (Fri, 20 Aug 2004)
New Revision: 1494

Modified:
   trunk/drbd/drbd_main.c
   trunk/drbd/drbd_proc.c
   trunk/drbd/drbd_worker.c
Log:
prevent in-kernel buffer overflow in drbd_proc.c
add some missing include linux/version.h

Modified: trunk/drbd/drbd_main.c
===================================================================
--- trunk/drbd/drbd_main.c	2004-08-19 08:48:25 UTC (rev 1493)
+++ trunk/drbd/drbd_main.c	2004-08-20 13:07:22 UTC (rev 1494)
@@ -35,6 +35,7 @@
 
 #include <linux/config.h>
 #include <linux/module.h>
+#include <linux/version.h>
 
 #include <asm/uaccess.h>
 #include <asm/types.h>

Modified: trunk/drbd/drbd_proc.c
===================================================================
--- trunk/drbd/drbd_proc.c	2004-08-19 08:48:25 UTC (rev 1493)
+++ trunk/drbd/drbd_proc.c	2004-08-20 13:07:22 UTC (rev 1494)
@@ -66,11 +66,18 @@
 	/* note: both rs_total and rs_left are in bits, i.e. in
 	 * units of BM_BLOCK_SIZE.
 	 * for the percentage, we don't care. */
+
 	rs_left = drbd_bm_total_weight(mdev);
-	D_ASSERT(rs_left < mdev->rs_total);
 	/* >> 10 to prevent overflow,
 	 * +1 to prevent division by zero */
-	res = (rs_left >> 10)*1000/((mdev->rs_total >> 10) + 1);
+	ERR_IF(rs_left > mdev->rs_total) {
+		/* doh. logic bug somewhere.
+		 * for now, just try to prevent in-kernel buffer overflow.
+		 */
+		res = 1000;
+	} else {
+		res = (rs_left >> 10)*1000/((mdev->rs_total >> 10) + 1);
+	}
 	{
 		int i, y = res/50, x = 20-y;
 		sz += sprintf(buf + sz, "\t[");

Modified: trunk/drbd/drbd_worker.c
===================================================================
--- trunk/drbd/drbd_worker.c	2004-08-19 08:48:25 UTC (rev 1493)
+++ trunk/drbd/drbd_worker.c	2004-08-20 13:07:22 UTC (rev 1494)
@@ -27,6 +27,7 @@
 
 #include <linux/config.h>
 #include <linux/module.h>
+#include <linux/version.h>
 
 #include <linux/sched.h>
 #include <linux/smp_lock.h>


From drbd-user@lists.linbit.com  Sun Aug 22 12:34:18 2004
From: drbd-user@lists.linbit.com (drbd-user@lists.linbit.com)
Date: Sun, 22 Aug 2004 13:34:18 +0200 (CEST)
Subject: [DRBD-cvs] r1495 - trunk
Message-ID: <20040822113418.3E5203BE6E@garcon.linbit.com>

Author: lars
Date: 2004-08-22 13:34:15 +0200 (Sun, 22 Aug 2004)
New Revision: 1495

Modified:
   trunk/ChangeLog
Log:
added cumulative changelog entries since latest tarball to ChangeLog

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2004-08-20 13:07:22 UTC (rev 1494)
+++ trunk/ChangeLog	2004-08-22 11:34:15 UTC (rev 1495)
@@ -1,3 +1,18 @@
+Latest:
+------
+ Last updated 2004-08-22.
+ Cumulative changes since last tarball.
+ For even more detail, use "svn log".
+
+ * prevent possible in-kernel buffer overflow in drbd_proc.c
+ * Fixed debian's postinst script to create /dev/drbd? instead of /dev/nb?
+ * drbd status:
+   be nice to heartbeat, include "OK" in output.
+ * added FullSync meta data flag to read/write gc.pl
+ * make the RHEL3 happy (page_count no longer in mm.h, but in mm_inline.h)
+ * [Patch by Pavel Semerad]. Also use the drbd_devfs_name on Linux-2.4.x
+ * fix missing dependencies on drbd_config.h
+
 0.7.2 (api:75/proto:74)
 -----
   *) Proper handling of backing storage devices that occasionally fail 


From drbd-user@lists.linbit.com  Sun Aug 22 12:46:26 2004
From: drbd-user@lists.linbit.com (drbd-user@lists.linbit.com)
Date: Sun, 22 Aug 2004 13:46:26 +0200 (CEST)
Subject: [DRBD-cvs] r1496 - trunk
Message-ID: <20040822114626.ADD463BE6E@garcon.linbit.com>

Author: lars
Date: 2004-08-22 13:46:24 +0200 (Sun, 22 Aug 2004)
New Revision: 1496

Modified:
   trunk/ChangeLog
Log:
expand svn keywords on ChangeLog

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2004-08-22 11:34:15 UTC (rev 1495)
+++ trunk/ChangeLog	2004-08-22 11:46:24 UTC (rev 1496)
@@ -1,8 +1,9 @@
 Latest:
 ------
- Last updated 2004-08-22.
+ ChangeLog last updated:
+  $LastChangedRevision$ $LastChangedDate$
  Cumulative changes since last tarball.
- For even more detail, use "svn log".
+ For even more detail, use "svn log" and "svn diff".
 
  * prevent possible in-kernel buffer overflow in drbd_proc.c
  * Fixed debian's postinst script to create /dev/drbd? instead of /dev/nb?


Property changes on: trunk/ChangeLog
___________________________________________________________________
Name: svn:keywords
   + LastChangedDate LastChangedRevision


From drbd-user@lists.linbit.com  Sun Aug 22 12:50:50 2004
From: drbd-user@lists.linbit.com (drbd-user@lists.linbit.com)
Date: Sun, 22 Aug 2004 13:50:50 +0200 (CEST)
Subject: [DRBD-cvs] r1497 - trunk
Message-ID: <20040822115050.D965E3BE6E@garcon.linbit.com>

Author: lars
Date: 2004-08-22 13:50:48 +0200 (Sun, 22 Aug 2004)
New Revision: 1497

Modified:
   trunk/ChangeLog
Log:
reverted: expand svn keywords on ChangeLog; 
intention was that this shows up in http://svn.drbd.org/...
but it does not, so we need to do this by hand.

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2004-08-22 11:46:24 UTC (rev 1496)
+++ trunk/ChangeLog	2004-08-22 11:50:48 UTC (rev 1497)
@@ -1,7 +1,6 @@
 Latest:
 ------
- ChangeLog last updated:
-  $LastChangedRevision$ $LastChangedDate$
+ ChangeLog last updated: r1496 2004-08-22
  Cumulative changes since last tarball.
  For even more detail, use "svn log" and "svn diff".
 


Property changes on: trunk/ChangeLog
___________________________________________________________________
Name: svn:keywords
   - LastChangedDate LastChangedRevision


From svn at svn.drbd.org  Mon Aug 23 23:55:04 2004
From: svn at svn.drbd.org (svn@svn.drbd.org)
Date: Mon Aug 23 23:55:07 2004
Subject: [DRBD-cvs] r1498 - in trunk/drbd: . linux
Message-ID: <20040823215504.E48E23BE6E@garcon.linbit.com>

Author: lars
Date: 2004-08-23 23:54:58 +0200 (Mon, 23 Aug 2004)
New Revision: 1498

Modified:
   trunk/drbd/drbd_main.c
   trunk/drbd/drbd_receiver.c
   trunk/drbd/drbd_worker.c
   trunk/drbd/linux/drbd_config.h
Log:
some redhat 2.4.flavours DO have mm_inline.h :-/

Modified: trunk/drbd/drbd_main.c
===================================================================
--- trunk/drbd/drbd_main.c	2004-08-22 11:50:48 UTC (rev 1497)
+++ trunk/drbd/drbd_main.c	2004-08-23 21:54:58 UTC (rev 1498)
@@ -46,7 +46,7 @@
 #include <linux/proc_fs.h>
 #include <linux/init.h>
 #include <linux/mm.h>
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) || defined(HAVE_MM_INLINE_H)
 #include <linux/mm_inline.h>
 #endif
 #include <linux/slab.h>

Modified: trunk/drbd/drbd_receiver.c
===================================================================
--- trunk/drbd/drbd_receiver.c	2004-08-22 11:50:48 UTC (rev 1497)
+++ trunk/drbd/drbd_receiver.c	2004-08-23 21:54:58 UTC (rev 1498)
@@ -39,7 +39,7 @@
 #include <linux/fs.h>
 #include <linux/file.h>
 #include <linux/mm.h>
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) || defined(HAVE_MM_INLINE_H)
 #include <linux/mm_inline.h>
 #endif
 #include <linux/slab.h>

Modified: trunk/drbd/drbd_worker.c
===================================================================
--- trunk/drbd/drbd_worker.c	2004-08-22 11:50:48 UTC (rev 1497)
+++ trunk/drbd/drbd_worker.c	2004-08-23 21:54:58 UTC (rev 1498)
@@ -33,7 +33,7 @@
 #include <linux/smp_lock.h>
 #include <linux/wait.h>
 #include <linux/mm.h>
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) || defined(HAVE_MM_INLINE_H)
 #include <linux/mm_inline.h> // for the page_count macro on RH/Fedora
 #endif
 #include <linux/slab.h>

Modified: trunk/drbd/linux/drbd_config.h
===================================================================
--- trunk/drbd/linux/drbd_config.h	2004-08-22 11:50:48 UTC (rev 1497)
+++ trunk/drbd/linux/drbd_config.h	2004-08-23 21:54:58 UTC (rev 1498)
@@ -44,6 +44,12 @@
  * anyways...
  */
 //#define REDHAT_2_4_18
+/* some redhat 2.4.X-Y.Z.whatever kernel flavours have an mm_inline.h,
+ * which needs to be included explicitly. most 2.4.x kernels don't have that
+ * header file at all. So uncomment for these, and ignore for all others.
+ * in 2.6., it will be included anyways.
+ */
+//#define HAVE_MM_INLINE_H
 
 //Your 2.4 verndor kernel already defines find_next_bit()
 //#define HAVE_FIND_NEXT_BIT

From svn at svn.drbd.org  Tue Aug 24 00:37:02 2004
From: svn at svn.drbd.org (svn@svn.drbd.org)
Date: Tue Aug 24 00:37:08 2004
Subject: [DRBD-cvs] r1499 - trunk/drbd
Message-ID: <20040823223702.4F2533BE6E@garcon.linbit.com>

Author: lars
Date: 2004-08-24 00:36:57 +0200 (Tue, 24 Aug 2004)
New Revision: 1499

Modified:
   trunk/drbd/drbd_main.c
   trunk/drbd/drbd_receiver.c
   trunk/drbd/drbd_worker.c
Log:
HAVE_MM_INLINE_H is defined in drbd_config.h; so we need to include it first

Modified: trunk/drbd/drbd_main.c
===================================================================
--- trunk/drbd/drbd_main.c	2004-08-23 21:54:58 UTC (rev 1498)
+++ trunk/drbd/drbd_main.c	2004-08-23 22:36:57 UTC (rev 1499)
@@ -46,7 +46,8 @@
 #include <linux/proc_fs.h>
 #include <linux/init.h>
 #include <linux/mm.h>
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) || defined(HAVE_MM_INLINE_H)
+#include <linux/drbd_config.h>
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)) || defined(HAVE_MM_INLINE_H)
 #include <linux/mm_inline.h>
 #endif
 #include <linux/slab.h>

Modified: trunk/drbd/drbd_receiver.c
===================================================================
--- trunk/drbd/drbd_receiver.c	2004-08-23 21:54:58 UTC (rev 1498)
+++ trunk/drbd/drbd_receiver.c	2004-08-23 22:36:57 UTC (rev 1499)
@@ -39,7 +39,8 @@
 #include <linux/fs.h>
 #include <linux/file.h>
 #include <linux/mm.h>
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) || defined(HAVE_MM_INLINE_H)
+#include <linux/drbd_config.h>
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)) || defined(HAVE_MM_INLINE_H)
 #include <linux/mm_inline.h>
 #endif
 #include <linux/slab.h>

Modified: trunk/drbd/drbd_worker.c
===================================================================
--- trunk/drbd/drbd_worker.c	2004-08-23 21:54:58 UTC (rev 1498)
+++ trunk/drbd/drbd_worker.c	2004-08-23 22:36:57 UTC (rev 1499)
@@ -33,7 +33,8 @@
 #include <linux/smp_lock.h>
 #include <linux/wait.h>
 #include <linux/mm.h>
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) || defined(HAVE_MM_INLINE_H)
+#include <linux/drbd_config.h>
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)) || defined(HAVE_MM_INLINE_H)
 #include <linux/mm_inline.h> // for the page_count macro on RH/Fedora
 #endif
 #include <linux/slab.h>

From svn at svn.drbd.org  Tue Aug 24 15:48:59 2004
From: svn at svn.drbd.org (svn@svn.drbd.org)
Date: Tue Aug 24 15:49:01 2004
Subject: [DRBD-cvs] r1500 - in trunk: drbd scripts
Message-ID: <20040824134859.7D17E3BE6E@garcon.linbit.com>

Author: lars
Date: 2004-08-24 15:48:56 +0200 (Tue, 24 Aug 2004)
New Revision: 1500

Added:
   trunk/scripts/adjust_drbd_config_h.sh
Modified:
   trunk/drbd/Makefile
Log:
added drbd_config.h auto adjustment magic

Modified: trunk/drbd/Makefile
===================================================================
--- trunk/drbd/Makefile	2004-08-23 22:36:57 UTC (rev 1499)
+++ trunk/drbd/Makefile	2004-08-24 13:48:56 UTC (rev 1500)
@@ -66,6 +66,8 @@
     KDIR := /lib/modules/$(shell uname -r)/build
   endif
 
+  # shell ls, because some of them may be missing
+  # inside a patched kernel source tree
   SRC_FILES := $(shell ls 2>/dev/null\
 	linux/drbd_config.h linux/drbd.h drbd_actlog.c drbd_bitmap.c drbd_fs.c \
 	drbd_main.c drbd_proc.c drbd_receiver.c drbd_req.c drbd_worker.c \
@@ -98,6 +100,8 @@
 
   kbuild: drbd_buildtag.c
 	@rm -f .kernelrelease*
+	test -x ../scripts/adjust_drbd_config_h.sh && \
+	 KDIR=$(KDIR) ../scripts/adjust_drbd_config_h.sh
 	$(MAKE) -C $(KDIR) SUBDIRS=$(DRBDSRC) $(ARCH_UM) modules
 	@mv .kernelrelease.new .kernelrelease
 	@echo -n "Memorizing module configuration ... "
@@ -161,5 +165,5 @@
 
   depmod:
 	[ -e $(KDIR)/System.map ] && [ -e ./$(MODOBJ) ] && \
-	   /sbin/depmod -F $(KDIR)/System.map -e ./$(MODOBJ) 2>&1 >/dev/null
+	   /sbin/depmod -F $(KDIR)/System.map -e ./$(MODOBJ) # 2>&1 >/dev/null
 endif

Added: trunk/scripts/adjust_drbd_config_h.sh
===================================================================
--- trunk/scripts/adjust_drbd_config_h.sh	2004-08-23 22:36:57 UTC (rev 1499)
+++ trunk/scripts/adjust_drbd_config_h.sh	2004-08-24 13:48:56 UTC (rev 1500)
@@ -0,0 +1,102 @@
+#!/bin/bash
+# drbd_config.h auto edit magic for 2.4 kernels ...
+
+# expects KDIR in the environment to be set correctly!
+
+set -e
+grep_q() { grep "$@" &>/dev/null ; }
+
+# PARANOIA:
+test -e ./linux/drbd_config.h || {
+       echo >&2 "oops, invoced in unexpected directory..."
+       exit 1
+}
+
+test -n "$KDIR"
+KDIR=${KDIR%/}
+
+ls >/dev/null \
+$KDIR/{.config,Makefile,include/{linux/{version,sched,list,fs},asm/bitops}.h}
+
+
+if grep_q "^PATCHLEVEL *= *4" $KDIR/Makefile ; then
+  # do we have the threadding stuff in the kernel,
+  # and need to use the sighand lock instead of the signal lock?
+  if grep_q "^struct sighand_struct {" $KDIR/include/linux/sched.h ; then
+    need_sighand_hack=1
+  else
+    need_sighand_hack=0
+  fi
+
+  # do we have hlist support already?
+  if grep_q "^struct hlist_head {" $KDIR/include/linux/list.h; then
+    hlist_backport=1
+  else
+    hlist_backport=0
+  fi
+
+  # is this a 2.4.18 kernel, which is supposed to have BH_launder,
+  # but already has BH_Launder?
+  if
+    grep_q '^SUBLEVEL *= *18$' $KDIR/Makefile &&
+    grep_q 'BH_Launder' $KDIR/include/linux/fs.h
+  then
+    need_RH_2_4_18_hack=1
+  else
+    need_RH_2_4_18_hack=0
+  fi
+
+  # do we have find_next_bit?
+  if
+    cat 2>/dev/null $KDIR/include/asm{,/arch}/bitops.h |
+    grep_q 'find_next_bit'
+  then
+    have_find_next_bit=1
+  else
+    have_find_next_bit=0
+  fi
+
+  # TODO autodetect whether we need this:
+  # USE_GENERIC_FIND_NEXT_BIT
+  # 
+
+  # do we have mm_inline, and need to include it explicitly?
+  if test -e $KDIR/include/linux/mm_inline.h ; then
+    have_mm_inline_h=1
+  else
+    have_mm_inline_h=0
+  fi
+else
+    # 2.6. kernel. just leave it alone...
+    need_sighand_hack=0
+    hlist_backport=0
+    need_RH_2_4_18_hack=0
+    have_find_next_bit=0
+    have_mm_inline_h=0
+fi
+
+test -e ./linux/drbd_config.h.orig || cp ./linux/drbd_config.h{,.orig}
+
+perl -i -pe "
+ s{.*(#define SIGHAND_HACK.*)}
+  { ( $need_sighand_hack ? '' : '//' ) . \$1}e;
+ s{.*(#define REDHAT_HLIST_BACKPORT.*)}
+  { ( $hlist_backport ? '' : '//' ) . \$1}e;
+ s{.*(#define REDHAT_2_4_18.*)}
+  { ( $need_RH_2_4_18_hack ? '' : '//' ) . \$1}e;
+ s{.*(#define HAVE_FIND_NEXT_BIT.*)}
+  { ( $have_find_next_bit ? '' : '//' ) . \$1}e;
+ s{.*(#define HAVE_MM_INLINE_H.*)}
+  { ( $have_mm_inline_h ? '' : '//' ) . \$1}e;" ./linux/drbd_config.h
+
+
+if ! DIFF=$(diff -s -U0 ./linux/drbd_config.h{.orig,}) ; then
+  sed -e 's/^/  /' <<___
+
+Adjusted drbd_config.h:
+$DIFF
+
+___
+else
+	echo -e "\n  Using unmodified drbd_config.h\n"
+fi


Property changes on: trunk/scripts/adjust_drbd_config_h.sh
___________________________________________________________________
Name: svn:executable
   + *

From svn at svn.drbd.org  Tue Aug 24 16:11:04 2004
From: svn at svn.drbd.org (svn@svn.drbd.org)
Date: Tue Aug 24 16:11:06 2004
Subject: [DRBD-cvs] r1501 - trunk
Message-ID: <20040824141104.972293BE6E@garcon.linbit.com>

Author: lars
Date: 2004-08-24 16:11:02 +0200 (Tue, 24 Aug 2004)
New Revision: 1501

Modified:
   trunk/INSTALL
Log:
added some links to INSTALL

Modified: trunk/INSTALL
===================================================================
--- trunk/INSTALL	2004-08-24 13:48:56 UTC (rev 1500)
+++ trunk/INSTALL	2004-08-24 14:11:02 UTC (rev 1501)
@@ -9,7 +9,8 @@
 kernel source Makefile, so we no longer need to worry about
 all those funny kernel compile flags...
 
-It is still correct for 0.6.12. Maybe this needs an update for 0.7.x,
+It is still correct for 0.6.13.
+Maybe this needs an update for 0.7.x,
 but most of it probably still applies.
 
 I tried to indicate what you should type by the prompt-prefix
@@ -21,6 +22,15 @@
 For FAQs, publications and other stuff see also the documentation
 subdirectory, and of course http://www.drbd.org .
 
+Other interessting links:
+ http://www.drbd.org
+ http://www.drbd.org/drbd-article.html
+ http://www.linux-mag.com/2003-11/drbd_01.html
+ http://www.linux-mag.com/2003-11/toc.html
+ http://linuxha.trick.ca/DRBD_2fFAQ
+and of course,
+ http://www.drbd.org/support.html
+
 == Prerequisites ==
 
  You need to install the kernel-source package
@@ -114,6 +124,10 @@
    look into ./drbd_config.h, and (un)comment some of the
    settings appropriately.
 
+   Since 0.7.3, we have script/adjust_drbd_config_h.sh, which helps you 
+   with this, and gets called during the normal build process,
+   so you "should" no longer need to adjust it by hand.
+
        all# cd drbd-0.6.12/drbd  # kernel module sub directory
        all# make clean all
     fedora# make clean all CC=gcc32
@@ -133,7 +147,7 @@
    Note that it should build against preconfigured kernel-headers, too,
    like in "make KDIR=/usr/src/linux-include/athlon". But then you
    should be very sure that your running kernel matches the
-   configuration of that header tree exactly.
+   configuration of that header tree ''exactly''.
 
 == Patching DRBD into the kernel ==
 
@@ -280,4 +294,4 @@
 	Lars Ellenberg
 
 
-Last modified: Mon Apr 26 09:27:50 UTC 2004
+Last modified: Tue Aug 24 14:07:40 UTC 2004

From svn at svn.drbd.org  Tue Aug 24 17:09:32 2004
From: svn at svn.drbd.org (svn@svn.drbd.org)
Date: Tue Aug 24 17:09:35 2004
Subject: [DRBD-cvs] r1502 - trunk
Message-ID: <20040824150932.809963BE6E@garcon.linbit.com>

Author: lars
Date: 2004-08-24 17:09:30 +0200 (Tue, 24 Aug 2004)
New Revision: 1502

Modified:
   trunk/INSTALL
Log:
merged some of the linuxha-wiki online version of INSTALL into our SVN version.
in the long run, we should have only one soure for this file...

Modified: trunk/INSTALL
===================================================================
--- trunk/INSTALL	2004-08-24 14:11:02 UTC (rev 1501)
+++ trunk/INSTALL	2004-08-24 15:09:30 UTC (rev 1502)
@@ -4,15 +4,15 @@
 It should work for SuSE, Debian, RH and other distros with slight
 modifications.
 
-This was written for 0.6.10, and might not work for releases
-before that, since we changed our Makefile to use the top level
-kernel source Makefile, so we no longer need to worry about
-all those funny kernel compile flags...
+   This was written for 0.6.10, and might not work for releases
+   before that, since we changed our Makefile to use the top level
+   kernel source Makefile, so we no longer need to worry about
+   all those funny kernel compile flags...
+   
+   It is still correct for 0.6.13.
+   Maybe this needs an update for 0.7.x,
+   but most of it probably still applies.
 
-It is still correct for 0.6.13.
-Maybe this needs an update for 0.7.x,
-but most of it probably still applies.
-
 I tried to indicate what you should type by the prompt-prefix
 on the below command lines. "all#", when it is the same for
 all distros, and e.g. "suse#", when I think this is specific for
@@ -22,25 +22,34 @@
 For FAQs, publications and other stuff see also the documentation
 subdirectory, and of course http://www.drbd.org .
 
-Other interessting links:
- http://www.drbd.org
- http://www.drbd.org/drbd-article.html
- http://www.linux-mag.com/2003-11/drbd_01.html
- http://www.linux-mag.com/2003-11/toc.html
- http://linuxha.trick.ca/DRBD_2fFAQ
-and of course,
- http://www.drbd.org/support.html
+Other helpful links:
 
+	http://www.drbd.org
+	http://www.drbd.org/drbd-article.html
+	http://www.linux-mag.com/2003-11/drbd_01.html
+	http://www.linux-mag.com/2003-11/toc.html
+	http://linuxha.trick.ca/DRBD_2fFAQ , and of course,
+	http://www.drbd.org/support.html
+
 == Prerequisites ==
 
- You need to install the kernel-source package
+ You need to install the kernel-source package. Or, if you run the default
+ distribution kernel, and there is some "precompiled kernel headers"
+ directory, you can skip this, and compile against that directory of header
+ files. If so, skip the "Prepare" section, and just jump to "Build DRBD".
 
        rpm.distros# rpm -Uhv kernel-source-2.4.XX-YYY.rpm
             debian# apt-get install kernel-source 
         kernel.org# tar --bzip2 -xvf linux-2.4.XX.tar.bz2
 
- And you should have a build-system installed, i.e. gcc, make, etc.
+ Note: this is really kernel-source.rpm, NOT kernel.src.rpm.
+ You don't want to use the latter, unless you know _exactly_ why...
 
+ If you want to use a 2.6.x kernel, you need to use DRBD-0.7.;
+ 0.6 just won't compile.
+
+ Obviously you should have a build-system installed, i.e. gcc, make, etc. ;)
+
  You should make sure that the gcc you use to compile the module
  is the same which was used to build the kernel you are running.
  On recent SuSE this is gcc-3.2, and the default gcc anyways --
@@ -48,7 +57,7 @@
  thingy, and then wonder why kernel modules no longer work properly.
 
  Note: for a 2.2.x kernel, you need to add a line to kernel/ksyms.c,
- see debian/kernel-export-wup.patch .
+ see debian/kernel-export-wup.patch . But who cares for 2.2, nowadays?
 
  So what next?
 
@@ -94,15 +103,21 @@
              # vi Makefile #mod EXTRAVERSION to match installed kernel
              # yes "" | { make oldconfig ; make oldconfig ; }
 
-   Note:
-   If you consider to not run some vendor kernel, but compile
-   your own kernel, you need to build in module support, since
-   DRBD is a module.  DRBD depends on procfs, but you want to
-   have that anyways.  Make sure that you do not compile NBD
-   into the kernel, since DRBD uses the same major device
-   number. Having it as module is ok, but you cannot use both
-   at the same time.
+    Note:
+    If you consider to not run some vendor kernel, but compile
+    your own kernel, you need to build in module support, since
+    DRBD is a module.  DRBD depends on procfs, but you want to
+    have that anyways.  Make sure that you do not compile NBD
+    into the kernel, since DRBD uses the same major device
+    number. Having it as module is ok, but you cannot use both
+    at the same time.
 
+      Update:
+      since we now (0.7.1 and later) have an officially assigned
+      device major number (147) and device nodes (/dev/drbd), we no longer
+      hijack NBDs major numbers. You now in fact _can_ use NBD in parallel
+      with DRBD, if it makes any sense in your setup...
+
    So if necessary, "make menuconfig" and adapt to your own
    preferences, but then you need to compile and install this
    kernel.  Modules compiled against this kernel source tree
@@ -168,8 +183,11 @@
    or rebuild and install the new kernel
    ("make bzImage" or "make linux ARCH=um" or ...)
 
-== Build DRBD user space tools ==
+== Build DRBD user space tools only ==
 
+   If you took the 'patch kernel' approach, you still need to build the
+   user space tools.
+
        all# cd /usr/src/drbd-0.6.12/user
        all# make
 
@@ -188,13 +206,13 @@
 
 == Configure it ==
 
-   If you have not used DRBD before, have browse on http://www.drbd.org
+   If you have not used DRBD before, have a browse on http://www.drbd.org .
    You should find some interesting stuff on the "Documentation"
    and "Publications" sub pages.
 
    In any case, have a look at the example configuration file in
    ./scripts/drbd.conf, which is well commented.
-   Maybe we added a new config option, or deprecated an other :)
+   Maybe we added a new config option, or deprecated an other ;)
 
 == Why ... ? ==
 
@@ -204,24 +222,26 @@
    right, and I don't want to screw up the precompiled
    documentation and man-pages that come with the .tar.gz ...
 
+   Note: since 0.7, to rebuild the documentation, you need to
+   explicitly ask for it: "make doc"
+
 == Troubleshooting ==
 
    Added on your feedback and request, if necessary... ;-)
 
-   Eventually we will have a Wiki for this.
+   Also, have a look at http://www.drbd.org , the FAQ at
+   http://linuxha.trick.ca/DRBD , and the other links mentioned
+   at the top of this page.
 
 == Building a .rpm of it ==
 
-   This section probably needs some update for 0.7,
-   but maybe it just works anyways ?
+   This should be fairly easy, there is an example spec
+   file, and you can even "make rpm".  If this is a CVS/SVN version,
+   you might need to say "make rpm FORCE=1".
 
    There are caveats, please have a look at ./README, too,
    you might want/need to edit the ./drbd.spec file.
 
-   This should be fairly easy, there is an example spec
-   file, and you can even "make rpm".  If this is a CVS version,
-   you might need to say "make rpm FORCE=1".
-
    Note that it should build against preconfigured kernel-headers, too,
    like in "make rpm KDIR=/usr/src/linux-include/athlon",
    "make rpm KDIR=/usr/src/linux-include/smp", ...
@@ -233,6 +253,10 @@
 	./dist/RPMS/i586/kernel-smp-module-drbd-0.6.12-3_2.4.21_166_4G.i586.rpm
 	...
 
+   Note however that your distro most likely handles rpms of kernel modules in
+   some special way, so you may want to first ask your ditributor to provide
+   some update packages themselves.
+
 == Building a .deb of it ==
 
    Have a look into the ./debian/* example files in place.

From svn at svn.drbd.org  Wed Aug 25 16:38:13 2004
From: svn at svn.drbd.org (svn@svn.drbd.org)
Date: Wed Aug 25 16:38:14 2004
Subject: [DRBD-cvs] r1503 - trunk/drbd
Message-ID: <20040825143813.426033BE6E@garcon.linbit.com>

Author: phil
Date: 2004-08-25 16:38:07 +0200 (Wed, 25 Aug 2004)
New Revision: 1503

Modified:
   trunk/drbd/drbd_fs.c
Log:
ignore --human primary if connected



Modified: trunk/drbd/drbd_fs.c
===================================================================
--- trunk/drbd/drbd_fs.c	2004-08-24 15:09:30 UTC (rev 1502)
+++ trunk/drbd/drbd_fs.c	2004-08-25 14:38:07 UTC (rev 1503)
@@ -724,6 +724,12 @@
 			} else {
 				return -EIO;
 			}
+		} else if (mdev->cstate >= Connected) {
+			/* do NOT increase the Human count if we are connected,
+			 * and there is no reason for it.  See
+			 * drbd_lk9.pdf middle of Page 7
+			 */
+			newstate &= ~(Human|DontBlameDrbd);
 		}
 	}
 

From svn at svn.drbd.org  Thu Aug 26 13:23:05 2004
From: svn at svn.drbd.org (svn@svn.drbd.org)
Date: Thu Aug 26 13:23:08 2004
Subject: [DRBD-cvs] r1504 - trunk/drbd
Message-ID: <20040826112305.9FEC33BE6E@garcon.linbit.com>

Author: phil
Date: 2004-08-26 13:23:02 +0200 (Thu, 26 Aug 2004)
New Revision: 1504

Modified:
   trunk/drbd/drbd_fs.c
Log:
Allow invalidate if cstate<Connected and Secondary


Modified: trunk/drbd/drbd_fs.c
===================================================================
--- trunk/drbd/drbd_fs.c	2004-08-25 14:38:07 UTC (rev 1503)
+++ trunk/drbd/drbd_fs.c	2004-08-26 11:23:02 UTC (rev 1504)
@@ -1152,19 +1152,22 @@
 		 * differentiate between different error cases,
 		 * or report the current connection state and flags back
 		 * to userspace */
-		if( mdev->cstate != Connected ||
+		if( mdev->cstate < StandAlone ||
+		    mdev->cstate > Connected ||
 		    test_bit(DISKLESS,&mdev->flags) || 
 		    test_bit(PARTNER_DISKLESS,&mdev->flags) ) {
 			err = -EINPROGRESS;
 			break;
 		}
 
-		/* avoid races with set_in_sync
-		 * for successfull mirrored writes
-		 */
-		set_cstate(mdev,WFBitMapT);
-		wait_event(mdev->cstate_wait,
-		     atomic_read(&mdev->ap_bio_cnt)==0);
+		if (mdev->cstate == Connected) {
+			/* avoid races with set_in_sync
+			 * for successfull mirrored writes
+			 */
+			set_cstate(mdev,WFBitMapT);
+			wait_event(mdev->cstate_wait,
+				   atomic_read(&mdev->ap_bio_cnt)==0);
+		}
 
 		drbd_bm_lock(mdev); // racy...
 
@@ -1178,8 +1181,10 @@
 		drbd_md_clear_flag(mdev,MDF_FullSync);
 		drbd_md_write(mdev);
 
-		drbd_send_short_cmd(mdev,BecomeSyncSource);
-		drbd_start_resync(mdev,SyncTarget);
+		if (mdev->cstate == Connected) {	
+			drbd_send_short_cmd(mdev,BecomeSyncSource);
+			drbd_start_resync(mdev,SyncTarget);
+		}
 
 		drbd_bm_unlock(mdev);
 

From svn at svn.drbd.org  Thu Aug 26 13:31:19 2004
From: svn at svn.drbd.org (svn@svn.drbd.org)
Date: Thu Aug 26 13:31:21 2004
Subject: [DRBD-cvs] r1505 - trunk/drbd
Message-ID: <20040826113119.685933BE6E@garcon.linbit.com>

Author: phil
Date: 2004-08-26 13:31:17 +0200 (Thu, 26 Aug 2004)
New Revision: 1505

Modified:
   trunk/drbd/drbd_fs.c
Log:
Dissallow the user to make a primary node SyncTarget via IOCTLs


Modified: trunk/drbd/drbd_fs.c
===================================================================
--- trunk/drbd/drbd_fs.c	2004-08-26 11:23:02 UTC (rev 1504)
+++ trunk/drbd/drbd_fs.c	2004-08-26 11:31:17 UTC (rev 1505)
@@ -1152,7 +1152,8 @@
 		 * differentiate between different error cases,
 		 * or report the current connection state and flags back
 		 * to userspace */
-		if( mdev->cstate < StandAlone ||
+		if( mdev->state == Primary || 
+		    mdev->cstate < StandAlone ||
 		    mdev->cstate > Connected ||
 		    test_bit(DISKLESS,&mdev->flags) || 
 		    test_bit(PARTNER_DISKLESS,&mdev->flags) ) {
@@ -1191,7 +1192,8 @@
 		break;
 
 	case DRBD_IOCTL_INVALIDATE_REM:
-		if( mdev->cstate != Connected ||
+		if( mdev->o_state == Primary || 
+		    mdev->cstate != Connected ||
 		    test_bit(DISKLESS,&mdev->flags) || 
 		    test_bit(PARTNER_DISKLESS,&mdev->flags) ) {
 			err = -EINPROGRESS;

From svn at svn.drbd.org  Thu Aug 26 15:22:25 2004
From: svn at svn.drbd.org (svn@svn.drbd.org)
Date: Thu Aug 26 15:22:25 2004
Subject: [DRBD-cvs] r1506 - in trunk: documentation user
Message-ID: <20040826132225.191DD3BE6E@garcon.linbit.com>

Author: phil
Date: 2004-08-26 15:22:23 +0200 (Thu, 26 Aug 2004)
New Revision: 1506

Modified:
   trunk/documentation/drbdadm.sgml
   trunk/documentation/drbdsetup.sgml
   trunk/user/drbdadm_main.c
   trunk/user/drbdsetup.c
Log:
Added the cstate command to drbdsetup and drbdadm


Modified: trunk/documentation/drbdadm.sgml
===================================================================
--- trunk/documentation/drbdadm.sgml	2004-08-26 11:31:17 UTC (rev 1505)
+++ trunk/documentation/drbdadm.sgml	2004-08-26 13:22:23 UTC (rev 1506)
@@ -16,12 +16,12 @@
     <cmdsynopsis>
       <command>drbdadm</command>
       <arg>-d</arg>
-      <arg>-c<arg choice=req><replaceable>file</replaceable></arg></arg>
-      <arg>-s<arg choice=req><replaceable>cmd</replaceable></arg></arg>
-      <arg choice=req><replaceable>command</replaceable></arg>
+      <arg>-c<arg choice="req"><replaceable>file</replaceable></arg></arg>
+      <arg>-s<arg choice="req"><replaceable>cmd</replaceable></arg></arg>
+      <arg choice="req"><replaceable>command</replaceable></arg>
       <group>
-	<arg choice=plain>all</arg>
-	<arg choice=plain rep=repeat><replaceable>resource</replaceable></arg>
+	<arg choice="plain">all</arg>
+	<arg choice="plain" rep="repeat"><replaceable>resource</replaceable></arg>
       </group>
     </cmdsynopsis>
   </refsynopsisdiv>
@@ -175,6 +175,12 @@
 	</para></listitem>
       </varlistentry>
       <varlistentry>
+        <term>cstate</term>
+        <listitem><para>
+	  Shows the current connection status of the devices.
+	</para></listitem>
+      </varlistentry>
+      <varlistentry>
         <term>dump</term>
         <listitem><para>
           Just parse the configuration file and dump it to stdout. Might

Modified: trunk/documentation/drbdsetup.sgml
===================================================================
--- trunk/documentation/drbdsetup.sgml	2004-08-26 11:31:17 UTC (rev 1505)
+++ trunk/documentation/drbdsetup.sgml	2004-08-26 13:22:23 UTC (rev 1506)
@@ -109,6 +109,16 @@
     <cmdsynopsis>
       <command>drbdsetup</command>
       <arg choice="req"><replaceable>device</replaceable></arg>
+      <arg choice="req">state</arg>
+    </cmdsynopsis>
+    <cmdsynopsis>
+      <command>drbdsetup</command>
+      <arg choice="req"><replaceable>device</replaceable></arg>
+      <arg choice="req">cstate</arg>
+    </cmdsynopsis>
+    <cmdsynopsis>
+      <command>drbdsetup</command>
+      <arg choice="req"><replaceable>device</replaceable></arg>
       <arg choice="req">resize</arg>
       <arg>-d<arg choice="req"><replaceable>size</replaceable></arg></arg>
     </cmdsynopsis>
@@ -557,6 +567,13 @@
       </para>
     </refsect2>
     <refsect2>
+      <title>cstate</title>
+      <para>
+	Shows the current connection states of the 
+	<replaceable>device</replaceable>.
+      </para>
+    </refsect2>
+    <refsect2>
       <title>resize</title>
       <para>
 	This causes DRBD to reexamine the size of the

Modified: trunk/user/drbdadm_main.c
===================================================================
--- trunk/user/drbdadm_main.c	2004-08-26 11:31:17 UTC (rev 1505)
+++ trunk/user/drbdadm_main.c	2004-08-26 13:22:23 UTC (rev 1506)
@@ -128,6 +128,7 @@
   { "adjust",            adm_adjust,  0                  ,1,1 },
   { "wait_connect",      adm_wait_c,  0                  ,1,1 },
   { "state",             adm_generic_s,"state"           ,1,1 },
+  { "cstate",            adm_generic_s,"cstate"          ,1,1 },
   { "dump",              adm_dump,    0                  ,1,1 },
   { "wait_con_int",      adm_wait_ci, 0                  ,1,0 },
   { "sh-resources",      sh_resources,0                  ,0,0 },

Modified: trunk/user/drbdsetup.c
===================================================================
--- trunk/user/drbdsetup.c	2004-08-26 11:31:17 UTC (rev 1505)
+++ trunk/user/drbdsetup.c	2004-08-26 13:22:23 UTC (rev 1506)
@@ -113,6 +113,7 @@
 int cmd_syncer(int drbd_fd,char** argv,int argc,struct option *options);
 int cmd_detach(int drbd_fd,char** argv,int argc,struct option *options);
 int cmd_state(int drbd_fd,char** argv,int argc,struct option *options);
+int cmd_cstate(int drbd_fd,char** argv,int argc,struct option *options);
 
 struct drbd_cmd commands[] = {
   {"primary", cmd_primary,           0,
@@ -171,6 +172,7 @@
      { 0,            0,                 0, 0 } } },
   {"disconnect", cmd_disconnect,     0, 0, },
   {"state", cmd_state,               0, 0, },
+  {"cstate", cmd_cstate,              0, 0, },
   {"show", cmd_show,                 0, 0, }
 };
 
@@ -1272,6 +1274,49 @@
   return 0;
 }
 
+int cmd_cstate(int drbd_fd,char** argv,int argc,struct option *options)
+{
+  static const char *cstate_names[] = {
+    [Unconfigured]   = "Unconfigured",
+    [StandAlone]     = "StandAlone",
+    [Unconnected]    = "Unconnected",
+    [Timeout]        = "Timeout",
+    [BrokenPipe]     = "BrokenPipe",
+    [NetworkFailure] = "NetworkFailure",
+    [WFConnection]   = "WFConnection",
+    [WFReportParams] = "WFReportParams",
+    [Connected]      = "Connected",
+    [SkippedSyncS]   = "SkippedSyncS",
+    [SkippedSyncT]   = "SkippedSyncT",
+    [WFBitMapS]      = "WFBitMapS",
+    [WFBitMapT]      = "WFBitMapT",
+    [SyncSource]     = "SyncSource",
+    [SyncTarget]     = "SyncTarget",
+    [PausedSyncS]    = "PausedSyncS",
+    [PausedSyncT]    = "PausedSyncT"
+  };
+
+  struct ioctl_get_config cn;
+  int err;
+
+  err=ioctl(drbd_fd,DRBD_IOCTL_GET_CONFIG,&cn);
+  if(err)
+    {
+      PERROR("ioctl(,GET_CONFIG,) failed");
+      return 20;
+    }
+
+  if( cn.cstate < StandAlone )
+    {
+      printf("Not configured\n");
+      return 0;
+    }
+
+  printf("%s\n",cstate_names[cn.cstate]);
+
+  return 0;
+}
+
 int main(int argc, char** argv)
 {
   int drbd_fd,i;

From svn at svn.drbd.org  Thu Aug 26 15:58:37 2004
From: svn at svn.drbd.org (svn@svn.drbd.org)
Date: Thu Aug 26 15:58:40 2004
Subject: [DRBD-cvs] r1507 - in trunk: documentation user
Message-ID: <20040826135837.71AE93BE6E@garcon.linbit.com>

Author: phil
Date: 2004-08-26 15:58:35 +0200 (Thu, 26 Aug 2004)
New Revision: 1507

Modified:
   trunk/documentation/drbdsetup.sgml
   trunk/user/drbdsetup.c
Log:
Made wait_connect and wait_sync accept the same options.


Modified: trunk/documentation/drbdsetup.sgml
===================================================================
--- trunk/documentation/drbdsetup.sgml	2004-08-26 13:22:23 UTC (rev 1506)
+++ trunk/documentation/drbdsetup.sgml	2004-08-26 13:58:35 UTC (rev 1507)
@@ -97,14 +97,15 @@
       <command>drbdsetup</command>
       <arg choice="req"><replaceable>device</replaceable></arg>
       <arg choice="req">wait_connect</arg>
-      <arg>-t<arg choice="req"><replaceable>connect_timeout</replaceable></arg></arg>
-      <arg>-d<arg choice="req"><replaceable>connect_timeout</replaceable></arg></arg>
+      <arg>-t<arg choice="req"><replaceable>wfc_timeout</replaceable></arg></arg>
+      <arg>-d<arg choice="req"><replaceable>degr_wfc_timeout</replaceable></arg></arg>
     </cmdsynopsis>
     <cmdsynopsis>
       <command>drbdsetup</command>
       <arg choice="req"><replaceable>device</replaceable></arg>
       <arg choice="req">wait_sync</arg>
-      <arg>-t<arg choice="req"><replaceable>connect_timeout</replaceable></arg></arg>
+      <arg>-t<arg choice="req"><replaceable>wfc_timeout</replaceable></arg></arg>
+      <arg>-d<arg choice="req"><replaceable>degr_wfc_timeout</replaceable></arg></arg>
     </cmdsynopsis>
     <cmdsynopsis>
       <command>drbdsetup</command>
@@ -498,14 +499,21 @@
       <variablelist>
 	<varlistentry>
 	  <term><option>-t</option>,
-	  <option>--time <replaceable>connect_timeout</replaceable></option></term>
+	  <option>--wfc-timeout <replaceable>wfc_timeout</replaceable></option></term>
+	  <term><option>-d</option>,
+	  <option>--degr-wfc-timeout <replaceable>degr_wfc_timeout</replaceable></option></term>
 	  <listitem>
 	    <para>
 	      This command will fail if the
 	      <replaceable>device</replaceable> can not communicate with its
-	      partner for <replaceable>connect_timeout</replaceable>
-	      seconds. The default value is 0 which disables the timeout
-	      mechanism.  
+	      partner for <replaceable>timeout</replaceable>
+	      seconds. If the peer was working before this node got
+	      rebootet, the wfc_timeout is used. If the peer was already
+	      down before this node got rebooted, the degr_wfc_timeout
+	      is used. 
+	      The default value for <replaceable>wfc_timeout</replaceable> 
+	      is 0 which means to wait forever. The default for 
+	      <replaceable>degr_wfc_timeout</replaceable> is 120 seconds.
 	    </para>
 	  </listitem>
 	</varlistentry>
@@ -515,23 +523,10 @@
       <title>wait_sync</title>
       <para>
 	Returns as soon as the <replaceable>device</replaceable> leaves any
-	synchronization state and returns into connected state.
+	synchronization state and returns into connected state. The options
+	are the same as with the <replaceable>wait_connect</replaceable>
+	command.
       </para>
-      <variablelist>
-	<varlistentry>
-	  <term><option>-t</option>,
-	  <option>--time <replaceable>connect_timeout</replaceable></option></term>
-	  <listitem>
-	    <para>
-	      This command will fail if the
-	      <replaceable>device</replaceable> stays for
-	      <replaceable>connect_timeout</replaceable> seconds in
-	      unconnected state. The default value is 8 seconds. If it is
-	      set to 0, the command will forever wait for a connection.
-	    </para>
-	  </listitem>
-	</varlistentry>
-      </variablelist>
     </refsect2>
     <refsect2>
       <title>disconnect</title>

Modified: trunk/user/drbdsetup.c
===================================================================
--- trunk/user/drbdsetup.c	2004-08-26 13:22:23 UTC (rev 1506)
+++ trunk/user/drbdsetup.c	2004-08-26 13:58:35 UTC (rev 1507)
@@ -130,7 +130,8 @@
      { 0,            0,                 0, 0   } } },
   {"wait_sync", cmd_wait_sync,       0,
    (struct option[]) {
-     { "time",       required_argument, 0, 't' },
+     { "wfc-timeout",required_argument, 0, 't' },
+     { "degr-wfc-timeout",required_argument,0,'d'},
      { 0,            0,                 0, 0   } } },
   {"wait_connect", cmd_wait_connect, 0,
    (struct option[]) {

From svn at svn.drbd.org  Thu Aug 26 16:15:00 2004
From: svn at svn.drbd.org (svn@svn.drbd.org)
Date: Thu Aug 26 16:15:02 2004
Subject: [DRBD-cvs] r1508 - in trunk: documentation scripts user
Message-ID: <20040826141500.DFD063BE6E@garcon.linbit.com>

Author: phil
Date: 2004-08-26 16:14:58 +0200 (Thu, 26 Aug 2004)
New Revision: 1508

Modified:
   trunk/documentation/drbd.conf.sgml
   trunk/scripts/drbd
   trunk/scripts/drbd.conf
   trunk/user/drbdadm_main.c
   trunk/user/drbdadm_parser.y
   trunk/user/drbdadm_scanner.fl
Log:
Implemented drbdadm wait_sync and drbdadm sh-wait-st.
If the wait-sync-target option is set in the startup
section, then the drbd script will block the boot
process until the sevice is not longer in the SyncTarget
cstate.


Modified: trunk/documentation/drbd.conf.sgml
===================================================================
--- trunk/documentation/drbd.conf.sgml	2004-08-26 13:58:35 UTC (rev 1507)
+++ trunk/documentation/drbd.conf.sgml	2004-08-26 14:14:58 UTC (rev 1508)
@@ -182,7 +182,8 @@
     <manvolnum>8</manvolnum></citerefentry> for detailed description
     of this section's parameters.
     Optional parameters:
-    <option>wfc-timeout</option>, <option>degr-wfc-timeout</option>.
+    <option>wfc-timeout</option>, <option>degr-wfc-timeout</option>,
+    <option>wait-sync-target</option>.
   </para>
   </listitem>
 </varlistentry>

Modified: trunk/scripts/drbd
===================================================================
--- trunk/scripts/drbd	2004-08-26 13:58:35 UTC (rev 1507)
+++ trunk/scripts/drbd	2004-08-26 14:14:58 UTC (rev 1508)
@@ -64,6 +64,14 @@
 	done
 	echo "."
 	$DRBDADM wait_con_int # User interruptible version of wait_connect all
+	for I in $RESOURCES; do
+	    WAIT_TS=`$DRBDADM sh-wait-st $I`
+	    CSTATE=`$DRBDADM cstate $I`
+	    if [ "$WAIT_TS" == "set" -a $CSTATE == "SyncTarget" ]; then
+	        echo "Waiting until sync on $I finished."
+		$DRBDADM wait_sync $I
+	    fi
+	done
 	;;
     stop)
 	echo -n "Stopping all DRBD resources"

Modified: trunk/scripts/drbd.conf
===================================================================
--- trunk/scripts/drbd.conf	2004-08-26 13:58:35 UTC (rev 1507)
+++ trunk/scripts/drbd.conf	2004-08-26 14:14:58 UTC (rev 1508)
@@ -135,6 +135,11 @@
     # is rebooted, this timeout value is used. 
     #
     degr-wfc-timeout 120;    # 2 minutes.
+
+    # The initscript blocks the bootprocess as long as any device
+    # is in SyncTarget cstate. Usefull to prevent current heartbeat
+    # to make a SyncTarget-node primary.
+    # wait-sync-target;
   }
 
   disk {

Modified: trunk/user/drbdadm_main.c
===================================================================
--- trunk/user/drbdadm_main.c	2004-08-26 13:58:35 UTC (rev 1507)
+++ trunk/user/drbdadm_main.c	2004-08-26 14:14:58 UTC (rev 1508)
@@ -81,8 +81,9 @@
 static int adm_up(struct d_resource* ,char* );
 extern int adm_adjust(struct d_resource* ,char* );
 static int adm_dump(struct d_resource* ,char* );
-static int adm_wait_c(struct d_resource* ,char* );
+static int adm_wait(struct d_resource* ,char* );
 static int adm_wait_ci(struct d_resource* ,char* );
+static int adm_show_opt(struct d_resource* ,char* );
 static int sh_resources(struct d_resource* ,char* );
 static int sh_mod_parms(struct d_resource* ,char* );
 static int sh_dev(struct d_resource* ,char* );
@@ -126,7 +127,8 @@
   { "resize",            adm_resize,  0                  ,1,1 },
   { "syncer",            adm_syncer,  0                  ,1,1 },
   { "adjust",            adm_adjust,  0                  ,1,1 },
-  { "wait_connect",      adm_wait_c,  0                  ,1,1 },
+  { "wait_connect",      adm_wait,    "wait_connect"     ,1,1 },
+  { "wait_sync",         adm_wait,    "wait_sync"        ,1,1 },
   { "state",             adm_generic_s,"state"           ,1,1 },
   { "cstate",            adm_generic_s,"cstate"          ,1,1 },
   { "dump",              adm_dump,    0                  ,1,1 },
@@ -136,7 +138,8 @@
   { "sh-dev",            sh_dev,      0                  ,0,1 },
   { "sh-ll-dev",         sh_ll_dev,   0                  ,0,1 },
   { "sh-md-dev",         sh_md_dev,   0                  ,0,1 },
-  { "sh-md-idx",         sh_md_idx,   0                  ,0,1 }
+  { "sh-md-idx",         sh_md_idx,   0                  ,0,1 },
+  { "sh-wait-st",        adm_show_opt,"wait-sync-target" ,0,1 }
 };
 
 
@@ -277,7 +280,37 @@
   return 0;
 }
 
+static char* get_opt_val(struct d_option* base,char* name,char* def)
+{
+  while(base) {
+    if(!strcmp(base->name,name)) {
+      return base->value;
+    }
+    base=base->next;
+  }
+  return def;
+}
 
+static int adm_show_opt(struct d_resource* res,char* optname)
+{
+  char *nf="unset"; // not_found
+  char *v;
+
+  do {
+    if((v=get_opt_val(res->net_options,optname,nf)) != nf) break;
+    if((v=get_opt_val(res->disk_options,optname,nf)) != nf) break;
+    if((v=get_opt_val(res->sync_options,optname,nf)) != nf) break;
+    if((v=get_opt_val(res->startup_options,optname,nf)) != nf) break;
+  } while(0);
+
+  if(v==NULL) v="set"; // boolean option, value == 0
+
+  printf("%s\n",v);
+
+  return 0;
+}
+
+
 static int sh_mod_parms(struct d_resource* res,char* unused)
 {
   int mc=global_options.minor_count;
@@ -594,7 +627,7 @@
 }
 
 
-static int adm_wait_c(struct d_resource* res ,char* unused)
+static int adm_wait(struct d_resource* res ,char* cmd)
 {
   char* argv[20];
   struct d_option* opt;
@@ -602,9 +635,13 @@
 
   argv[argc++]=drbdsetup;
   argv[argc++]=res->me->device;
-  argv[argc++]="wait_connect";
+  argv[argc++]=cmd;
   opt=res->startup_options;
-  make_options(opt);
+  while(opt) {
+    if(strstr(opt->name,"timeout"))
+      ssprintf(argv[argc++],"--%s=%s",opt->name,opt->value);
+    opt=opt->next;
+  }
   argv[argc++]=0;
 
   rv = m_system(argv,SLEEPS_FOREVER);
@@ -616,7 +653,6 @@
   return rv;
 }
 
-
 /* In case a child exited, or exits, its return code is stored as
    negative number in the pids[i] array */
 static int childs_running(pid_t* pids,int opts)
@@ -703,17 +739,6 @@
    return pr;
 }
 
-static char* get_opt_val(struct d_option* base,char* name,char* def)
-{
-  while(base) {
-    if(!strcmp(base->name,name)) {
-      return base->value;
-    }
-    base=base->next;
-  }
-  return def;
-}
-
 void chld_sig_hand(int unused)
 {
   // do nothing. But interrupt systemcalls :)
@@ -763,7 +788,11 @@
     argv[argc++]=res->me->device;
     argv[argc++]="wait_connect";
     opt=res->startup_options;
-    make_options(opt);
+    while(opt) {
+      if(strstr(opt->name,"timeout"))
+	ssprintf(argv[argc++],"--%s=%s",opt->name,opt->value);
+      opt=opt->next;
+    }
     argv[argc++]=0;
 
     pids[i++]=m_system(argv,RETURN_PID);

Modified: trunk/user/drbdadm_parser.y
===================================================================
--- trunk/user/drbdadm_parser.y	2004-08-26 13:58:35 UTC (rev 1507)
+++ trunk/user/drbdadm_parser.y	2004-08-26 14:14:58 UTC (rev 1508)
@@ -119,7 +119,7 @@
 %token TK_MINOR_COUNT TK_DISABLE_IO_HINTS
 %token TK_PROTOCOL TK_INCON_DEGR_CMD
 %token TK_ADDRESS TK_DISK TK_DEVICE TK_META_DISK
-%token <txt> TK_INTEGER TK_STRING
+%token <txt> TK_INTEGER TK_STRING TK_WAIT_SYNC_TARGET
 %token <txt> TK_ON_IO_ERROR TK_SIZE
 %token <txt> TK_TIMEOUT TK_CONNECT_INT TK_PING_INT TK_MAX_BUFFERS TK_IPADDR
 %token <txt> TK_MAX_EPOCH_SIZE TK_SNDBUF_SIZE
@@ -273,4 +273,5 @@
 
 startup_stmt:	  TK_WFC_TIMEOUT      TK_INTEGER   { $$=new_opt($1,$2); }
 		| TK_DEGR_WFC_TIMEOUT TK_INTEGER   { $$=new_opt($1,$2); }
+		| TK_WAIT_SYNC_TARGET		   { $$=new_opt($1,0);  }
 		;

Modified: trunk/user/drbdadm_scanner.fl
===================================================================
--- trunk/user/drbdadm_scanner.fl	2004-08-26 13:58:35 UTC (rev 1507)
+++ trunk/user/drbdadm_scanner.fl	2004-08-26 14:14:58 UTC (rev 1508)
@@ -214,7 +214,8 @@
 <STARTUP>{
   wfc-timeout		do_assign(NUM); CP; return TK_WFC_TIMEOUT;
   degr-wfc-timeout	do_assign(NUM); CP; return TK_DEGR_WFC_TIMEOUT;
-  {NDELIM}		expect_error("one of 'wfc-timeout|degr-wfc-timeout'");
+  wait-sync-target	yy_push_state(SEMICOLON); CP; return TK_WAIT_SYNC_TARGET;
+  {NDELIM}		expect_error("one of 'wfc-timeout|degr-wfc-timeout|wait-sync-target'");
 }
 
 <DISK>{

From svn at svn.drbd.org  Thu Aug 26 16:19:57 2004
From: svn at svn.drbd.org (svn@svn.drbd.org)
Date: Thu Aug 26 16:19:58 2004
Subject: [DRBD-cvs] r1509 - trunk
Message-ID: <20040826141957.7AC963BE6E@garcon.linbit.com>

Author: phil
Date: 2004-08-26 16:19:54 +0200 (Thu, 26 Aug 2004)
New Revision: 1509

Modified:
   trunk/ChangeLog
Log:
Updated changelog


Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2004-08-26 14:14:58 UTC (rev 1508)
+++ trunk/ChangeLog	2004-08-26 14:19:54 UTC (rev 1509)
@@ -1,9 +1,12 @@
 Latest:
 ------
- ChangeLog last updated: r1496 2004-08-22
+ ChangeLog last updated: r1508 2004-08-26
  Cumulative changes since last tarball.
  For even more detail, use "svn log" and "svn diff".
 
+ * New config option "wait-sync-target" in the startup section.
+   When set, the drbd script will block the boot process to prevent
+   heatbeat to make a SyncTarget-node primary.
  * prevent possible in-kernel buffer overflow in drbd_proc.c
  * Fixed debian's postinst script to create /dev/drbd? instead of /dev/nb?
  * drbd status:

From svn at svn.drbd.org  Thu Aug 26 16:43:51 2004
From: svn at svn.drbd.org (svn@svn.drbd.org)
Date: Thu Aug 26 16:43:54 2004
Subject: [DRBD-cvs] r1510 - in trunk/drbd: . linux
Message-ID: <20040826144351.DB6823BE6E@garcon.linbit.com>

Author: phil
Date: 2004-08-26 16:43:49 +0200 (Thu, 26 Aug 2004)
New Revision: 1510

Modified:
   trunk/drbd/drbd_main.c
   trunk/drbd/linux/drbd_config.h
Log:
Disabled the sendpage() statistics report by default.


Modified: trunk/drbd/drbd_main.c
===================================================================
--- trunk/drbd/drbd_main.c	2004-08-26 14:19:54 UTC (rev 1509)
+++ trunk/drbd/drbd_main.c	2004-08-26 14:43:49 UTC (rev 1510)
@@ -908,6 +908,8 @@
 {
 	int sent,ok;
 	int len   = size;
+
+#ifdef SHOW_SENDPAGE_USAGE
 	unsigned long now = jiffies;
 	static unsigned long total = 0;
 	static unsigned long fallback = 0;
@@ -915,19 +917,16 @@
 
 	/* report statistics every hour,
 	 * if we had at least one fallback.
-	 * XXX remove this statistics again,
-	 * or introduce some set of interessting per device real statistics,
-	 * and report them every hour...
-	 * currently these are global counters only.
 	 */
 	++total;
 	if (fallback && time_before(last_rep+3600*HZ, now)) {
 		last_rep = now;
 		printk(KERN_INFO DEVICE_NAME
-		       ": sendpage() omitted: %lu/%lu "
-		       "[XFS' broken IO requests?]\n", fallback, total);
+		       ": sendpage() omitted: %lu/%lu\n", fallback, total);
 	}
+#endif
 
+
 	spin_lock(&mdev->send_task_lock);
 	mdev->send_task=current;
 	spin_unlock(&mdev->send_task_lock);
@@ -941,9 +940,10 @@
 	if ( (page_count(page) < 1) || PageSlab(page) ) {
 		/* e.g. XFS meta- & log-data is in slab pages, which have a
 		 * page_count of 0 and/or have PageSlab() set...
-		 * FIXME: This is a workaround.
 		 */
+#ifdef SHOW_SENDPAGE_USAGE
 		++fallback;
+#endif
 		sent =  _drbd_no_send_page(mdev, page, offset, size);
 		if (likely(sent > 0)) len -= sent;
 		goto out;

Modified: trunk/drbd/linux/drbd_config.h
===================================================================
--- trunk/drbd/linux/drbd_config.h	2004-08-26 14:19:54 UTC (rev 1509)
+++ trunk/drbd/linux/drbd_config.h	2004-08-26 14:43:49 UTC (rev 1510)
@@ -63,4 +63,7 @@
 // don't enable this, unless you can cope with gigabyte syslogs :)
 //#define DUMP_EACH_PACKET
 
+// Dump every hour the usage / not usage of zero copy IO 
+//#define SHOW_SENDPAGE_USAGE
+
 #endif

From svn at svn.drbd.org  Fri Aug 27 13:53:11 2004
From: svn at svn.drbd.org (svn@svn.drbd.org)
Date: Fri Aug 27 13:53:20 2004
Subject: [DRBD-cvs] r1511 - in trunk: . drbd
Message-ID: <20040827115311.B15ED3BE6E@garcon.linbit.com>

Author: lars
Date: 2004-08-27 13:53:06 +0200 (Fri, 27 Aug 2004)
New Revision: 1511

Modified:
   trunk/ChangeLog
   trunk/INSTALL
   trunk/README
   trunk/drbd/drbd_fs.c
   trunk/drbd/drbd_proc.c
   trunk/drbd/drbd_receiver.c
Log:
some comment, spelling and whitespace fixes. no functional change

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2004-08-26 14:43:49 UTC (rev 1510)
+++ trunk/ChangeLog	2004-08-27 11:53:06 UTC (rev 1511)
@@ -6,7 +6,7 @@
 
  * New config option "wait-sync-target" in the startup section.
    When set, the drbd script will block the boot process to prevent
-   heatbeat to make a SyncTarget-node primary.
+   heartbeat to make a SyncTarget-node primary.
  * prevent possible in-kernel buffer overflow in drbd_proc.c
  * Fixed debian's postinst script to create /dev/drbd? instead of /dev/nb?
  * drbd status:

Modified: trunk/INSTALL
===================================================================
--- trunk/INSTALL	2004-08-26 14:43:49 UTC (rev 1510)
+++ trunk/INSTALL	2004-08-27 11:53:06 UTC (rev 1511)
@@ -112,6 +112,16 @@
     number. Having it as module is ok, but you cannot use both
     at the same time.
 
+    If you do not run a selfcompiled kernel, but the binary shipped
+    distro kernel, and after "make install" the drbd module ends up in
+    the wrong place (e.g. "/lib/modules/2.4.20custom/", when you want it
+    in "/lib/modules/2.4.20/" ), edit the top-level Makefile of your kernel
+    source tree and remove "custom" from the EXTRAVERSION.  Make sure you
+    copied in the .config corresponding to the kernel you use.
+    Don't forget to "make dep" in /usr/src/linux, it sometimes helps, too.
+    (you could of course edit .kernelversion in the drbd directory,
+    or copy by hand, too)
+
       Update:
       since we now (0.7.1 and later) have an officially assigned
       device major number (147) and device nodes (/dev/drbd), we no longer
@@ -137,7 +147,7 @@
 
    Note: On some distros (redhat/fedora typically), you first need to have a 
    look into ./drbd_config.h, and (un)comment some of the
-   settings appropriately.
+   settings appropriately, if not done automagically already.
 
    Since 0.7.3, we have script/adjust_drbd_config_h.sh, which helps you 
    with this, and gets called during the normal build process,
@@ -239,6 +249,12 @@
    file, and you can even "make rpm".  If this is a CVS/SVN version,
    you might need to say "make rpm FORCE=1".
 
+   If it does not work for you out of the box, first get "make install"
+   to work properly, see the section titled 'prepare the kernel source tree'
+   and 'building a kernel module'.
+   You may need to add some packages, or edit the drbd.spec(.in) file,
+   or even add a patch if fedora broke something again...
+
    There are caveats, please have a look at ./README, too,
    you might want/need to edit the ./drbd.spec file.
 

Modified: trunk/README
===================================================================
--- trunk/README	2004-08-26 14:43:49 UTC (rev 1510)
+++ trunk/README	2004-08-27 11:53:06 UTC (rev 1511)
@@ -4,19 +4,14 @@
         		   by Philipp Reisner
 		   		   
 
-Unfortunately my time does not allow me to maintain this README besides
-the software. 
-
-Please refer to the web pages at
-http://www.drbd.org/
-to find maintained information.
-
 Reference documentation is included in the documentation directory.
+
 Please have a look at INSTALL or INSTALL.html, too.
 BTW, if there is no INSTALL.html, say "make INSTALL.html" :)
 
 
 DEBUGING:
+---------
 
 In case you experience kernel crashes when using DRBD, please
 define "DBG_ALL_SYMBOLS" in drbd_config.h, and recompile DRBD.
@@ -26,26 +21,19 @@
 /usr/src/linux/Documentation/oops-tracing.txt
 
 BUILD RPMS:
+-----------
 
-It should be enough to just say: make rpm.
-If not, you probably need to add some packages,
-or edit the drbd.spec(.in) file.
+Read INSTALL.
 
-After make rpm there should be distributable rpms in dist/*/*/drbd-*.*.rpm
+ 
+GENERAL ISSUES
+--------------
 
-REDHAT USERS:
+Unfortunately our time does not allow us to
+maintain this README besides the software. 
 
-Have a look into drbd_config.h, and uncomment the RH-specific defines.
+Please refer to the web pages at
+http://www.drbd.org/ and 
+http://linuxha.trick.ca/DRBD
+to find maintained information.
 
-If you do not run a selfcompiled kernel, but the binary shipped
-distro kernel, and after "make install" the drbd module ends up in
-the wrong place (e.g. /lib/modules/2.4.20custom/, when you want it
-in /lib/modules/2.4.20/), edit the top-level Makefile of your
-kernel source tree and remove "custom" from the EXTRAVERSION.
-Make sure you copied in the .config corresponding to the kernel you use.
-Don't forget to "make dep" in /usr/src/linux, it sometimes helps, too.
-
-(you could of course edit .kernelversion in the drbd directory,
- or copy by hand, too)
- 
-

Modified: trunk/drbd/drbd_fs.c
===================================================================
--- trunk/drbd/drbd_fs.c	2004-08-26 14:43:49 UTC (rev 1510)
+++ trunk/drbd/drbd_fs.c	2004-08-27 11:53:06 UTC (rev 1511)
@@ -782,7 +782,7 @@
 		mdev->this_bdev->bd_disk = mdev->vdisk;
 )
 
-		if(test_bit(ON_PRI_INC_HUMAN,&mdev->flags)) { 
+		if(test_bit(ON_PRI_INC_HUMAN,&mdev->flags)) {
 			newstate |= Human;
 			clear_bit(ON_PRI_INC_HUMAN,&mdev->flags);
 		}
@@ -1152,10 +1152,14 @@
 		 * differentiate between different error cases,
 		 * or report the current connection state and flags back
 		 * to userspace */
-		if( mdev->state == Primary || 
+
+		/* disallow "invalidation" of local replica
+		 * when currently in primary state (would be a Bad Idea),
+		 * or during a running sync (won't make any sense) */
+		if( mdev->state == Primary ||
 		    mdev->cstate < StandAlone ||
 		    mdev->cstate > Connected ||
-		    test_bit(DISKLESS,&mdev->flags) || 
+		    test_bit(DISKLESS,&mdev->flags) ||
 		    test_bit(PARTNER_DISKLESS,&mdev->flags) ) {
 			err = -EINPROGRESS;
 			break;
@@ -1182,7 +1186,7 @@
 		drbd_md_clear_flag(mdev,MDF_FullSync);
 		drbd_md_write(mdev);
 
-		if (mdev->cstate == Connected) {	
+		if (mdev->cstate == Connected) {
 			drbd_send_short_cmd(mdev,BecomeSyncSource);
 			drbd_start_resync(mdev,SyncTarget);
 		}
@@ -1192,9 +1196,9 @@
 		break;
 
 	case DRBD_IOCTL_INVALIDATE_REM:
-		if( mdev->o_state == Primary || 
+		if( mdev->o_state == Primary ||
 		    mdev->cstate != Connected ||
-		    test_bit(DISKLESS,&mdev->flags) || 
+		    test_bit(DISKLESS,&mdev->flags) ||
 		    test_bit(PARTNER_DISKLESS,&mdev->flags) ) {
 			err = -EINPROGRESS;
 			break;

Modified: trunk/drbd/drbd_proc.c
===================================================================
--- trunk/drbd/drbd_proc.c	2004-08-26 14:43:49 UTC (rev 1510)
+++ trunk/drbd/drbd_proc.c	2004-08-27 11:53:06 UTC (rev 1511)
@@ -70,10 +70,12 @@
 	rs_left = drbd_bm_total_weight(mdev);
 	/* >> 10 to prevent overflow,
 	 * +1 to prevent division by zero */
-	ERR_IF(rs_left > mdev->rs_total) {
+	if (rs_left > mdev->rs_total) {
 		/* doh. logic bug somewhere.
 		 * for now, just try to prevent in-kernel buffer overflow.
 		 */
+		ERR("logic bug? rs_left=%lu > rs_total=%lu\n",
+				rs_left, mdev->rs_total);
 		res = 1000;
 	} else {
 		res = (rs_left >> 10)*1000/((mdev->rs_total >> 10) + 1);

Modified: trunk/drbd/drbd_receiver.c
===================================================================
--- trunk/drbd/drbd_receiver.c	2004-08-26 14:43:49 UTC (rev 1510)
+++ trunk/drbd/drbd_receiver.c	2004-08-27 11:53:06 UTC (rev 1511)
@@ -1511,6 +1511,7 @@
 		      nodestate_to_name(oo_state),
 		      nodestate_to_name(mdev->state),
 		      nodestate_to_name(mdev->o_state) );
+		/* FIXME assertion for (gencounts do not diverge) */
 	}
 	drbd_md_write(mdev); // update connected indicator, la_size, ...
 

From svn at svn.drbd.org  Fri Aug 27 14:04:57 2004
From: svn at svn.drbd.org (svn@svn.drbd.org)
Date: Fri Aug 27 14:05:09 2004
Subject: [DRBD-cvs] r1512 - in trunk: . documentation scripts user
Message-ID: <20040827120457.EDCB63BE6E@garcon.linbit.com>

Author: phil
Date: 2004-08-27 14:04:52 +0200 (Fri, 27 Aug 2004)
New Revision: 1512

Modified:
   trunk/ChangeLog
   trunk/documentation/drbd.conf.sgml
   trunk/scripts/drbd
   trunk/scripts/drbd.conf
   trunk/user/drbdadm_main.c
   trunk/user/drbdadm_parser.y
   trunk/user/drbdadm_scanner.fl
Log:
Backing out the wait-sync-target option.


Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2004-08-27 11:53:06 UTC (rev 1511)
+++ trunk/ChangeLog	2004-08-27 12:04:52 UTC (rev 1512)
@@ -4,9 +4,6 @@
  Cumulative changes since last tarball.
  For even more detail, use "svn log" and "svn diff".
 
- * New config option "wait-sync-target" in the startup section.
-   When set, the drbd script will block the boot process to prevent
-   heartbeat to make a SyncTarget-node primary.
  * prevent possible in-kernel buffer overflow in drbd_proc.c
  * Fixed debian's postinst script to create /dev/drbd? instead of /dev/nb?
  * drbd status:

Modified: trunk/documentation/drbd.conf.sgml
===================================================================
--- trunk/documentation/drbd.conf.sgml	2004-08-27 11:53:06 UTC (rev 1511)
+++ trunk/documentation/drbd.conf.sgml	2004-08-27 12:04:52 UTC (rev 1512)
@@ -182,8 +182,7 @@
     <manvolnum>8</manvolnum></citerefentry> for detailed description
     of this section's parameters.
     Optional parameters:
-    <option>wfc-timeout</option>, <option>degr-wfc-timeout</option>,
-    <option>wait-sync-target</option>.
+    <option>wfc-timeout</option>, <option>degr-wfc-timeout</option>.
   </para>
   </listitem>
 </varlistentry>

Modified: trunk/scripts/drbd
===================================================================
--- trunk/scripts/drbd	2004-08-27 11:53:06 UTC (rev 1511)
+++ trunk/scripts/drbd	2004-08-27 12:04:52 UTC (rev 1512)
@@ -64,14 +64,6 @@
 	done
 	echo "."
 	$DRBDADM wait_con_int # User interruptible version of wait_connect all
-	for I in $RESOURCES; do
-	    WAIT_TS=`$DRBDADM sh-wait-st $I`
-	    CSTATE=`$DRBDADM cstate $I`
-	    if [ "$WAIT_TS" == "set" -a $CSTATE == "SyncTarget" ]; then
-	        echo "Waiting until sync on $I finished."
-		$DRBDADM wait_sync $I
-	    fi
-	done
 	;;
     stop)
 	echo -n "Stopping all DRBD resources"

Modified: trunk/scripts/drbd.conf
===================================================================
--- trunk/scripts/drbd.conf	2004-08-27 11:53:06 UTC (rev 1511)
+++ trunk/scripts/drbd.conf	2004-08-27 12:04:52 UTC (rev 1512)
@@ -135,11 +135,6 @@
     # is rebooted, this timeout value is used. 
     #
     degr-wfc-timeout 120;    # 2 minutes.
-
-    # The initscript blocks the bootprocess as long as any device
-    # is in SyncTarget cstate. Usefull to prevent current heartbeat
-    # to make a SyncTarget-node primary.
-    # wait-sync-target;
   }
 
   disk {

Modified: trunk/user/drbdadm_main.c
===================================================================
--- trunk/user/drbdadm_main.c	2004-08-27 11:53:06 UTC (rev 1511)
+++ trunk/user/drbdadm_main.c	2004-08-27 12:04:52 UTC (rev 1512)
@@ -81,9 +81,8 @@
 static int adm_up(struct d_resource* ,char* );
 extern int adm_adjust(struct d_resource* ,char* );
 static int adm_dump(struct d_resource* ,char* );
-static int adm_wait(struct d_resource* ,char* );
+static int adm_wait_c(struct d_resource* ,char* );
 static int adm_wait_ci(struct d_resource* ,char* );
-static int adm_show_opt(struct d_resource* ,char* );
 static int sh_resources(struct d_resource* ,char* );
 static int sh_mod_parms(struct d_resource* ,char* );
 static int sh_dev(struct d_resource* ,char* );
@@ -127,8 +126,7 @@
   { "resize",            adm_resize,  0                  ,1,1 },
   { "syncer",            adm_syncer,  0                  ,1,1 },
   { "adjust",            adm_adjust,  0                  ,1,1 },
-  { "wait_connect",      adm_wait,    "wait_connect"     ,1,1 },
-  { "wait_sync",         adm_wait,    "wait_sync"        ,1,1 },
+  { "wait_connect",      adm_wait_c,  0                  ,1,1 },
   { "state",             adm_generic_s,"state"           ,1,1 },
   { "cstate",            adm_generic_s,"cstate"          ,1,1 },
   { "dump",              adm_dump,    0                  ,1,1 },
@@ -138,8 +136,7 @@
   { "sh-dev",            sh_dev,      0                  ,0,1 },
   { "sh-ll-dev",         sh_ll_dev,   0                  ,0,1 },
   { "sh-md-dev",         sh_md_dev,   0                  ,0,1 },
-  { "sh-md-idx",         sh_md_idx,   0                  ,0,1 },
-  { "sh-wait-st",        adm_show_opt,"wait-sync-target" ,0,1 }
+  { "sh-md-idx",         sh_md_idx,   0                  ,0,1 }
 };
 
 
@@ -280,37 +277,7 @@
   return 0;
 }
 
-static char* get_opt_val(struct d_option* base,char* name,char* def)
-{
-  while(base) {
-    if(!strcmp(base->name,name)) {
-      return base->value;
-    }
-    base=base->next;
-  }
-  return def;
-}
 
-static int adm_show_opt(struct d_resource* res,char* optname)
-{
-  char *nf="unset"; // not_found
-  char *v;
-
-  do {
-    if((v=get_opt_val(res->net_options,optname,nf)) != nf) break;
-    if((v=get_opt_val(res->disk_options,optname,nf)) != nf) break;
-    if((v=get_opt_val(res->sync_options,optname,nf)) != nf) break;
-    if((v=get_opt_val(res->startup_options,optname,nf)) != nf) break;
-  } while(0);
-
-  if(v==NULL) v="set"; // boolean option, value == 0
-
-  printf("%s\n",v);
-
-  return 0;
-}
-
-
 static int sh_mod_parms(struct d_resource* res,char* unused)
 {
   int mc=global_options.minor_count;
@@ -627,7 +594,7 @@
 }
 
 
-static int adm_wait(struct d_resource* res ,char* cmd)
+static int adm_wait_c(struct d_resource* res ,char* unused)
 {
   char* argv[20];
   struct d_option* opt;
@@ -635,13 +602,9 @@
 
   argv[argc++]=drbdsetup;
   argv[argc++]=res->me->device;
-  argv[argc++]=cmd;
+  argv[argc++]="wait_connect";
   opt=res->startup_options;
-  while(opt) {
-    if(strstr(opt->name,"timeout"))
-      ssprintf(argv[argc++],"--%s=%s",opt->name,opt->value);
-    opt=opt->next;
-  }
+  make_options(opt);
   argv[argc++]=0;
 
   rv = m_system(argv,SLEEPS_FOREVER);
@@ -653,6 +616,7 @@
   return rv;
 }
 
+
 /* In case a child exited, or exits, its return code is stored as
    negative number in the pids[i] array */
 static int childs_running(pid_t* pids,int opts)
@@ -739,6 +703,17 @@
    return pr;
 }
 
+static char* get_opt_val(struct d_option* base,char* name,char* def)
+{
+  while(base) {
+    if(!strcmp(base->name,name)) {
+      return base->value;
+    }
+    base=base->next;
+  }
+  return def;
+}
+
 void chld_sig_hand(int unused)
 {
   // do nothing. But interrupt systemcalls :)
@@ -788,11 +763,7 @@
     argv[argc++]=res->me->device;
     argv[argc++]="wait_connect";
     opt=res->startup_options;
-    while(opt) {
-      if(strstr(opt->name,"timeout"))
-	ssprintf(argv[argc++],"--%s=%s",opt->name,opt->value);
-      opt=opt->next;
-    }
+    make_options(opt);
     argv[argc++]=0;
 
     pids[i++]=m_system(argv,RETURN_PID);

Modified: trunk/user/drbdadm_parser.y
===================================================================
--- trunk/user/drbdadm_parser.y	2004-08-27 11:53:06 UTC (rev 1511)
+++ trunk/user/drbdadm_parser.y	2004-08-27 12:04:52 UTC (rev 1512)
@@ -119,7 +119,7 @@
 %token TK_MINOR_COUNT TK_DISABLE_IO_HINTS
 %token TK_PROTOCOL TK_INCON_DEGR_CMD
 %token TK_ADDRESS TK_DISK TK_DEVICE TK_META_DISK
-%token <txt> TK_INTEGER TK_STRING TK_WAIT_SYNC_TARGET
+%token <txt> TK_INTEGER TK_STRING
 %token <txt> TK_ON_IO_ERROR TK_SIZE
 %token <txt> TK_TIMEOUT TK_CONNECT_INT TK_PING_INT TK_MAX_BUFFERS TK_IPADDR
 %token <txt> TK_MAX_EPOCH_SIZE TK_SNDBUF_SIZE
@@ -273,5 +273,4 @@
 
 startup_stmt:	  TK_WFC_TIMEOUT      TK_INTEGER   { $$=new_opt($1,$2); }
 		| TK_DEGR_WFC_TIMEOUT TK_INTEGER   { $$=new_opt($1,$2); }
-		| TK_WAIT_SYNC_TARGET		   { $$=new_opt($1,0);  }
 		;

Modified: trunk/user/drbdadm_scanner.fl
===================================================================
--- trunk/user/drbdadm_scanner.fl	2004-08-27 11:53:06 UTC (rev 1511)
+++ trunk/user/drbdadm_scanner.fl	2004-08-27 12:04:52 UTC (rev 1512)
@@ -214,8 +214,7 @@
 <STARTUP>{
   wfc-timeout		do_assign(NUM); CP; return TK_WFC_TIMEOUT;
   degr-wfc-timeout	do_assign(NUM); CP; return TK_DEGR_WFC_TIMEOUT;
-  wait-sync-target	yy_push_state(SEMICOLON); CP; return TK_WAIT_SYNC_TARGET;
-  {NDELIM}		expect_error("one of 'wfc-timeout|degr-wfc-timeout|wait-sync-target'");
+  {NDELIM}		expect_error("one of 'wfc-timeout|degr-wfc-timeout'");
 }
 
 <DISK>{

From svn at svn.drbd.org  Fri Aug 27 14:10:04 2004
From: svn at svn.drbd.org (svn@svn.drbd.org)
Date: Fri Aug 27 14:10:06 2004
Subject: [DRBD-cvs] r1513 - /
Message-ID: <20040827121004.EDE7C3BE6E@garcon.linbit.com>

Author: phil
Date: 2004-08-27 14:09:59 +0200 (Fri, 27 Aug 2004)
New Revision: 1513

Added:
   plus-branches/
Log:
Directory for branches containing add-ons, to be distributed
as drbd+  [ The whole thing is experimental ] 


From svn at svn.drbd.org  Fri Aug 27 14:19:51 2004
From: svn at svn.drbd.org (svn@svn.drbd.org)
Date: Fri Aug 27 14:19:52 2004
Subject: [DRBD-cvs] r1514 - plus-branches
Message-ID: <20040827121951.4446C3BE6E@garcon.linbit.com>

Author: phil
Date: 2004-08-27 14:19:45 +0200 (Fri, 27 Aug 2004)
New Revision: 1514

Added:
   plus-branches/01-wait-sync-target/
Log:
Implemented drbdadm wait_sync and drbdadm sh-wait-st.
If the wait-sync-target option is set in the startup
section, then the drbd script will block the boot
process until the sevice is not longer in the SyncTarget
cstate.


Copied: plus-branches/01-wait-sync-target (from rev 1513, trunk)

From svn at svn.drbd.org  Fri Aug 27 14:39:47 2004
From: svn at svn.drbd.org (svn@svn.drbd.org)
Date: Fri Aug 27 14:39:51 2004
Subject: [DRBD-cvs] r1515 - in plus-branches/01-wait-sync-target:
	documentation scripts user
Message-ID: <20040827123947.B5F123BE6E@garcon.linbit.com>

Author: phil
Date: 2004-08-27 14:39:42 +0200 (Fri, 27 Aug 2004)
New Revision: 1515

Modified:
   plus-branches/01-wait-sync-target/documentation/drbd.conf.sgml
   plus-branches/01-wait-sync-target/scripts/drbd
   plus-branches/01-wait-sync-target/scripts/drbd.conf
   plus-branches/01-wait-sync-target/user/drbdadm_main.c
   plus-branches/01-wait-sync-target/user/drbdadm_parser.y
   plus-branches/01-wait-sync-target/user/drbdadm_scanner.fl
Log:
The implementation of this add-on


Modified: plus-branches/01-wait-sync-target/documentation/drbd.conf.sgml
===================================================================
--- plus-branches/01-wait-sync-target/documentation/drbd.conf.sgml	2004-08-27 12:19:45 UTC (rev 1514)
+++ plus-branches/01-wait-sync-target/documentation/drbd.conf.sgml	2004-08-27 12:39:42 UTC (rev 1515)
@@ -182,7 +182,8 @@
     <manvolnum>8</manvolnum></citerefentry> for detailed description
     of this section's parameters.
     Optional parameters:
-    <option>wfc-timeout</option>, <option>degr-wfc-timeout</option>.
+    <option>wfc-timeout</option>, <option>degr-wfc-timeout</option>,
+    <option>wait-sync-target</option>.
   </para>
   </listitem>
 </varlistentry>

Modified: plus-branches/01-wait-sync-target/scripts/drbd
===================================================================
--- plus-branches/01-wait-sync-target/scripts/drbd	2004-08-27 12:19:45 UTC (rev 1514)
+++ plus-branches/01-wait-sync-target/scripts/drbd	2004-08-27 12:39:42 UTC (rev 1515)
@@ -64,6 +64,14 @@
 	done
 	echo "."
 	$DRBDADM wait_con_int # User interruptible version of wait_connect all
+	for I in $RESOURCES; do
+	    WAIT_TS=`$DRBDADM sh-wait-st $I`
+	    CSTATE=`$DRBDADM cstate $I`
+	    if [ "$WAIT_TS" == "set" -a $CSTATE == "SyncTarget" ]; then
+	        echo "Waiting until sync on $I finished."
+		$DRBDADM wait_sync $I
+	    fi
+	done
 	;;
     stop)
 	echo -n "Stopping all DRBD resources"

Modified: plus-branches/01-wait-sync-target/scripts/drbd.conf
===================================================================
--- plus-branches/01-wait-sync-target/scripts/drbd.conf	2004-08-27 12:19:45 UTC (rev 1514)
+++ plus-branches/01-wait-sync-target/scripts/drbd.conf	2004-08-27 12:39:42 UTC (rev 1515)
@@ -135,6 +135,11 @@
     # is rebooted, this timeout value is used. 
     #
     degr-wfc-timeout 120;    # 2 minutes.
+
+    # The initscript blocks the bootprocess as long as any device
+    # is in SyncTarget cstate. Usefull to prevent current heartbeat
+    # to make a SyncTarget-node primary.
+    # wait-sync-target;
   }
 
   disk {

Modified: plus-branches/01-wait-sync-target/user/drbdadm_main.c
===================================================================
--- plus-branches/01-wait-sync-target/user/drbdadm_main.c	2004-08-27 12:19:45 UTC (rev 1514)
+++ plus-branches/01-wait-sync-target/user/drbdadm_main.c	2004-08-27 12:39:42 UTC (rev 1515)
@@ -81,8 +81,9 @@
 static int adm_up(struct d_resource* ,char* );
 extern int adm_adjust(struct d_resource* ,char* );
 static int adm_dump(struct d_resource* ,char* );
-static int adm_wait_c(struct d_resource* ,char* );
+static int adm_wait(struct d_resource* ,char* );
 static int adm_wait_ci(struct d_resource* ,char* );
+static int adm_show_opt(struct d_resource* ,char* );
 static int sh_resources(struct d_resource* ,char* );
 static int sh_mod_parms(struct d_resource* ,char* );
 static int sh_dev(struct d_resource* ,char* );
@@ -126,7 +127,8 @@
   { "resize",            adm_resize,  0                  ,1,1 },
   { "syncer",            adm_syncer,  0                  ,1,1 },
   { "adjust",            adm_adjust,  0                  ,1,1 },
-  { "wait_connect",      adm_wait_c,  0                  ,1,1 },
+  { "wait_connect",      adm_wait,    "wait_connect"     ,1,1 },
+  { "wait_sync",         adm_wait,    "wait_sync"        ,1,1 },
   { "state",             adm_generic_s,"state"           ,1,1 },
   { "cstate",            adm_generic_s,"cstate"          ,1,1 },
   { "dump",              adm_dump,    0                  ,1,1 },
@@ -136,7 +138,8 @@
   { "sh-dev",            sh_dev,      0                  ,0,1 },
   { "sh-ll-dev",         sh_ll_dev,   0                  ,0,1 },
   { "sh-md-dev",         sh_md_dev,   0                  ,0,1 },
-  { "sh-md-idx",         sh_md_idx,   0                  ,0,1 }
+  { "sh-md-idx",         sh_md_idx,   0                  ,0,1 },
+  { "sh-wait-st",        adm_show_opt,"wait-sync-target" ,0,1 }
 };
 
 
@@ -277,7 +280,37 @@
   return 0;
 }
 
+static char* get_opt_val(struct d_option* base,char* name,char* def)
+{
+  while(base) {
+    if(!strcmp(base->name,name)) {
+      return base->value;
+    }
+    base=base->next;
+  }
+  return def;
+}
 
+static int adm_show_opt(struct d_resource* res,char* optname)
+{
+  char *nf="unset"; // not_found
+  char *v;
+
+  do {
+    if((v=get_opt_val(res->net_options,optname,nf)) != nf) break;
+    if((v=get_opt_val(res->disk_options,optname,nf)) != nf) break;
+    if((v=get_opt_val(res->sync_options,optname,nf)) != nf) break;
+    if((v=get_opt_val(res->startup_options,optname,nf)) != nf) break;
+  } while(0);
+
+  if(v==NULL) v="set"; // boolean option, value == 0
+
+  printf("%s\n",v);
+
+  return 0;
+}
+
+
 static int sh_mod_parms(struct d_resource* res,char* unused)
 {
   int mc=global_options.minor_count;
@@ -594,7 +627,7 @@
 }
 
 
-static int adm_wait_c(struct d_resource* res ,char* unused)
+static int adm_wait(struct d_resource* res ,char* cmd)
 {
   char* argv[20];
   struct d_option* opt;
@@ -602,9 +635,13 @@
 
   argv[argc++]=drbdsetup;
   argv[argc++]=res->me->device;
-  argv[argc++]="wait_connect";
+  argv[argc++]=cmd;
   opt=res->startup_options;
-  make_options(opt);
+  while(opt) {
+    if(strstr(opt->name,"timeout"))
+      ssprintf(argv[argc++],"--%s=%s",opt->name,opt->value);
+    opt=opt->next;
+  }
   argv[argc++]=0;
 
   rv = m_system(argv,SLEEPS_FOREVER);
@@ -616,7 +653,6 @@
   return rv;
 }
 
-
 /* In case a child exited, or exits, its return code is stored as
    negative number in the pids[i] array */
 static int childs_running(pid_t* pids,int opts)
@@ -703,17 +739,6 @@
    return pr;
 }
 
-static char* get_opt_val(struct d_option* base,char* name,char* def)
-{
-  while(base) {
-    if(!strcmp(base->name,name)) {
-      return base->value;
-    }
-    base=base->next;
-  }
-  return def;
-}
-
 void chld_sig_hand(int unused)
 {
   // do nothing. But interrupt systemcalls :)
@@ -763,7 +788,11 @@
     argv[argc++]=res->me->device;
     argv[argc++]="wait_connect";
     opt=res->startup_options;
-    make_options(opt);
+    while(opt) {
+      if(strstr(opt->name,"timeout"))
+	ssprintf(argv[argc++],"--%s=%s",opt->name,opt->value);
+      opt=opt->next;
+    }
     argv[argc++]=0;
 
     pids[i++]=m_system(argv,RETURN_PID);

Modified: plus-branches/01-wait-sync-target/user/drbdadm_parser.y
===================================================================
--- plus-branches/01-wait-sync-target/user/drbdadm_parser.y	2004-08-27 12:19:45 UTC (rev 1514)
+++ plus-branches/01-wait-sync-target/user/drbdadm_parser.y	2004-08-27 12:39:42 UTC (rev 1515)
@@ -119,7 +119,7 @@
 %token TK_MINOR_COUNT TK_DISABLE_IO_HINTS
 %token TK_PROTOCOL TK_INCON_DEGR_CMD
 %token TK_ADDRESS TK_DISK TK_DEVICE TK_META_DISK
-%token <txt> TK_INTEGER TK_STRING
+%token <txt> TK_INTEGER TK_STRING TK_WAIT_SYNC_TARGET
 %token <txt> TK_ON_IO_ERROR TK_SIZE
 %token <txt> TK_TIMEOUT TK_CONNECT_INT TK_PING_INT TK_MAX_BUFFERS TK_IPADDR
 %token <txt> TK_MAX_EPOCH_SIZE TK_SNDBUF_SIZE
@@ -273,4 +273,5 @@
 
 startup_stmt:	  TK_WFC_TIMEOUT      TK_INTEGER   { $$=new_opt($1,$2); }
 		| TK_DEGR_WFC_TIMEOUT TK_INTEGER   { $$=new_opt($1,$2); }
+		| TK_WAIT_SYNC_TARGET		   { $$=new_opt($1,0);  }
 		;

Modified: plus-branches/01-wait-sync-target/user/drbdadm_scanner.fl
===================================================================
--- plus-branches/01-wait-sync-target/user/drbdadm_scanner.fl	2004-08-27 12:19:45 UTC (rev 1514)
+++ plus-branches/01-wait-sync-target/user/drbdadm_scanner.fl	2004-08-27 12:39:42 UTC (rev 1515)
@@ -214,7 +214,8 @@
 <STARTUP>{
   wfc-timeout		do_assign(NUM); CP; return TK_WFC_TIMEOUT;
   degr-wfc-timeout	do_assign(NUM); CP; return TK_DEGR_WFC_TIMEOUT;
-  {NDELIM}		expect_error("one of 'wfc-timeout|degr-wfc-timeout'");
+  wait-sync-target	yy_push_state(SEMICOLON); CP; return TK_WAIT_SYNC_TARGET;
+  {NDELIM}		expect_error("one of 'wfc-timeout|degr-wfc-timeout|wait-sync-target'");
 }
 
 <DISK>{

From svn at svn.drbd.org  Fri Aug 27 14:43:17 2004
From: svn at svn.drbd.org (svn@svn.drbd.org)
Date: Fri Aug 27 14:43:19 2004
Subject: [DRBD-cvs] r1516 - plus-branches/01-wait-sync-target
Message-ID: <20040827124317.CCFD03BE6E@garcon.linbit.com>

Author: phil
Date: 2004-08-27 14:43:11 +0200 (Fri, 27 Aug 2004)
New Revision: 1516

Added:
   plus-branches/01-wait-sync-target/drbd-plus.README
Log:
To test the regex of the commit-email hook


Added: plus-branches/01-wait-sync-target/drbd-plus.README
===================================================================

From svn at svn.drbd.org  Fri Aug 27 14:44:38 2004
From: svn at svn.drbd.org (svn@svn.drbd.org)
Date: Fri Aug 27 14:44:44 2004
Subject: [DRBD-cvs] r1517 - plus-branches/01-wait-sync-target
Message-ID: <20040827124438.6CAF13BE6E@garcon.linbit.com>

Author: phil
Date: 2004-08-27 14:44:32 +0200 (Fri, 27 Aug 2004)
New Revision: 1517

Modified:
   plus-branches/01-wait-sync-target/drbd-plus.README
Log:
Test 2


Modified: plus-branches/01-wait-sync-target/drbd-plus.README
===================================================================
--- plus-branches/01-wait-sync-target/drbd-plus.README	2004-08-27 12:43:11 UTC (rev 1516)
+++ plus-branches/01-wait-sync-target/drbd-plus.README	2004-08-27 12:44:32 UTC (rev 1517)
@@ -0,0 +1 @@
+To be written...

From svn at svn.drbd.org  Fri Aug 27 15:05:09 2004
From: svn at svn.drbd.org (svn@svn.drbd.org)
Date: Fri Aug 27 15:05:11 2004
Subject: [DRBD-cvs] r1518 - in trunk: . debian drbd/linux
Message-ID: <20040827130509.1E8C43BE6E@garcon.linbit.com>

Author: phil
Date: 2004-08-27 15:05:03 +0200 (Fri, 27 Aug 2004)
New Revision: 1518

Modified:
   trunk/ChangeLog
   trunk/debian/changelog
   trunk/drbd.spec.in
   trunk/drbd/linux/drbd_config.h
Log:
Preparing 0.7.3 release


Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2004-08-27 12:44:32 UTC (rev 1517)
+++ trunk/ChangeLog	2004-08-27 13:05:03 UTC (rev 1518)
@@ -4,6 +4,9 @@
  Cumulative changes since last tarball.
  For even more detail, use "svn log" and "svn diff".
 
+0.7.3 (api:75/proto:74)
+-----
+ * Fixed minor bugs in the handling of the generation counters.
  * prevent possible in-kernel buffer overflow in drbd_proc.c
  * Fixed debian's postinst script to create /dev/drbd? instead of /dev/nb?
  * drbd status:

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2004-08-27 12:44:32 UTC (rev 1517)
+++ trunk/debian/changelog	2004-08-27 13:05:03 UTC (rev 1518)
@@ -1,3 +1,17 @@
+drbd (0.7.3-1) unstable; urgency=low
+
+  * Fixed minor bugs in the handling of the generation counters.
+  * prevent possible in-kernel buffer overflow in drbd_proc.c
+  * Fixed debian's postinst script to create /dev/drbd? instead of /dev/nb?
+  * drbd status:
+    be nice to heartbeat, include "OK" in output.
+  * added FullSync meta data flag to read/write gc.pl
+  * make the RHEL3 happy (page_count no longer in mm.h, but in mm_inline.h)
+  * [Patch by Pavel Semerad]. Also use the drbd_devfs_name on Linux-2.4.x
+  * fix missing dependencies on drbd_config.h
+
+ -- Philipp Reisner <phil@linbit.com>  Fri, 27 Aug 2004 15:02:00 +0200
+
 drbd (0.7.2-1) unstable; urgency=low
 
   * Proper handling of backing storage devices that occasionally fail 

Modified: trunk/drbd/linux/drbd_config.h
===================================================================
--- trunk/drbd/linux/drbd_config.h	2004-08-27 12:44:32 UTC (rev 1517)
+++ trunk/drbd/linux/drbd_config.h	2004-08-27 13:05:03 UTC (rev 1518)
@@ -22,7 +22,7 @@
 
 extern const char * drbd_buildtag(void);
 
-#define REL_VERSION "0.7.2"
+#define REL_VERSION "0.7.3"
 #define API_VERSION 75
 #define PRO_VERSION 74
 

Modified: trunk/drbd.spec.in
===================================================================
--- trunk/drbd.spec.in	2004-08-27 12:44:32 UTC (rev 1517)
+++ trunk/drbd.spec.in	2004-08-27 13:05:03 UTC (rev 1518)
@@ -177,6 +177,18 @@
 /sbin/depmod -a -F /boot/System.map-%{kernelversion} %{kernelversion} >/dev/null 2>&1 || true
 
 %changelog
+* Fri Aug 27 2004 15:02:00 +0200 Philipp Reisner <phil@linbit.com>
+- drbd (0.7.3-1)
+  * Fixed minor bugs in the handling of the generation counters.
+  * prevent possible in-kernel buffer overflow in drbd_proc.c
+  * Fixed debian's postinst script to create /dev/drbd? instead of /dev/nb?
+  * drbd status:
+    be nice to heartbeat, include "OK" in output.
+  * added FullSync meta data flag to read/write gc.pl
+  * make the RHEL3 happy (page_count no longer in mm.h, but in mm_inline.h)
+  * [Patch by Pavel Semerad]. Also use the drbd_devfs_name on Linux-2.4.x
+  * fix missing dependencies on drbd_config.h
+
 * Fri Aug 06 2004 14:44:31 +0200 Philipp Reisner <phil@linbit.com>
 - drbd (0.7.2-1)
   * Proper handling of backing storage devices that occasionally fail 

From svn at svn.drbd.org  Fri Aug 27 15:08:52 2004
From: svn at svn.drbd.org (svn@svn.drbd.org)
Date: Fri Aug 27 15:08:54 2004
Subject: [DRBD-cvs] r1519 - tags
Message-ID: <20040827130852.D72153BE6E@garcon.linbit.com>

Author: phil
Date: 2004-08-27 15:08:47 +0200 (Fri, 27 Aug 2004)
New Revision: 1519

Added:
   tags/drbd-0.7.3/
Log:
Tagging 0.7.3


Copied: tags/drbd-0.7.3 (from rev 1518, trunk)

From svn at svn.drbd.org  Tue Aug 31 13:47:00 2004
From: svn at svn.drbd.org (svn@svn.drbd.org)
Date: Tue Aug 31 13:47:04 2004
Subject: [DRBD-cvs] r1520 - in trunk: documentation drbd drbd/linux scripts
	user
Message-ID: <20040831114700.E99853BE6E@garcon.linbit.com>

Author: lars
Date: 2004-08-31 13:46:58 +0200 (Tue, 31 Aug 2004)
New Revision: 1520

Modified:
   trunk/documentation/Makefile
   trunk/documentation/Makefile.lang
   trunk/drbd/Makefile
   trunk/drbd/drbd_compat_wrappers.h
   trunk/drbd/drbd_fs.c
   trunk/drbd/drbd_int.h
   trunk/drbd/drbd_main.c
   trunk/drbd/linux/drbd.h
   trunk/drbd/linux/drbd_config.h
   trunk/scripts/Makefile
   trunk/scripts/adjust_drbd_config_h.sh
   trunk/user/drbdsetup.c
Log:
- reviewd Makefiles for correct handling of empty PREFIX
  and added some missing '/'
- improved adjust_drbd_config_h magic, so it does not trigger a recompile
  if it does not change a thing
- added check for DRBD_MAX_SECTORS in the "attach disk" path.
  this limits drbd device size to 2TB, which is the limit introduced by
  code leftovers still using unsigned long to represent disk size
  at various places.
- added DRBD_DISABLE_SENDPAGE to drbd_config.h
  sendpage is now disabled by default,
  since we seemingly still have data corruption problems where it is
  involved on certain kernel flavours.
  If you (think you) know that your kernel flavour & drbd combination
  is not affected, you can comment it out, to get the performance gain
  of zero-copy network send.


Modified: trunk/documentation/Makefile
===================================================================
--- trunk/documentation/Makefile	2004-08-27 13:08:47 UTC (rev 1519)
+++ trunk/documentation/Makefile	2004-08-31 11:46:58 UTC (rev 1520)
@@ -139,16 +139,16 @@
 	@ok=true; for f in $(MANPAGES) ; \
 		do [ -e $$f ] || { echo $$f missing ; ok=false; } ; \
 	done ; $$ok
-	@ set -e; for f in $(MANPAGES) ; do \
+	set -e; for f in $(MANPAGES) ; do \
 		s=$${f##*.}; \
-		install -v -D -m 644 $$f $(PREFIX)usr/share/man/man$$s/$$f ; \
+		install -v -D -m 644 $$f $(PREFIX)/usr/share/man/man$$s/$$f ; \
 	done
 	@ set -e; for i in $(LANGS); do $(MAKE) -C $$i install; done
 
 uninstall:
 	@ set -e; for f in $(MANPAGES) ; do \
 		s=$${f##*.}; \
-		rm -v $(PREFIX)usr/share/man/man$$s/$$f ; \
+		rm -v $(PREFIX)/usr/share/man/man$$s/$$f ; \
 	done
 	@ set -e; for i in $(LANGS); do $(MAKE) -C $$i uninstall; done
 

Modified: trunk/documentation/Makefile.lang
===================================================================
--- trunk/documentation/Makefile.lang	2004-08-27 13:08:47 UTC (rev 1519)
+++ trunk/documentation/Makefile.lang	2004-08-31 11:46:58 UTC (rev 1520)
@@ -93,14 +93,14 @@
 	rm -f *.ps.gz *.pdf *.ps *.html
 
 install:
-	install -D -m 644 drbdsetup.8 $(PREFIX)usr/share/man/$(C_LANG)/man8/drbdsetup.8
-	install -D -m 644 drbd.conf.5 $(PREFIX)usr/share/man/$(C_LANG)/man5/drbd.conf.5
-	install -D -m 644 drbd.8 $(PREFIX)usr/share/man/$(C_LANG)/man8/drbd.8
+	install -D -m 644 drbdsetup.8 $(PREFIX)/usr/share/man/$(C_LANG)/man8/drbdsetup.8
+	install -D -m 644 drbd.conf.5 $(PREFIX)/usr/share/man/$(C_LANG)/man5/drbd.conf.5
+	install -D -m 644 drbd.8 $(PREFIX)/usr/share/man/$(C_LANG)/man8/drbd.8
 
 uninstall:
-	rm $(PREFIX)usr/share/man/$(C_LANG)/man8/drbdsetup.8
-	rm $(PREFIX)usr/share/man/$(C_LANG)/man5/drbd.conf.5
-	rm $(PREFIX)usr/share/man/$(C_LANG)/man8/drbd.8
+	rm $(PREFIX)/usr/share/man/$(C_LANG)/man8/drbdsetup.8
+	rm $(PREFIX)/usr/share/man/$(C_LANG)/man5/drbd.conf.5
+	rm $(PREFIX)/usr/share/man/$(C_LANG)/man8/drbd.8
 
 html:	$(shell ls *.sgml | sed s/sgml/html/g)
 pdf:	$(shell ls *.sgml | sed s/sgml/pdf/g)

Modified: trunk/drbd/Makefile
===================================================================
--- trunk/drbd/Makefile	2004-08-27 13:08:47 UTC (rev 1519)
+++ trunk/drbd/Makefile	2004-08-31 11:46:58 UTC (rev 1520)
@@ -148,9 +148,9 @@
 	@if ! [ -e $(MODOBJ) ] ; then \
 	  echo "No $(MODOBJ): nothing to install??"; false ; \
 	fi
-	install -d $(PREFIX)var/lib/drbd
-	install -d $(PREFIX)lib/modules/$(KERNELRELEASE)/$(MODSUBDIR)
-	install -m 644 $(MODOBJ) $(PREFIX)lib/modules/$(KERNELRELEASE)/$(MODSUBDIR)
+# install -d $(PREFIX)/var/lib/drbd
+	install -d $(PREFIX)/lib/modules/$(KERNELRELEASE)/$(MODSUBDIR)
+	install -m 644 $(MODOBJ) $(PREFIX)/lib/modules/$(KERNELRELEASE)/$(MODSUBDIR)
     ifeq ($(shell uname -r),$(KERNELRELEASE))
 	/sbin/depmod -a || /sbin/depmod -e $(MODOBJ) 2>&1 >/dev/null || true
     else

Modified: trunk/drbd/drbd_compat_wrappers.h
===================================================================
--- trunk/drbd/drbd_compat_wrappers.h	2004-08-27 13:08:47 UTC (rev 1519)
+++ trunk/drbd/drbd_compat_wrappers.h	2004-08-31 11:46:58 UTC (rev 1520)
@@ -366,7 +366,7 @@
 static inline void drbd_set_my_capacity(drbd_dev *mdev, sector_t size)
 {
 	set_capacity(mdev->vdisk,size);
-	mdev->this_bdev->bd_inode->i_size = (loff_t)size << 9;
+	mdev->this_bdev->bd_inode->i_size = ((loff_t)size) << 9;
 }
 
 //#warning "FIXME why don't we care for the return value?"

Modified: trunk/drbd/drbd_fs.c
===================================================================
--- trunk/drbd/drbd_fs.c	2004-08-27 13:08:47 UTC (rev 1519)
+++ trunk/drbd/drbd_fs.c	2004-08-31 11:46:58 UTC (rev 1520)
@@ -366,6 +366,11 @@
 		goto release_bdev2_fail_ioctl;
 	}
 
+	if (drbd_get_capacity(bdev) > DRBD_MAX_SECTORS) {
+		retcode = LDDeviceTooLarge;
+		goto release_bdev2_fail_ioctl;
+	}
+
 	if ( new_conf.meta_index == -1 ) i = 1;
 	else i = new_conf.meta_index+1;
 

Modified: trunk/drbd/drbd_int.h
===================================================================
--- trunk/drbd/drbd_int.h	2004-08-27 13:08:47 UTC (rev 1519)
+++ trunk/drbd/drbd_int.h	2004-08-31 11:46:58 UTC (rev 1520)
@@ -77,6 +77,12 @@
 # warning "FIXME. DRBD_MAJOR is now officially defined in major.h"
 #endif
 
+/* FIXME because of code leftovers from previous times,
+ * currently our code gets heavily confused for device sizes larger
+ * than 2TB, so refuse to configure devices of that size.
+ */
+#define DRBD_MAX_SECTORS (0xffffffffLU)
+
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
 /*lge: this hack is to get rid of the compiler warnings about
  * 'do_nbd_request declared static but never defined'

Modified: trunk/drbd/drbd_main.c
===================================================================
--- trunk/drbd/drbd_main.c	2004-08-27 13:08:47 UTC (rev 1519)
+++ trunk/drbd/drbd_main.c	2004-08-31 11:46:58 UTC (rev 1520)
@@ -903,12 +903,36 @@
        return ret;
 }
 
+#ifdef DRBD_DISABLE_SENDPAGE
 int _drbd_send_page(drbd_dev *mdev, struct page *page,
 		    int offset, size_t size)
 {
 	int sent,ok;
 	int len   = size;
 
+	spin_lock(&mdev->send_task_lock);
+	mdev->send_task=current;
+	spin_unlock(&mdev->send_task_lock);
+
+	sent =  _drbd_no_send_page(mdev, page, offset, size);
+	if (likely(sent > 0)) len -= sent;
+
+	spin_lock(&mdev->send_task_lock);
+	mdev->send_task=NULL;
+	spin_unlock(&mdev->send_task_lock);
+
+	ok = (len == 0);
+	if (likely(ok))
+		mdev->send_cnt += size>>9;
+	return ok;
+}
+#else
+int _drbd_send_page(drbd_dev *mdev, struct page *page,
+		    int offset, size_t size)
+{
+	int sent,ok;
+	int len   = size;
+
 #ifdef SHOW_SENDPAGE_USAGE
 	unsigned long now = jiffies;
 	static unsigned long total = 0;
@@ -980,6 +1004,7 @@
 		mdev->send_cnt += size>>9;
 	return ok;
 }
+#endif
 
 // Used to send write requests: bh->b_rsector !!
 int drbd_send_dblock(drbd_dev *mdev, drbd_request_t *req)

Modified: trunk/drbd/linux/drbd.h
===================================================================
--- trunk/drbd/linux/drbd.h	2004-08-27 13:08:47 UTC (rev 1519)
+++ trunk/drbd/linux/drbd.h	2004-08-31 11:46:58 UTC (rev 1520)
@@ -100,6 +100,8 @@
 	int      al_extents;
 };
 
+/* KEEP the order, do not delete or insert!
+ * Or change the API_VERSION, too. */
 enum ret_codes {
 	NoError=0,
 	LAAlreadyInUse,
@@ -116,7 +118,8 @@
 	LDNoConfig,
 	LDMounted,
 	MDMounted,
-	LDMDInvalid
+	LDMDInvalid,
+	LDDeviceTooLarge,
 };
 
 struct ioctl_disk_config {

Modified: trunk/drbd/linux/drbd_config.h
===================================================================
--- trunk/drbd/linux/drbd_config.h	2004-08-27 13:08:47 UTC (rev 1519)
+++ trunk/drbd/linux/drbd_config.h	2004-08-31 11:46:58 UTC (rev 1520)
@@ -28,6 +28,26 @@
 
 //#define DBG_ALL_SYMBOLS // no static functs, improves quality of OOPS traces
 
+//-------------------------------
+/*
+ * FIXME
+ * This is not yet understood.
+ * Seemingly DRBD and RedHat kernel do not like each other.
+ * Maybe the issue shows with other kernels too.
+ *
+ * In any case, we default to NOT using sendpage, to be on the safe side.
+ *
+ * Out tests with kernel.org/debian/SuSE 2.6. kernel showed no problems
+ * with sendpage, and it inceases performance.
+ *
+ * If you did your own tests, or you are a vendor and really know that it
+ * does not affect your kernel, comment it out.
+ *
+ */
+#define DRBD_DISABLE_SENDPAGE
+//-------------------------------
+
+
 //#define DBG_SPINLOCKS   // enables MUST_HOLD macro (assertions for spinlocks)
 //#define DBG_ASSERTS     // drbd_assert_breakpoint() function
 //#define DUMP_MD 1       // Dump metadata to syslog upon connect

Modified: trunk/scripts/Makefile
===================================================================
--- trunk/scripts/Makefile	2004-08-27 13:08:47 UTC (rev 1519)
+++ trunk/scripts/Makefile	2004-08-31 11:46:58 UTC (rev 1520)
@@ -58,7 +58,7 @@
 	fi
 	install -m 755 drbddisk $(PREFIX)/etc/ha.d/resource.d
 ifeq ($(DIST),suselike)
-	ln -s ../etc/init.d/drbd $(PREFIX)/sbin/rcdrbd
+	ln -sf ../etc/init.d/drbd $(PREFIX)/sbin/rcdrbd
 endif
 	@ echo
 	@ echo "Don't forget to run update-rc.d or chkconfig"

Modified: trunk/scripts/adjust_drbd_config_h.sh
===================================================================
--- trunk/scripts/adjust_drbd_config_h.sh	2004-08-27 13:08:47 UTC (rev 1519)
+++ trunk/scripts/adjust_drbd_config_h.sh	2004-08-31 11:46:58 UTC (rev 1520)
@@ -77,7 +77,7 @@
 
 test -e ./linux/drbd_config.h.orig || cp ./linux/drbd_config.h{,.orig}
 
-perl -i -pe "
+perl -pe "
  s{.*(#define SIGHAND_HACK.*)}
   { ( $need_sighand_hack ? '' : '//' ) . \$1}e;
  s{.*(#define REDHAT_HLIST_BACKPORT.*)}
@@ -87,10 +87,13 @@
  s{.*(#define HAVE_FIND_NEXT_BIT.*)}
   { ( $have_find_next_bit ? '' : '//' ) . \$1}e;
  s{.*(#define HAVE_MM_INLINE_H.*)}
-  { ( $have_mm_inline_h ? '' : '//' ) . \$1}e;" ./linux/drbd_config.h
+  { ( $have_mm_inline_h ? '' : '//' ) . \$1}e;" \
+	  < ./linux/drbd_config.h \
+	  > ./linux/drbd_config.h.new
 
 
-if ! DIFF=$(diff -s -U0 ./linux/drbd_config.h{.orig,}) ; then
+if ! DIFF=$(diff -s -U0 ./linux/drbd_config.h{,.new}) ; then
+  mv ./linux/drbd_config.h{.new,}
   sed -e 's/^/  /' <<___
 
 Adjusted drbd_config.h:
@@ -98,5 +101,6 @@
 
 ___
 else
+	rm ./linux/drbd_config.h.new
 	echo -e "\n  Using unmodified drbd_config.h\n"
 fi

Modified: trunk/user/drbdsetup.c
===================================================================
--- trunk/user/drbdsetup.c	2004-08-27 13:08:47 UTC (rev 1519)
+++ trunk/user/drbdsetup.c	2004-08-31 11:46:58 UTC (rev 1520)
@@ -565,7 +565,9 @@
     [LDNoConfig]="You have to use the disk command first.",
     [LDMounted]="Lower device is already mounted.",
     [MDMounted]="Meta device is already mounted.",
-    [LDMDInvalid]="Lower device / meta device / index combination invalid."
+    [LDMDInvalid]="Lower device / meta device / index combination invalid.",
+    [LDDeviceTooLarge]="Currently we only support devices up to 2TB.\n"
+                       "Contact office@linbit.com, if you need more.",
   };
 
   if (err_no>ARRY_SIZE(etext) || err_no<0) err_no=0;

From svn at svn.drbd.org  Tue Aug 31 14:04:40 2004
From: svn at svn.drbd.org (svn@svn.drbd.org)
Date: Tue Aug 31 14:04:42 2004
Subject: [DRBD-cvs] r1521 - trunk
Message-ID: <20040831120440.606FA3BE6E@garcon.linbit.com>

Author: phil
Date: 2004-08-31 14:04:37 +0200 (Tue, 31 Aug 2004)
New Revision: 1521

Modified:
   trunk/
Log:
Properties for svnp (see https://oss.linbit.com/svnp)



Property changes on: trunk
___________________________________________________________________
Name: propagate:to
   + /drbd/plus-branches/01-wait-sync-target
Name: propagate:lo
   + ../drbd07-p-01

From svn at svn.drbd.org  Tue Aug 31 14:08:32 2004
From: svn at svn.drbd.org (svn@svn.drbd.org)
Date: Tue Aug 31 14:08:35 2004
Subject: [DRBD-cvs] r1523 - in plus-branches/01-wait-sync-target: .
	documentation drbd drbd/linux scripts user
Message-ID: <20040831120832.9D7CC3BE6E@garcon.linbit.com>

Author: phil
Date: 2004-08-31 14:08:29 +0200 (Tue, 31 Aug 2004)
New Revision: 1523

Modified:
   plus-branches/01-wait-sync-target/
   plus-branches/01-wait-sync-target/documentation/Makefile
   plus-branches/01-wait-sync-target/documentation/Makefile.lang
   plus-branches/01-wait-sync-target/drbd/Makefile
   plus-branches/01-wait-sync-target/drbd/drbd_compat_wrappers.h
   plus-branches/01-wait-sync-target/drbd/drbd_fs.c
   plus-branches/01-wait-sync-target/drbd/drbd_int.h
   plus-branches/01-wait-sync-target/drbd/drbd_main.c
   plus-branches/01-wait-sync-target/drbd/linux/drbd.h
   plus-branches/01-wait-sync-target/drbd/linux/drbd_config.h
   plus-branches/01-wait-sync-target/scripts/Makefile
   plus-branches/01-wait-sync-target/scripts/adjust_drbd_config_h.sh
   plus-branches/01-wait-sync-target/user/drbdsetup.c
Log:
svnp run. Investigated 1518 to 1523


Property changes on: plus-branches/01-wait-sync-target
___________________________________________________________________
Name: propagate:at
   - 1518
   + 1523

Modified: plus-branches/01-wait-sync-target/documentation/Makefile
===================================================================
--- plus-branches/01-wait-sync-target/documentation/Makefile	2004-08-31 12:07:15 UTC (rev 1522)
+++ plus-branches/01-wait-sync-target/documentation/Makefile	2004-08-31 12:08:29 UTC (rev 1523)
@@ -139,16 +139,16 @@
 	@ok=true; for f in $(MANPAGES) ; \
 		do [ -e $$f ] || { echo $$f missing ; ok=false; } ; \
 	done ; $$ok
-	@ set -e; for f in $(MANPAGES) ; do \
+	set -e; for f in $(MANPAGES) ; do \
 		s=$${f##*.}; \
-		install -v -D -m 644 $$f $(PREFIX)usr/share/man/man$$s/$$f ; \
+		install -v -D -m 644 $$f $(PREFIX)/usr/share/man/man$$s/$$f ; \
 	done
 	@ set -e; for i in $(LANGS); do $(MAKE) -C $$i install; done
 
 uninstall:
 	@ set -e; for f in $(MANPAGES) ; do \
 		s=$${f##*.}; \
-		rm -v $(PREFIX)usr/share/man/man$$s/$$f ; \
+		rm -v $(PREFIX)/usr/share/man/man$$s/$$f ; \
 	done
 	@ set -e; for i in $(LANGS); do $(MAKE) -C $$i uninstall; done
 

Modified: plus-branches/01-wait-sync-target/documentation/Makefile.lang
===================================================================
--- plus-branches/01-wait-sync-target/documentation/Makefile.lang	2004-08-31 12:07:15 UTC (rev 1522)
+++ plus-branches/01-wait-sync-target/documentation/Makefile.lang	2004-08-31 12:08:29 UTC (rev 1523)
@@ -93,14 +93,14 @@
 	rm -f *.ps.gz *.pdf *.ps *.html
 
 install:
-	install -D -m 644 drbdsetup.8 $(PREFIX)usr/share/man/$(C_LANG)/man8/drbdsetup.8
-	install -D -m 644 drbd.conf.5 $(PREFIX)usr/share/man/$(C_LANG)/man5/drbd.conf.5
-	install -D -m 644 drbd.8 $(PREFIX)usr/share/man/$(C_LANG)/man8/drbd.8
+	install -D -m 644 drbdsetup.8 $(PREFIX)/usr/share/man/$(C_LANG)/man8/drbdsetup.8
+	install -D -m 644 drbd.conf.5 $(PREFIX)/usr/share/man/$(C_LANG)/man5/drbd.conf.5
+	install -D -m 644 drbd.8 $(PREFIX)/usr/share/man/$(C_LANG)/man8/drbd.8
 
 uninstall:
-	rm $(PREFIX)usr/share/man/$(C_LANG)/man8/drbdsetup.8
-	rm $(PREFIX)usr/share/man/$(C_LANG)/man5/drbd.conf.5
-	rm $(PREFIX)usr/share/man/$(C_LANG)/man8/drbd.8
+	rm $(PREFIX)/usr/share/man/$(C_LANG)/man8/drbdsetup.8
+	rm $(PREFIX)/usr/share/man/$(C_LANG)/man5/drbd.conf.5
+	rm $(PREFIX)/usr/share/man/$(C_LANG)/man8/drbd.8
 
 html:	$(shell ls *.sgml | sed s/sgml/html/g)
 pdf:	$(shell ls *.sgml | sed s/sgml/pdf/g)

Modified: plus-branches/01-wait-sync-target/drbd/Makefile
===================================================================
--- plus-branches/01-wait-sync-target/drbd/Makefile	2004-08-31 12:07:15 UTC (rev 1522)
+++ plus-branches/01-wait-sync-target/drbd/Makefile	2004-08-31 12:08:29 UTC (rev 1523)
@@ -148,9 +148,9 @@
 	@if ! [ -e $(MODOBJ) ] ; then \
 	  echo "No $(MODOBJ): nothing to install??"; false ; \
 	fi
-	install -d $(PREFIX)var/lib/drbd
-	install -d $(PREFIX)lib/modules/$(KERNELRELEASE)/$(MODSUBDIR)
-	install -m 644 $(MODOBJ) $(PREFIX)lib/modules/$(KERNELRELEASE)/$(MODSUBDIR)
+# install -d $(PREFIX)/var/lib/drbd
+	install -d $(PREFIX)/lib/modules/$(KERNELRELEASE)/$(MODSUBDIR)
+	install -m 644 $(MODOBJ) $(PREFIX)/lib/modules/$(KERNELRELEASE)/$(MODSUBDIR)
     ifeq ($(shell uname -r),$(KERNELRELEASE))
 	/sbin/depmod -a || /sbin/depmod -e $(MODOBJ) 2>&1 >/dev/null || true
     else

Modified: plus-branches/01-wait-sync-target/drbd/drbd_compat_wrappers.h
===================================================================
--- plus-branches/01-wait-sync-target/drbd/drbd_compat_wrappers.h	2004-08-31 12:07:15 UTC (rev 1522)
+++ plus-branches/01-wait-sync-target/drbd/drbd_compat_wrappers.h	2004-08-31 12:08:29 UTC (rev 1523)
@@ -366,7 +366,7 @@
 static inline void drbd_set_my_capacity(drbd_dev *mdev, sector_t size)
 {
 	set_capacity(mdev->vdisk,size);
-	mdev->this_bdev->bd_inode->i_size = (loff_t)size << 9;
+	mdev->this_bdev->bd_inode->i_size = ((loff_t)size) << 9;
 }
 
 //#warning "FIXME why don't we care for the return value?"

Modified: plus-branches/01-wait-sync-target/drbd/drbd_fs.c
===================================================================
--- plus-branches/01-wait-sync-target/drbd/drbd_fs.c	2004-08-31 12:07:15 UTC (rev 1522)
+++ plus-branches/01-wait-sync-target/drbd/drbd_fs.c	2004-08-31 12:08:29 UTC (rev 1523)
@@ -366,6 +366,11 @@
 		goto release_bdev2_fail_ioctl;
 	}
 
+	if (drbd_get_capacity(bdev) > DRBD_MAX_SECTORS) {
+		retcode = LDDeviceTooLarge;
+		goto release_bdev2_fail_ioctl;
+	}
+
 	if ( new_conf.meta_index == -1 ) i = 1;
 	else i = new_conf.meta_index+1;
 

Modified: plus-branches/01-wait-sync-target/drbd/drbd_int.h
===================================================================
--- plus-branches/01-wait-sync-target/drbd/drbd_int.h	2004-08-31 12:07:15 UTC (rev 1522)
+++ plus-branches/01-wait-sync-target/drbd/drbd_int.h	2004-08-31 12:08:29 UTC (rev 1523)
@@ -77,6 +77,12 @@
 # warning "FIXME. DRBD_MAJOR is now officially defined in major.h"
 #endif
 
+/* FIXME because of code leftovers from previous times,
+ * currently our code gets heavily confused for device sizes larger
+ * than 2TB, so refuse to configure devices of that size.
+ */
+#define DRBD_MAX_SECTORS (0xffffffffLU)
+
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
 /*lge: this hack is to get rid of the compiler warnings about
  * 'do_nbd_request declared static but never defined'

Modified: plus-branches/01-wait-sync-target/drbd/drbd_main.c
===================================================================
--- plus-branches/01-wait-sync-target/drbd/drbd_main.c	2004-08-31 12:07:15 UTC (rev 1522)
+++ plus-branches/01-wait-sync-target/drbd/drbd_main.c	2004-08-31 12:08:29 UTC (rev 1523)
@@ -903,12 +903,36 @@
        return ret;
 }
 
+#ifdef DRBD_DISABLE_SENDPAGE
 int _drbd_send_page(drbd_dev *mdev, struct page *page,
 		    int offset, size_t size)
 {
 	int sent,ok;
 	int len   = size;
 
+	spin_lock(&mdev->send_task_lock);
+	mdev->send_task=current;
+	spin_unlock(&mdev->send_task_lock);
+
+	sent =  _drbd_no_send_page(mdev, page, offset, size);
+	if (likely(sent > 0)) len -= sent;
+
+	spin_lock(&mdev->send_task_lock);
+	mdev->send_task=NULL;
+	spin_unlock(&mdev->send_task_lock);
+
+	ok = (len == 0);
+	if (likely(ok))
+		mdev->send_cnt += size>>9;
+	return ok;
+}
+#else
+int _drbd_send_page(drbd_dev *mdev, struct page *page,
+		    int offset, size_t size)
+{
+	int sent,ok;
+	int len   = size;
+
 #ifdef SHOW_SENDPAGE_USAGE
 	unsigned long now = jiffies;
 	static unsigned long total = 0;
@@ -980,6 +1004,7 @@
 		mdev->send_cnt += size>>9;
 	return ok;
 }
+#endif
 
 // Used to send write requests: bh->b_rsector !!
 int drbd_send_dblock(drbd_dev *mdev, drbd_request_t *req)

Modified: plus-branches/01-wait-sync-target/drbd/linux/drbd.h
===================================================================
--- plus-branches/01-wait-sync-target/drbd/linux/drbd.h	2004-08-31 12:07:15 UTC (rev 1522)
+++ plus-branches/01-wait-sync-target/drbd/linux/drbd.h	2004-08-31 12:08:29 UTC (rev 1523)
@@ -100,6 +100,8 @@
 	int      al_extents;
 };
 
+/* KEEP the order, do not delete or insert!
+ * Or change the API_VERSION, too. */
 enum ret_codes {
 	NoError=0,
 	LAAlreadyInUse,
@@ -116,7 +118,8 @@
 	LDNoConfig,
 	LDMounted,
 	MDMounted,
-	LDMDInvalid
+	LDMDInvalid,
+	LDDeviceTooLarge,
 };
 
 struct ioctl_disk_config {

Modified: plus-branches/01-wait-sync-target/drbd/linux/drbd_config.h
===================================================================
--- plus-branches/01-wait-sync-target/drbd/linux/drbd_config.h	2004-08-31 12:07:15 UTC (rev 1522)
+++ plus-branches/01-wait-sync-target/drbd/linux/drbd_config.h	2004-08-31 12:08:29 UTC (rev 1523)
@@ -28,6 +28,26 @@
 
 //#define DBG_ALL_SYMBOLS // no static functs, improves quality of OOPS traces
 
+//-------------------------------
+/*
+ * FIXME
+ * This is not yet understood.
+ * Seemingly DRBD and RedHat kernel do not like each other.
+ * Maybe the issue shows with other kernels too.
+ *
+ * In any case, we default to NOT using sendpage, to be on the safe side.
+ *
+ * Out tests with kernel.org/debian/SuSE 2.6. kernel showed no problems
+ * with sendpage, and it inceases performance.
+ *
+ * If you did your own tests, or you are a vendor and really know that it
+ * does not affect your kernel, comment it out.
+ *
+ */
+#define DRBD_DISABLE_SENDPAGE
+//-------------------------------
+
+
 //#define DBG_SPINLOCKS   // enables MUST_HOLD macro (assertions for spinlocks)
 //#define DBG_ASSERTS     // drbd_assert_breakpoint() function
 //#define DUMP_MD 1       // Dump metadata to syslog upon connect

Modified: plus-branches/01-wait-sync-target/scripts/Makefile
===================================================================
--- plus-branches/01-wait-sync-target/scripts/Makefile	2004-08-31 12:07:15 UTC (rev 1522)
+++ plus-branches/01-wait-sync-target/scripts/Makefile	2004-08-31 12:08:29 UTC (rev 1523)
@@ -58,7 +58,7 @@
 	fi
 	install -m 755 drbddisk $(PREFIX)/etc/ha.d/resource.d
 ifeq ($(DIST),suselike)
-	ln -s ../etc/init.d/drbd $(PREFIX)/sbin/rcdrbd
+	ln -sf ../etc/init.d/drbd $(PREFIX)/sbin/rcdrbd
 endif
 	@ echo
 	@ echo "Don't forget to run update-rc.d or chkconfig"

Modified: plus-branches/01-wait-sync-target/scripts/adjust_drbd_config_h.sh
===================================================================
--- plus-branches/01-wait-sync-target/scripts/adjust_drbd_config_h.sh	2004-08-31 12:07:15 UTC (rev 1522)
+++ plus-branches/01-wait-sync-target/scripts/adjust_drbd_config_h.sh	2004-08-31 12:08:29 UTC (rev 1523)
@@ -77,7 +77,7 @@
 
 test -e ./linux/drbd_config.h.orig || cp ./linux/drbd_config.h{,.orig}
 
-perl -i -pe "
+perl -pe "
  s{.*(#define SIGHAND_HACK.*)}
   { ( $need_sighand_hack ? '' : '//' ) . \$1}e;
  s{.*(#define REDHAT_HLIST_BACKPORT.*)}
@@ -87,10 +87,13 @@
  s{.*(#define HAVE_FIND_NEXT_BIT.*)}
   { ( $have_find_next_bit ? '' : '//' ) . \$1}e;
  s{.*(#define HAVE_MM_INLINE_H.*)}
-  { ( $have_mm_inline_h ? '' : '//' ) . \$1}e;" ./linux/drbd_config.h
+  { ( $have_mm_inline_h ? '' : '//' ) . \$1}e;" \
+	  < ./linux/drbd_config.h \
+	  > ./linux/drbd_config.h.new
 
 
-if ! DIFF=$(diff -s -U0 ./linux/drbd_config.h{.orig,}) ; then
+if ! DIFF=$(diff -s -U0 ./linux/drbd_config.h{,.new}) ; then
+  mv ./linux/drbd_config.h{.new,}
   sed -e 's/^/  /' <<___
 
 Adjusted drbd_config.h:
@@ -98,5 +101,6 @@
 
 ___
 else
+	rm ./linux/drbd_config.h.new
 	echo -e "\n  Using unmodified drbd_config.h\n"
 fi

Modified: plus-branches/01-wait-sync-target/user/drbdsetup.c
===================================================================
--- plus-branches/01-wait-sync-target/user/drbdsetup.c	2004-08-31 12:07:15 UTC (rev 1522)
+++ plus-branches/01-wait-sync-target/user/drbdsetup.c	2004-08-31 12:08:29 UTC (rev 1523)
@@ -565,7 +565,9 @@
     [LDNoConfig]="You have to use the disk command first.",
     [LDMounted]="Lower device is already mounted.",
     [MDMounted]="Meta device is already mounted.",
-    [LDMDInvalid]="Lower device / meta device / index combination invalid."
+    [LDMDInvalid]="Lower device / meta device / index combination invalid.",
+    [LDDeviceTooLarge]="Currently we only support devices up to 2TB.\n"
+                       "Contact office@linbit.com, if you need more.",
   };
 
   if (err_no>ARRY_SIZE(etext) || err_no<0) err_no=0;

From svn at svn.drbd.org  Tue Aug 31 14:48:55 2004
From: svn at svn.drbd.org (svn@svn.drbd.org)
Date: Tue Aug 31 14:49:03 2004
Subject: [DRBD-cvs] r1524 - in plus-branches/01-wait-sync-target: . debian
	drbd/linux
Message-ID: <20040831124855.ABB6A3BE6E@garcon.linbit.com>

Author: phil
Date: 2004-08-31 14:48:52 +0200 (Tue, 31 Aug 2004)
New Revision: 1524

Modified:
   plus-branches/01-wait-sync-target/
   plus-branches/01-wait-sync-target/ChangeLog
   plus-branches/01-wait-sync-target/debian/changelog
   plus-branches/01-wait-sync-target/drbd.spec.in
   plus-branches/01-wait-sync-target/drbd/linux/drbd_config.h
Log:
svnp run. Investigated 1517 to 1524


Property changes on: plus-branches/01-wait-sync-target
___________________________________________________________________
Name: propagate:at
   - 1523
   + 1524

Modified: plus-branches/01-wait-sync-target/ChangeLog
===================================================================
--- plus-branches/01-wait-sync-target/ChangeLog	2004-08-31 12:08:29 UTC (rev 1523)
+++ plus-branches/01-wait-sync-target/ChangeLog	2004-08-31 12:48:52 UTC (rev 1524)
@@ -4,6 +4,9 @@
  Cumulative changes since last tarball.
  For even more detail, use "svn log" and "svn diff".
 
+0.7.3 (api:75/proto:74)
+-----
+ * Fixed minor bugs in the handling of the generation counters.
  * prevent possible in-kernel buffer overflow in drbd_proc.c
  * Fixed debian's postinst script to create /dev/drbd? instead of /dev/nb?
  * drbd status:

Modified: plus-branches/01-wait-sync-target/debian/changelog
===================================================================
--- plus-branches/01-wait-sync-target/debian/changelog	2004-08-31 12:08:29 UTC (rev 1523)
+++ plus-branches/01-wait-sync-target/debian/changelog	2004-08-31 12:48:52 UTC (rev 1524)
@@ -1,3 +1,17 @@
+drbd (0.7.3-1) unstable; urgency=low
+
+  * Fixed minor bugs in the handling of the generation counters.
+  * prevent possible in-kernel buffer overflow in drbd_proc.c
+  * Fixed debian's postinst script to create /dev/drbd? instead of /dev/nb?
+  * drbd status:
+    be nice to heartbeat, include "OK" in output.
+  * added FullSync meta data flag to read/write gc.pl
+  * make the RHEL3 happy (page_count no longer in mm.h, but in mm_inline.h)
+  * [Patch by Pavel Semerad]. Also use the drbd_devfs_name on Linux-2.4.x
+  * fix missing dependencies on drbd_config.h
+
+ -- Philipp Reisner <phil@linbit.com>  Fri, 27 Aug 2004 15:02:00 +0200
+
 drbd (0.7.2-1) unstable; urgency=low
 
   * Proper handling of backing storage devices that occasionally fail 

Modified: plus-branches/01-wait-sync-target/drbd/linux/drbd_config.h
===================================================================
--- plus-branches/01-wait-sync-target/drbd/linux/drbd_config.h	2004-08-31 12:08:29 UTC (rev 1523)
+++ plus-branches/01-wait-sync-target/drbd/linux/drbd_config.h	2004-08-31 12:48:52 UTC (rev 1524)
@@ -22,7 +22,7 @@
 
 extern const char * drbd_buildtag(void);
 
-#define REL_VERSION "0.7.2"
+#define REL_VERSION "0.7.3"
 #define API_VERSION 75
 #define PRO_VERSION 74
 

Modified: plus-branches/01-wait-sync-target/drbd.spec.in
===================================================================
--- plus-branches/01-wait-sync-target/drbd.spec.in	2004-08-31 12:08:29 UTC (rev 1523)
+++ plus-branches/01-wait-sync-target/drbd.spec.in	2004-08-31 12:48:52 UTC (rev 1524)
@@ -177,6 +177,18 @@
 /sbin/depmod -a -F /boot/System.map-%{kernelversion} %{kernelversion} >/dev/null 2>&1 || true
 
 %changelog
+* Fri Aug 27 2004 15:02:00 +0200 Philipp Reisner <phil@linbit.com>
+- drbd (0.7.3-1)
+  * Fixed minor bugs in the handling of the generation counters.
+  * prevent possible in-kernel buffer overflow in drbd_proc.c
+  * Fixed debian's postinst script to create /dev/drbd? instead of /dev/nb?
+  * drbd status:
+    be nice to heartbeat, include "OK" in output.
+  * added FullSync meta data flag to read/write gc.pl
+  * make the RHEL3 happy (page_count no longer in mm.h, but in mm_inline.h)
+  * [Patch by Pavel Semerad]. Also use the drbd_devfs_name on Linux-2.4.x
+  * fix missing dependencies on drbd_config.h
+
 * Fri Aug 06 2004 14:44:31 +0200 Philipp Reisner <phil@linbit.com>
 - drbd (0.7.2-1)
   * Proper handling of backing storage devices that occasionally fail 

