[DRBD-cvs] svn commit by phil - r2250 - in trunk: . documentation drbd drbd/linux scripts user - svnp run. Applied all fixes and improvements, that happ

drbd-cvs at lists.linbit.com drbd-cvs at lists.linbit.com
Thu Jun 29 16:19:25 CEST 2006


Author: phil
Date: 2006-06-29 16:19:21 +0200 (Thu, 29 Jun 2006)
New Revision: 2250

Modified:
   trunk/
   trunk/ChangeLog
   trunk/documentation/drbd.conf.sgml
   trunk/documentation/drbd.sgml
   trunk/documentation/drbdadm.sgml
   trunk/documentation/drbddisk.sgml
   trunk/documentation/drbdsetup.sgml
   trunk/drbd/Makefile
   trunk/drbd/drbd_actlog.c
   trunk/drbd/drbd_bitmap.c
   trunk/drbd/drbd_fs.c
   trunk/drbd/drbd_int.h
   trunk/drbd/drbd_main.c
   trunk/drbd/drbd_proc.c
   trunk/drbd/drbd_receiver.c
   trunk/drbd/drbd_req.c
   trunk/drbd/drbd_worker.c
   trunk/drbd/linux/drbd.h
   trunk/drbd/lru_cache.c
   trunk/drbd/lru_cache.h
   trunk/scripts/drbd.conf
   trunk/scripts/patch-kernel
   trunk/user/drbd_limits.h
   trunk/user/drbdadm_adjust.c
   trunk/user/drbdadm_main.c
   trunk/user/drbdadm_scanner.fl
   trunk/user/drbdsetup.c
Log:
svnp run. Applied all fixes and improvements, that happened in the
0.7-branch to the trunk.




Property changes on: trunk
___________________________________________________________________
Name: propagate:at
   - 2158
   + 2249

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2006-06-26 10:19:41 UTC (rev 2249)
+++ trunk/ChangeLog	2006-06-29 14:19:21 UTC (rev 2250)
@@ -1,6 +1,6 @@
 Latest:
 ------
- ChangeLog last updated: r2130 2006-04-06
+ ChangeLog last updated: $LastChangedRev$ $LastChangedDate$
  Cumulative changes since last tarball.
  For even more detail, use "svn log" and "svn diff".
 


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

Modified: trunk/documentation/drbd.conf.sgml
===================================================================
--- trunk/documentation/drbd.conf.sgml	2006-06-26 10:19:41 UTC (rev 2249)
+++ trunk/documentation/drbd.conf.sgml	2006-06-29 14:19:21 UTC (rev 2250)
@@ -519,6 +519,21 @@
 </varlistentry>
 
 <varlistentry>
+  <term><option>unplug-watermark <replaceable>number</replaceable></option></term>
+  <listitem>
+    <para>
+      When the number of pending write requests on the standby
+      (secondary) node exceeds the unplug-watermark, we trigger
+      the request processing of our backing storage device.
+      Some storage controllers deliver better performance with small
+      values, other deliver best performance when it is set to
+      the same value as max-buffers. Minimum 16, default 128, maximum
+      131072.
+    </para>
+  </listitem>
+</varlistentry>
+
+<varlistentry>
   <term><option>cram-hmac-alg</option></term>
   <listitem><para>
     You need to specifying the HMAC algorithm to enable peer authentication

Modified: trunk/documentation/drbd.sgml
===================================================================
--- trunk/documentation/drbd.sgml	2006-06-26 10:19:41 UTC (rev 2249)
+++ trunk/documentation/drbd.sgml	2006-06-29 14:19:21 UTC (rev 2250)
@@ -53,7 +53,7 @@
 
 <refsect1>
   <title>Version</title>
-  <simpara>This document is correct for version 0.7.15 of the DRBD distribution.
+  <simpara>This document is correct for version 0.7.20 of the DRBD distribution.
   </simpara>
 </refsect1>
 
@@ -74,7 +74,7 @@
 <refsect1>
   <title>Copyright</title>
   <simpara>
-    Copyright (c) 2001-2005 Philipp Reisner. This  is  free software; 
+    Copyright (c) 2001-2006 Philipp Reisner. This  is  free software; 
     see the source for copying conditions.  There is NO warranty; 
     not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
   </simpara>

Modified: trunk/documentation/drbdadm.sgml
===================================================================
--- trunk/documentation/drbdadm.sgml	2006-06-26 10:19:41 UTC (rev 2249)
+++ trunk/documentation/drbdadm.sgml	2006-06-29 14:19:21 UTC (rev 2250)
@@ -296,7 +296,7 @@
   <refsect1>
     <title>Copyright</title>
     <simpara>
-      Copyright (c) 2004-2005 Philipp Reisner. This  is  free software; 
+      Copyright (c) 2004-2006 Philipp Reisner. This  is  free software; 
       see the source for copying conditions.  There is NO warranty; 
       not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     </simpara>

Modified: trunk/documentation/drbddisk.sgml
===================================================================
--- trunk/documentation/drbddisk.sgml	2006-06-26 10:19:41 UTC (rev 2249)
+++ trunk/documentation/drbddisk.sgml	2006-06-29 14:19:21 UTC (rev 2250)
@@ -45,7 +45,7 @@
 
 <refsect1>
 <title>Version</title>
-<simpara>This document is correct for version 0.7.15 of the DRBD distribution.
+<simpara>This document is correct for version 0.7.20 of the DRBD distribution.
 </simpara>
 </refsect1>
 
@@ -66,7 +66,7 @@
 <refsect1>
   <title>Copyright</title>
   <simpara>
-    Copyright (c) 2004-2005 Philipp Reisner. This  is  free software; 
+    Copyright (c) 2004-2006 Philipp Reisner. This  is  free software; 
     see the source for copying conditions.  There is NO warranty; 
     not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
   </simpara>

Modified: trunk/documentation/drbdsetup.sgml
===================================================================
--- trunk/documentation/drbdsetup.sgml	2006-06-26 10:19:41 UTC (rev 2249)
+++ trunk/documentation/drbdsetup.sgml	2006-06-29 14:19:21 UTC (rev 2250)
@@ -396,15 +396,29 @@
 	  </listitem>
 	</varlistentry>
 	<varlistentry>
+	  <term><option>-l</option>,
+	  <option>--unplug-watermark <replaceable>val</replaceable></option></term>
+	  <listitem>
+	    <para>
+	      When the number of pending write requests on the standby
+	      (secondary) node exceeds the unplug-watermark, we trigger
+	      the request processing of our backing storage device.
+	      Some storage controllers deliver better performance with small
+	      values, other deliver best performance when it is set to
+	      the same value as max-buffers. Minimum 16, default 128, maximum
+	      131072.
+	    </para>
+	  </listitem>
+	</varlistentry>
+	<varlistentry>
 	  <term><option>-d</option>,
 	  <option>--on-disconnect <replaceable>discon_handler</replaceable></option></term>
 	  <listitem>
 	    <para>
 	      When the connection to the peer is lost, DRBD can either
-	      go into stand alone mode, try to reconnect to the peer or
-	      freeze all further IO requests (think of an NFS hard mount).
-	      The keywords are: <option>stand_alone</option>, 
-	      <option>reconnect</option> and <option>freeze_io</option>.
+	      go into stand alone mode, or try to reconnect to the peer.
+	      The keywords are: <option>stand_alone</option> and
+	      <option>reconnect</option>.
 	      The default handler is <option>reconnect</option>.
 	    </para>
 	  </listitem>
@@ -856,7 +870,7 @@
   <refsect1>
     <title>Copyright</title>
     <simpara>
-      Copyright (c) 2001-2005 Philipp Reisner. This  is  free software; 
+      Copyright (c) 2001-2006 Philipp Reisner. This  is  free software; 
       see the source for copying conditions.  There is NO warranty; 
       not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
     </simpara>

Modified: trunk/drbd/Makefile
===================================================================
--- trunk/drbd/Makefile	2006-06-26 10:19:41 UTC (rev 2249)
+++ trunk/drbd/Makefile	2006-06-29 14:19:21 UTC (rev 2250)
@@ -27,7 +27,11 @@
 # note: if you get strange make errors when ARCH=um, you
 # probably need to "make mrproper" in the KDIR first... 
 
-ifneq ($(KERNELRELEASE),)
+# since 2.6.16, KERNELRELEASE may be empty,
+# e.g. when building agains some (broken?) linux-header package.
+# Lets test on PATCHLEVEL, that won't change too soon...
+
+ifneq ($(PATCHLEVEL),)
   ifneq ($(VERSION),2)
     $(error "won't compile with this kernel version")
   endif
@@ -45,8 +49,10 @@
                   "PATCHLEVEL=$(PATCHLEVEL)\n"       \
                   "SUBLEVEL=$(SUBLEVEL)\n"           \
                   "EXTRAVERSION=$(EXTRAVERSION)\n"   \
-                  "KERNELRELEASE=$(KERNELRELEASE)" \
-          > $(DRBDSRC)/.kernelrelease.new \
+                  "LOCALVERSION=$(LOCALVERSION)\n"   \
+                  "KERNELRELEASE=$(KERNELRELEASE)\n" \
+                  "KERNELVERSION=$(KERNELVERSION)"   \
+          > $(DRBDSRC)/.drbd_kernelrelease.new       \
    )
 else
   # called from command line in current directory
@@ -106,21 +112,21 @@
        	mv $@{.new,}
 
   kbuild: drbd_buildtag.c
-	@rm -f .kernelrelease*
+	@rm -f .drbd_kernelrelease*
     # previous to 2.6.6 (suse: 2.6.5-dunno), this should be:
 	$(MAKE) -C $(KDIR) SUBDIRS=$(DRBDSRC) $(ARCH_UM) modules
 # $(MAKE) -C $(KDIR) M=$(DRBDSRC) $(ARCH_UM) modules
-	@mv .kernelrelease.new .kernelrelease
+	-mv .drbd_kernelrelease.new .drbd_kernelrelease
 	@echo -n "Memorizing module configuration ... "
 	@{ echo -e "#\n# drbd.o was compiled with"          ; \
 	  echo "#  `gcc -v 2>&1 | tail -1`"                 ; \
 	  echo "# against this kernelrelease:"              ; \
-	  sed 's/^/#  /' .kernelrelease                     ; \
-          echo    "# kernel .config from"                   ; \
+	  sed 's/^/#  /' .drbd_kernelrelease                ; \
+	  echo    "# kernel .config from"                   ; \
 	  echo -n "#  $(KDIR)/.config"                      ; \
-          test -L "$(KDIR)" && echo "	alias"   &&           \
+	  test -L "$(KDIR)" && echo "	alias"   &&           \
 	  echo "#  $$(readlink $(KDIR))/.config" || echo "" ; \
-	  echo -e "# follows\n#\n"                             ; \
+	  echo -e "# follows\n#\n"                          ; \
 	  cat $(KDIR)/.config ; } | gzip > .kernel.config.gz
 	@echo "done."
 
@@ -130,9 +136,9 @@
 
   distclean: clean
 
-  ifneq ($(wildcard .kernelrelease),)
+  ifneq ($(wildcard .drbd_kernelrelease),)
     # for VERSION, PATCHLEVEL, SUBLEVEL, EXTRAVERSION, KERNELRELEASE
-    include .kernelrelease
+    include .drbd_kernelrelease
     MODOBJ := drbd.ko
     MODSUBDIR := kernel/drivers/block
     LINUX := $(wildcard /lib/modules/$(KERNELRELEASE)/build)
@@ -154,7 +160,7 @@
     endif
   else
     install:
-	@echo "No .kernelrelease found. Do you need to 'make' the module first?"
+	@echo "No .drbd_kernelrelease found. Do you need to 'make' the module first?"
 	@false
   endif
 

Modified: trunk/drbd/drbd_actlog.c
===================================================================
--- trunk/drbd/drbd_actlog.c	2006-06-26 10:19:41 UTC (rev 2249)
+++ trunk/drbd/drbd_actlog.c	2006-06-29 14:19:21 UTC (rev 2250)
@@ -5,9 +5,9 @@
 
    This file is part of drbd by Philipp Reisner.
 
-   Copyright (C) 2003-2004, Philipp Reisner <philipp.reisner at linbit.com>.
-   Copyright (C) 2003-2004, Lars Ellenberg <l.g.e at web.de>.
-        authors.
+   Copyright (C) 2003-2006, Philipp Reisner <philipp.reisner at linbit.com>.
+   Copyright (C) 2003-2006, Lars Ellenberg <lars.ellenberg at linbit.com>.
+   Copyright (C) 2003-2006, LINBIT Information Technologies GmbH.
 
    drbd is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -84,7 +84,7 @@
 	// in case hardsect != 512 [ s390 only? ]
 	if( hardsect != MD_HARDSECT ) {
 		if(!mdev->md_io_tmpp) {
-			struct page *page = alloc_page(GFP_KERNEL);
+			struct page *page = alloc_page(GFP_NOIO);
 			if(!page) return 0;
 
 			WARN("Meta data's bdev hardsect_size != %d\n",
@@ -339,6 +339,12 @@
 	return 1;
 }
 
+/**
+ * drbd_al_read_tr: Reads a single transaction record form the 
+ * on disk activity log.
+ * Returns -1 on IO error, 0 on checksum error and 1 if it is a valid
+ * record.
+ */
 STATIC int drbd_al_read_tr(struct Drbd_Conf *mdev,
 			   struct al_transaction* b,
 			   int index)
@@ -352,7 +358,7 @@
 	if(!drbd_md_sync_page_io(mdev,mdev->bc,sector,READ)) {
 		drbd_chk_io_error(mdev, 1);
 		drbd_io_error(mdev);
-		return 0;
+		return -1;
 	}
 
 	rv = ( be32_to_cpu(b->magic) == DRBD_MAGIC );
@@ -365,7 +371,12 @@
 	return rv;
 }
 
-void drbd_al_read_log(struct Drbd_Conf *mdev)
+/**
+ * drbd_al_read_log: Restores the activity log from its on disk
+ * representation. Returns 1 on success, returns 0 when 
+ * reading the log failed due to IO errors.
+ */
+int drbd_al_read_log(struct Drbd_Conf *mdev)
 {
 	struct al_transaction* buffer;
 	int from=-1,to=-1,i,cnr, overflow=0,rv;
@@ -384,7 +395,12 @@
 
 	// Find the valid transaction in the log
 	for(i=0;i<=mx;i++) {
-		if(!drbd_al_read_tr(mdev,buffer,i)) continue;
+		rv = drbd_al_read_tr(mdev,buffer,i);
+		if(rv == 0) continue;
+		if(rv == -1) {
+			up(&mdev->md_io_mutex);
+			return 0;
+		}
 		cnr = be32_to_cpu(buffer->tr_number);
 		// INFO("index %d valid tnr=%d\n",i,cnr);
 
@@ -404,7 +420,7 @@
 		WARN("No usable activity log found.\n");
 
 		up(&mdev->md_io_mutex);
-		return;
+		return 1;
 	}
 
 	// Read the valid transactions.
@@ -419,7 +435,11 @@
 		unsigned int trn;
 
 		rv = drbd_al_read_tr(mdev,buffer,i);
-		ERR_IF(!rv) goto cancel;
+		ERR_IF(rv == 0) goto cancel;
+		if(rv == -1) {
+			up(&mdev->md_io_mutex);
+			return 0;
+		}
 
 		trn=be32_to_cpu(buffer->tr_number);
 
@@ -460,6 +480,8 @@
 
 	INFO("Found %d transactions (%d active extents) in activity log.\n",
 	     transactions,active_extents);
+
+	return 1;
 }
 
 /**

Modified: trunk/drbd/drbd_bitmap.c
===================================================================
--- trunk/drbd/drbd_bitmap.c	2006-06-26 10:19:41 UTC (rev 2249)
+++ trunk/drbd/drbd_bitmap.c	2006-06-29 14:19:21 UTC (rev 2250)
@@ -5,12 +5,10 @@
 
    This file is part of drbd by Philipp Reisner.
 
-   Copyright (C) 2004, Lars Ellenberg <l.g.e at web.de>.
-	main author.
+   Copyright (C) 2004-2006, Philipp Reisner <philipp.reisner at linbit.com>.
+   Copyright (C) 2004-2006, Lars Ellenberg <lars.ellenberg at linbit.com>.
+   Copyright (C) 2004-2006, LINBIT Information Technologies GmbH.
 
-   Copyright (C) 2004, Philipp Reisner <philipp.reisner at linbit.com>.
-	contributions.
-
    drbd is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2, or (at your option)

Modified: trunk/drbd/drbd_fs.c
===================================================================
--- trunk/drbd/drbd_fs.c	2006-06-26 10:19:41 UTC (rev 2249)
+++ trunk/drbd/drbd_fs.c	2006-06-29 14:19:21 UTC (rev 2250)
@@ -5,12 +5,10 @@
 
    This file is part of drbd by Philipp Reisner.
 
-   Copyright (C) 1999-2004, Philipp Reisner <philipp.reisner at linbit.com>.
-	main author.
+   Copyright (C) 1999-2006, Philipp Reisner <philipp.reisner at linbit.com>.
+   Copyright (C) 2002-2006, Lars Ellenberg <lars.ellenberg at linbit.com>.
+   Copyright (C) 2001-2006, LINBIT Information Technologies GmbH.
 
-   Copyright (C) 2002-2004, Lars Ellenberg <l.g.e at web.de>.
-	main contributor.
-
    Copyright (C) 2000, Fábio Olivé Leite <olive at conectiva.com.br>.
 	Some sanity checks in IOCTL_SET_STATE.
 
@@ -297,6 +295,13 @@
 		INFO("max_segment_size ( = BIO size ) = %u\n",
 		     q->max_segment_size);
 	}
+
+	if( q->backing_dev_info.ra_pages != b->backing_dev_info.ra_pages) {
+		INFO("Adjusting my ra_pages to backing device's (%lu -> %lu)\n",
+		     q->backing_dev_info.ra_pages,
+		     b->backing_dev_info.ra_pages);
+		q->backing_dev_info.ra_pages = b->backing_dev_info.ra_pages;
+	}
 }
 
 STATIC
@@ -445,6 +450,12 @@
 		goto release_bdev3_fail_ioctl;
 	}
 
+	if(drbd_md_test_flag(nbc,MDF_PrimaryInd)) {
+		set_bit(CRASHED_PRIMARY, &mdev->flags);
+	} else {		
+		clear_bit(CRASHED_PRIMARY, &mdev->flags);
+	}
+
 	// Since ware are diskless, fix the AL first...
 	if (drbd_check_al_size(mdev)) {
 		retcode = KMallocFailed;
@@ -458,6 +469,11 @@
 		goto release_bdev3_fail_ioctl;
 	}
 
+	if(!drbd_al_read_log(mdev)) {
+		retcode = MDIOError;
+		goto release_bdev3_fail_ioctl;		
+	}
+
 	// Point of no return reached.
 
 	D_ASSERT(mdev->bc == NULL);
@@ -509,8 +525,7 @@
 		drbd_bm_read(mdev);
 	}
 
-	drbd_al_read_log(mdev);
-	if (drbd_md_test_flag(mdev->bc,MDF_PrimaryInd)) {
+	if(test_bit(CRASHED_PRIMARY, &mdev->flags)) {
 		drbd_al_apply_to_bm(mdev);
 		drbd_al_to_on_disk_bm(mdev);
 	}
@@ -571,6 +586,7 @@
 	return 0;
 
  release_bdev3_fail_ioctl:
+	clear_bit(CRASHED_PRIMARY, &mdev->flags);
 	drbd_force_state(mdev,NS(disk,Diskless));
 	drbd_md_sync(mdev);
  release_bdev2_fail_ioctl:
@@ -946,6 +962,7 @@
 		       mdev->bc->md.uuid[Bitmap] == 0) || forced ) {
 			drbd_uuid_new_current(mdev);
 		}
+		clear_bit(CRASHED_PRIMARY, &mdev->flags);
 	}
 
 	if(mdev->state.disk > Diskless && (newstate & Secondary)) {

Modified: trunk/drbd/drbd_int.h
===================================================================
--- trunk/drbd/drbd_int.h	2006-06-26 10:19:41 UTC (rev 2249)
+++ trunk/drbd/drbd_int.h	2006-06-29 14:19:21 UTC (rev 2250)
@@ -4,12 +4,10 @@
 
   This file is part of drbd by Philipp Reisner.
 
-  Copyright (C) 1999-2004, Philipp Reisner <philipp.reisner at linbit.com>.
-	main author.
+  Copyright (C) 1999-2006, Philipp Reisner <philipp.reisner at linbit.com>.
+  Copyright (C) 2002-2006, Lars Ellenberg <lars.ellenberg at linbit.com>.
+  Copyright (C) 2001-2006, LINBIT Information Technologies GmbH.
 
-  Copyright (C) 2002-2004, Lars Ellenberg <l.g.e at web.de>.
-	main contributor.
-
   drbd is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2, or (at your option)
@@ -230,21 +228,6 @@
 	( typecheck(struct Drbd_Conf*,x) && \
 	  ((x) ? (((x)->magic ^ DRBD_MAGIC) == (long)(x)):0))
 
-
-/*
- * GFP_DRBD is used for allocations inside drbd_make_request,
- * and for the sk->allocation scheme.
- *
- * Try to get away with GFP_NOIO, which is
- * in 2.4.x:	(__GFP_HIGH | __GFP_WAIT) // HIGH == EMERGENCY, not HIGHMEM!
- * in 2.6.x:	             (__GFP_WAIT)
- *
- * As far as i can see we do not allocate from interrupt context...
- * if we do, we certainly should fix that.
- * - lge
- */
-#define GFP_DRBD GFP_NOIO
-
 /* these defines should go into blkdev.h
    (if it will be ever includet into linus' linux) */
 #define RQ_DRBD_NOTHING	  0x0001
@@ -667,7 +650,8 @@
 	USE_DEGR_WFC_T,		// Use degr-wfc-timeout instead of wfc-timeout.
 	CLUSTER_ST_CHANGE,      // Cluster wide state change going on...
 	CL_ST_CHG_SUCCESS,
-	CL_ST_CHG_FAIL
+	CL_ST_CHG_FAIL,
+	CRASHED_PRIMARY         // This node was a crashed primary
 };
 
 struct drbd_bitmap; // opaque for Drbd_Conf
@@ -1169,7 +1153,7 @@
 extern void drbd_rs_complete_io(struct Drbd_Conf *mdev, sector_t sector);
 extern int drbd_rs_begin_io(struct Drbd_Conf *mdev, sector_t sector);
 extern void drbd_rs_cancel_all(drbd_dev* mdev);
-extern void drbd_al_read_log(struct Drbd_Conf *mdev);
+extern int drbd_al_read_log(struct Drbd_Conf *mdev);
 extern void __drbd_set_in_sync(drbd_dev* mdev, sector_t sector, int size, const char* file, const unsigned int line);
 #define drbd_set_in_sync(mdev,sector,size) \
 	__drbd_set_in_sync(mdev,sector,size, __FILE__, __LINE__ )

Modified: trunk/drbd/drbd_main.c
===================================================================
--- trunk/drbd/drbd_main.c	2006-06-26 10:19:41 UTC (rev 2249)
+++ trunk/drbd/drbd_main.c	2006-06-29 14:19:21 UTC (rev 2250)
@@ -5,12 +5,10 @@
 
    This file is part of drbd by Philipp Reisner.
 
-   Copyright (C) 1999-2004, Philipp Reisner <philipp.reisner at linbit.com>.
-	main author.
+   Copyright (C) 1999-2006, Philipp Reisner <philipp.reisner at linbit.com>.
+   Copyright (C) 2002-2006, Lars Ellenberg <lars.ellenberg at linbit.com>.
+   Copyright (C) 2001-2006, LINBIT Information Technologies GmbH.
 
-   Copyright (C) 2002-2004, Lars Ellenberg <l.g.e at web.de>.
-	main contributor.
-
    Copyright (C) 2000, Marcelo Tosatti <marcelo at conectiva.com.br>.
 	Early 2.3.x work.
 
@@ -352,11 +350,14 @@
 	sector_t sector;
 	unsigned int size;
 
-	new_first=kmalloc(sizeof(struct drbd_barrier),GFP_KERNEL);
+	new_first=kmalloc(sizeof(struct drbd_barrier),GFP_NOIO);
 	if(!new_first) {
 		ERR("could not kmalloc() barrier\n");
 	}
 
+	/* FIXME if indeed we could not kmalloc, this will Oops!
+	 * can we somehow just recycle one of the existing barriers?
+	 */
 	INIT_LIST_HEAD(&new_first->requests);
 	new_first->next=0;
 	new_first->br_number=4711;
@@ -927,6 +928,11 @@
 	enum fencing_policy fp;
 	u32 mdf;
 
+	if ( os.role != Primary && ns.role == Primary ||
+	     os.conn != Conneted && ns.conn == Connected ) {
+		clear_bit(CRASHED_PRIMARY, &mdev->flags);
+	}
+
 	fp = DontCare;
 	if(inc_local(mdev)) {
 		fp = mdev->bc->fencing;
@@ -937,7 +943,8 @@
 		mdf = mdev->bc->md.flags & ~(MDF_Consistent|MDF_PrimaryInd|
 					     MDF_ConnectedInd|MDF_WasUpToDate|
 					     MDF_PeerOutDated );
-		if (mdev->state.role == Primary)       mdf |= MDF_PrimaryInd;
+		if (test_bit(CRASHED_PRIMARY,&mdev->flags) ||
+		    mdev->state.role == Primary)       mdf |= MDF_PrimaryInd;
 		if (mdev->state.conn > WFReportParams) mdf |= MDF_ConnectedInd;
 		if (mdev->state.disk > Inconsistent)   mdf |= MDF_Consistent;
 		if (mdev->state.disk > Outdated)       mdf |= MDF_WasUpToDate;
@@ -1083,7 +1090,7 @@
 		D_ASSERT(thi->task == NULL);
 		thi->t_state = Running;
 		spin_unlock(&thi->t_lock);
-
+		flush_signals(current); // otherw. may get -ERESTARTNOINTR
 		pid = kernel_thread(drbd_thread_setup, (void *) thi, CLONE_FS);
 		if (pid < 0) {
 			ERR("Couldn't start thread (%d)\n", pid);

Modified: trunk/drbd/drbd_proc.c
===================================================================
--- trunk/drbd/drbd_proc.c	2006-06-26 10:19:41 UTC (rev 2249)
+++ trunk/drbd/drbd_proc.c	2006-06-29 14:19:21 UTC (rev 2250)
@@ -5,12 +5,10 @@
 
    This file is part of drbd by Philipp Reisner.
 
-   Copyright (C) 1999-2004, Philipp Reisner <philipp.reisner at linbit.com>.
-	main author.
+   Copyright (C) 1999-2006, Philipp Reisner <philipp.reisner at linbit.com>.
+   Copyright (C) 2002-2006, Lars Ellenberg <lars.ellenberg at linbit.com>.
+   Copyright (C) 2001-2006, LINBIT Information Technologies GmbH.
 
-   Copyright (C) 2002-2004, Lars Ellenberg <l.g.e at web.de>.
-	main contributor.
-
    drbd is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2, or (at your option)

Modified: trunk/drbd/drbd_receiver.c
===================================================================
--- trunk/drbd/drbd_receiver.c	2006-06-26 10:19:41 UTC (rev 2249)
+++ trunk/drbd/drbd_receiver.c	2006-06-29 14:19:21 UTC (rev 2250)
@@ -5,12 +5,10 @@
 
    This file is part of drbd by Philipp Reisner.
 
-   Copyright (C) 1999-2004, Philipp Reisner <philipp.reisner at linbit.com>.
-	main author.
+   Copyright (C) 1999-2006, Philipp Reisner <philipp.reisner at linbit.com>.
+   Copyright (C) 2002-2006, Lars Ellenberg <lars.ellenberg at linbit.com>.
+   Copyright (C) 2001-2006, LINBIT Information Technologies GmbH.
 
-   Copyright (C) 2002-2004, Lars Ellenberg <l.g.e at web.de>.
-	main contributor.
-
    drbd is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2, or (at your option)
@@ -317,6 +315,7 @@
 	return count;
 }
 
+
 STATIC void reclaim_net_ee(drbd_dev *mdev)
 {
 	struct Tl_epoch_entry *e;
@@ -647,6 +646,11 @@
 	if(drbd_request_state(mdev,NS(conn,WFConnection)) < SS_Success ) return 0;
 
 	clear_bit(UNIQUE, &mdev->flags);
+
+	/* Break out of unknown connect loops by random wait here. */
+	set_current_state(TASK_INTERRUPTIBLE);
+	schedule_timeout(net_random()%((mdev->net_conf->try_connect_int*HZ)/4));
+
 	while(1) {
 		sock=drbd_try_connect(mdev);
 		if(sock) {
@@ -686,10 +690,8 @@
 	msock->sk->sk_reuse=1; /* SO_REUSEADDR */
 	sock->sk->sk_reuse=1; /* SO_REUSEADDR */
 
-	/* to prevent oom deadlock... */
-	/* The default allocation priority was GFP_KERNEL */
-	sock->sk->sk_allocation = GFP_DRBD;
-	msock->sk->sk_allocation = GFP_DRBD;
+	sock->sk->sk_allocation = GFP_NOIO;
+	msock->sk->sk_allocation = GFP_NOIO;
 
 	sock->sk->sk_priority=TC_PRIO_BULK;
 	tcp_sk(sock->sk)->nonagle = 0;
@@ -865,11 +867,8 @@
 	/* kick lower level device, if we have more than (arbitrary number)
 	 * reference counts on it, which typically are locally submitted io
 	 * requests.  don't use unacked_cnt, so we speed up proto A and B, too.
-	 *
-	 * XXX maybe: make that arbitrary number configurable.
-	 * for now, I choose 1/16 of max-epoch-size.
 	 */
-	if (atomic_read(&mdev->local_cnt) >= (mdev->net_conf->max_epoch_size>>4) ) {
+	if (atomic_read(&mdev->local_cnt) >= mdev->net_conf->unplug_watermark ) {
 		drbd_kick_lo(mdev);
 	}
 	mdev->writ_cnt+=data_size>>9;
@@ -2141,6 +2140,7 @@
 		D_ASSERT(h->command == ReportBitMap);
 	}
 
+	clear_bit(CRASHED_PRIMARY, &mdev->flags); // md_write() is in drbd_start_resync.
 	if (mdev->state.conn == WFBitMapS) {
 		drbd_start_resync(mdev,SyncSource);
 	} else if (mdev->state.conn == WFBitMapT) {
@@ -2576,10 +2576,10 @@
 	int rv;
 
 	rv = drbd_send_handshake(mdev);
-	if (!rv) return 0;
+	if (!rv) goto break_c_loop;
 
 	rv = drbd_recv_header(mdev,&p->head);
-	if (!rv) return 0;
+	if (!rv) goto break_c_loop;
 
 	if (p->head.command != HandShake) {
 		ERR( "expected HandShake packet, received: %s (0x%04x)\n",
@@ -2626,6 +2626,23 @@
 	}
 
 	return 1;
+
+ break_c_loop:
+	WARN( "My msock connect got accepted onto peer's sock!\n");
+	/* In case a tcp connection set-up takes longer than 
+	   connect-int, we might get into the situation that this
+	   node's msock gets connected to the peer's sock!
+	   
+	   To break out of this endless loop behaviour, we need to 
+	   wait unti the peer's msock connect tries are over. (1 Second)
+
+	   Additionally we wait connect-int/2 to hit with our next 
+	   connect try exactly in the peer's window of expectation. */
+
+	set_current_state(TASK_INTERRUPTIBLE);
+	schedule_timeout(HZ + (mdev->net_conf->try_connect_int*HZ)/2);
+	
+	return 0;
 }
 
 #ifndef CONFIG_CRYPTO_HMAC

Modified: trunk/drbd/drbd_req.c
===================================================================
--- trunk/drbd/drbd_req.c	2006-06-26 10:19:41 UTC (rev 2249)
+++ trunk/drbd/drbd_req.c	2006-06-29 14:19:21 UTC (rev 2250)
@@ -5,12 +5,10 @@
 
    This file is part of drbd by Philipp Reisner.
 
-   Copyright (C) 1999-2004, Philipp Reisner <philipp.reisner at linbit.com>.
-	main author.
+   Copyright (C) 1999-2006, Philipp Reisner <philipp.reisner at linbit.com>.
+   Copyright (C) 2002-2006, Lars Ellenberg <lars.ellenberg at linbit.com>.
+   Copyright (C) 2001-2006, LINBIT Information Technologies GmbH.
 
-   Copyright (C) 2002-2004, Lars Ellenberg <l.g.e at web.de>.
-	main contributor.
-
    drbd is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2, or (at your option)
@@ -197,7 +195,7 @@
 static inline drbd_request_t* drbd_req_new(drbd_dev *mdev, struct bio *bio_src)
 {
 	struct bio *bio;
-	drbd_request_t *req = mempool_alloc(drbd_request_mempool, GFP_DRBD);
+	drbd_request_t *req = mempool_alloc(drbd_request_mempool, GFP_NOIO);
 	if (req) {
 		SET_MAGIC(req);
 
@@ -224,7 +222,6 @@
 {
 	drbd_request_t *req;
 	int local, remote;
-	int target_area_out_of_sync = FALSE; // only relevant for reads
 
 	/* allocate outside of all locks
 	 */
@@ -348,8 +345,6 @@
 					drbd_end_req(req, RQ_DRBD_SENT, 1, sector);
 				}
 			}
-		} else if (target_area_out_of_sync) {
-			drbd_read_remote(mdev,req);
 		} else {
 			// this node is diskless ...
 			drbd_read_remote(mdev,req);

Modified: trunk/drbd/drbd_worker.c
===================================================================
--- trunk/drbd/drbd_worker.c	2006-06-26 10:19:41 UTC (rev 2249)
+++ trunk/drbd/drbd_worker.c	2006-06-29 14:19:21 UTC (rev 2250)
@@ -5,9 +5,9 @@
 
    This file is part of drbd by Philipp Reisner.
 
-   Copyright (C) 2003-2004, Philipp Reisner <philipp.reisner at linbit.com>.
-   Copyright (C) 2003-2004, Lars Ellenberg <l.g.e at web.de>.
-	authors.
+   Copyright (C) 1999-2006, Philipp Reisner <philipp.reisner at linbit.com>.
+   Copyright (C) 2002-2006, Lars Ellenberg <lars.ellenberg at linbit.com>.
+   Copyright (C) 2001-2006, LINBIT Information Technologies GmbH.
 
    drbd is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by

Modified: trunk/drbd/linux/drbd.h
===================================================================
--- trunk/drbd/linux/drbd.h	2006-06-26 10:19:41 UTC (rev 2249)
+++ trunk/drbd/linux/drbd.h	2006-06-29 14:19:21 UTC (rev 2250)
@@ -116,6 +116,7 @@
 	IN int      ping_int;         /* seconds */
 	IN int      max_epoch_size;
 	IN int      max_buffers;
+	IN int      unplug_watermark;
 	IN int      sndbuf_size;  /* socket send buffer size */
 	IN int      two_primaries;
 	IN unsigned int ko_count;

Modified: trunk/drbd/lru_cache.c
===================================================================
--- trunk/drbd/lru_cache.c	2006-06-26 10:19:41 UTC (rev 2249)
+++ trunk/drbd/lru_cache.c	2006-06-29 14:19:21 UTC (rev 2250)
@@ -5,9 +5,9 @@
 
    This file is part of drbd by Philipp Reisner.
 
-   Copyright (C) 2003-2004, Philipp Reisner <philipp.reisner at linbit.com>.
-   Copyright (C) 2003-2004, Lars Ellenberg <l.g.e at web.de>.
-        authors.
+   Copyright (C) 2003-2006, Philipp Reisner <philipp.reisner at linbit.com>.
+   Copyright (C) 2003-2006, Lars Ellenberg <lars.ellenberg at linbit.com>.
+   Copyright (C) 2003-2006, LINBIT Information Technologies GmbH.
 
    drbd is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -153,7 +153,7 @@
 	PARANOIA_ENTRY();
 	BUG_ON(e->refcnt);
 	list_del(&e->list);
-	hlist_del(&e->colision);
+	hlist_del_init(&e->colision);
 	e->lc_number = LC_FREE;
 	e->refcnt = 0;
 	list_add(&e->list,&lc->free);

Modified: trunk/drbd/lru_cache.h
===================================================================
--- trunk/drbd/lru_cache.h	2006-06-26 10:19:41 UTC (rev 2249)
+++ trunk/drbd/lru_cache.h	2006-06-29 14:19:21 UTC (rev 2250)
@@ -5,8 +5,9 @@
 
    This file is part of drbd by Philipp Reisner.
 
-   Copyright (C) 2003-2004, Philipp Reisner <philipp.reisner at linbit.com>.
-        main author.
+   Copyright (C) 2003-2006, Philipp Reisner <philipp.reisner at linbit.com>.
+   Copyright (C) 2003-2006, Lars Ellenberg <lars.ellenberg at linbit.com>.
+   Copyright (C) 2003-2006, LINBIT Information Technologies GmbH.
 
    drbd is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by

Modified: trunk/scripts/drbd.conf
===================================================================
--- trunk/scripts/drbd.conf	2006-06-26 10:19:41 UTC (rev 2249)
+++ trunk/scripts/drbd.conf	2006-06-29 14:19:21 UTC (rev 2250)
@@ -223,6 +223,18 @@
     #
     # max-buffers     2048;
 
+    # When the number of outstanding requests on a standby (secondary)
+    # node exceeds bdev-threshold, we start to kick the backing device
+    # to start its request processing. This is an advanced tuning
+    # parameter to get more performance out of capable storage controlers.
+    # Some controlers like to be kicked often, other controlers 
+    # deliver better performance when they are kicked less frequently.
+    # Set it to the value of max-buffers to get the least possible
+    # number of run_task_queue_disk() / q->unplug_fn(q) calls.
+    #
+    # unplug-watermark   128;
+
+
     # The highest number of data blocks between two write barriers. 
     # If you set this < 10 you might decrease your performance.
     # max-epoch-size  2048;

Modified: trunk/scripts/patch-kernel
===================================================================
--- trunk/scripts/patch-kernel	2006-06-26 10:19:41 UTC (rev 2249)
+++ trunk/scripts/patch-kernel	2006-06-29 14:19:21 UTC (rev 2250)
@@ -6,6 +6,9 @@
 #
 # Copyright (C) 2003 Kees Cook, OSDL
 # kees at osdl.org, http://developer.osdl.org/kees/
+#
+# Copyright (C) 2003-2006 LINBIT Information Technologies GmbH
+# http://www.linbit.com
 # 
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License

Modified: trunk/user/drbd_limits.h
===================================================================
--- trunk/user/drbd_limits.h	2006-06-26 10:19:41 UTC (rev 2249)
+++ trunk/user/drbd_limits.h	2006-06-29 14:19:21 UTC (rev 2250)
@@ -52,6 +52,9 @@
   /* @4k PageSize -> 128kB - 512MB */
   RANGE(MAX_BUFFERS, 32, 131072);
 
+  /* @4k PageSize -> 64kB - 512MB */
+  RANGE(UNPLUG_WATERMARK, 16, 131072);
+
   /* 0 is disabled.
    * 200 should be more than enough even for very short timeouts */
   RANGE(KO_COUNT,0, 200);

Modified: trunk/user/drbdadm_adjust.c
===================================================================
--- trunk/user/drbdadm_adjust.c	2006-06-26 10:19:41 UTC (rev 2249)
+++ trunk/user/drbdadm_adjust.c	2006-06-29 14:19:21 UTC (rev 2250)
@@ -3,7 +3,7 @@
 
    This file is part of drbd by Philipp Reisner.
 
-   Copyright (C) 2003-2004, Philipp Reisner <philipp.reisner at linbit.com>.
+   Copyright (C) 2003-2006, Philipp Reisner <philipp.reisner at linbit.com>.
         Initial author.
 
    drbd is free software; you can redistribute it and/or modify

Modified: trunk/user/drbdadm_main.c
===================================================================
--- trunk/user/drbdadm_main.c	2006-06-26 10:19:41 UTC (rev 2249)
+++ trunk/user/drbdadm_main.c	2006-06-29 14:19:21 UTC (rev 2250)
@@ -3,12 +3,10 @@
 
    This file is part of drbd by Philipp Reisner.
 
-   Copyright (C) 2002-2004, Philipp Reisner <philipp.reisner at linbit.com>.
-        Initial author.
+   Copyright (C) 2002-2006, Philipp Reisner <philipp.reisner at linbit.com>.
+   Copyright (C) 2002-2006, Lars Ellenberg <lars.ellenberg at linbit.com>.
+   Copyright (C) 2002-2006, LINBIT Information Technologies GmbH.
 
-   Copyright (C) 2003-2004, Lars Ellenberg <l.g.e at web.de>
-        contributions.
-
    drbd is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2, or (at your option)

Modified: trunk/user/drbdadm_scanner.fl
===================================================================
--- trunk/user/drbdadm_scanner.fl	2006-06-26 10:19:41 UTC (rev 2249)
+++ trunk/user/drbdadm_scanner.fl	2006-06-29 14:19:21 UTC (rev 2250)
@@ -84,6 +84,7 @@
 shared-secret		{ DP; CP; return TK_NET_OPTION;		}
 max-epoch-size		{ DP; CP; RC(MAX_EPOCH_SIZE); return TK_NET_OPTION;}
 after-sb-[012]pri	{ DP; CP; return TK_NET_OPTION;		}
+unplug-watermark	{ DP; CP; return TK_NET_OPTION;         }
 allow-two-primaries	{ DP; CP; return TK_NET_SWITCH;		}
 rate			{ DP; CP; RC(RATE); return TK_SYNCER_OPTION;	}
 after			{ DP; CP; return TK_SYNCER_OPTION;	}

Modified: trunk/user/drbdsetup.c
===================================================================
--- trunk/user/drbdsetup.c	2006-06-26 10:19:41 UTC (rev 2249)
+++ trunk/user/drbdsetup.c	2006-06-29 14:19:21 UTC (rev 2250)
@@ -3,15 +3,13 @@
 
    This file is part of drbd by Philipp Reisner.
 
-   Copyright (C) 1999-2004, Philipp Reisner <philipp.reisner at linbit.com>.
-        Initial author.
+   Copyright (C) 1999-2006, Philipp Reisner <philipp.reisner at linbit.com>.
+   Copyright (C) 2002-2006, Lars Ellenberg <lars.ellenberg at linbit.com>.
+   Copyright (C) 2001-2006, LINBIT Information Technologies GmbH.
 
    Copyright (C) 2000, Fábio Olivé Leite <olive at conectiva.com.br>.
         Added sanity checks before using the device.
 
-   Copyright (C) 2002-2004, Lars Ellenberg <l.g.e at web.de>
-	main contributor.
-
    drbd is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2, or (at your option)
@@ -74,6 +72,7 @@
 #define DEF_AFTER_SB_0P       Disconnect
 #define DEF_AFTER_SB_1P       Disconnect
 #define DEF_AFTER_SB_2P       Disconnect
+#define DEF_UNPLUG_WATERMARK       (DEF_MAX_BUFFERS/16)
 
 #if 0
 # define ioctl(X...) (fprintf(stderr,"ioctl(%s)\n",#X),0);
@@ -166,6 +165,7 @@
      { "timeout",    required_argument, 0, 't' },
      { "max-epoch-size", required_argument, 0, 'e' },
      { "max-buffers",required_argument, 0, 'b' },
+     { "unplug-watermark",required_argument, 0, 'l' },
      { "connect-int",required_argument, 0, 'c' },
      { "ping-int",   required_argument, 0, 'i' },
      { "sndbuf-size",required_argument, 0, 'S' },
@@ -531,6 +531,7 @@
   cn->config.after_sb_2p = DEF_AFTER_SB_2P;
   cn->config.want_lose = 0;
   cn->config.ko_count = DEF_KO_COUNT;
+  cn->config.unplug_watermark = DEF_UNPLUG_WATERMARK;
 
   if(argc==0) return 0;
 
@@ -556,6 +557,10 @@
 	  cn->config.max_buffers = m_strtoll_range(optarg,1, "max-buffers",
 			  DRBD_MAX_BUFFERS_MIN, DRBD_MAX_BUFFERS_MAX);
 	  break;
+	case 'l':
+	  cn->config.unplug_watermark = m_strtoll_range(optarg,1, "unplug-watermark",
+			  DRBD_UNPLUG_WATERMARK_MIN, DRBD_UNPLUG_WATERMARK_MAX);
+	  break;
 	case 'c':
 	  cn->config.try_connect_int = m_strtoll_range(optarg,1, "connect-int",
 			  DRBD_CONNECT_INT_MIN, DRBD_CONNECT_INT_MAX);
@@ -1373,6 +1378,7 @@
       SHOW_I("ping-int","seconds", cn.nconf.ping_int, DEF_NET_PING_I);
       SHOW_I("max-epoch-size","write requests", cn.nconf.max_epoch_size, DEF_MAX_EPOCH_SIZE);
       SHOW_I("max-buffers","pages", cn.nconf.max_buffers, DEF_MAX_BUFFERS);
+      SHOW_I("unplug-watermark","write requests", cn.nconf.unplug_watermark, DEF_UNPLUG_WATERMARK);
       SHOW_I("sndbuf-size","byte", cn.nconf.sndbuf_size, DEF_SNDBUF_SIZE);
       SHOW_I("ko-count","1", cn.nconf.ko_count, DEF_KO_COUNT);
       // SHOW_H("on-disconnect",cn.nconf.on_disconnect,DEF_ON_DISCONNECT,dh_names);



More information about the drbd-cvs mailing list