From drbd-cvs at lists.linbit.com  Mon Aug  1 10:03:54 2005
From: drbd-cvs at lists.linbit.com (drbd-cvs@lists.linbit.com)
Date: Mon Aug  1 10:03:55 2005
Subject: [DRBD-cvs] r1912 - branches/drbd-0.7/drbd
Message-ID: <20050801080354.5FFFE143B2@mail.linbit.com>

Author: lars
Date: 2005-08-01 10:03:53 +0200 (Mon, 01 Aug 2005)
New Revision: 1912

Modified:
   branches/drbd-0.7/drbd/drbd_compat_wrappers.h
   branches/drbd-0.7/drbd/drbd_receiver.c
Log:
the "unplug remote" code for the 2.4 kernel could "forget" to clear the flag bit
and thus disable itself under certain conditions.  should be fixed now.


Modified: branches/drbd-0.7/drbd/drbd_compat_wrappers.h
===================================================================
--- branches/drbd-0.7/drbd/drbd_compat_wrappers.h	2005-07-30 21:14:53 UTC (rev 1911)
+++ branches/drbd-0.7/drbd/drbd_compat_wrappers.h	2005-08-01 08:03:53 UTC (rev 1912)
@@ -292,7 +292,9 @@
 	if (mdev->cstate < Connected)
 		return;
 	if (!test_and_set_bit(UNPLUG_QUEUED,&mdev->flags)) {
-		queue_task(&mdev->write_hint_tq, &tq_disk); // IO HINT
+		/* if it could not be queued, clear our flag again, too */
+		if (!queue_task(&mdev->write_hint_tq, &tq_disk))
+			clear_bit(UNPLUG_QUEUED,&mdev->flags);
 	}
 }
 

Modified: branches/drbd-0.7/drbd/drbd_receiver.c
===================================================================
--- branches/drbd-0.7/drbd/drbd_receiver.c	2005-07-30 21:14:53 UTC (rev 1911)
+++ branches/drbd-0.7/drbd/drbd_receiver.c	2005-08-01 08:03:53 UTC (rev 1912)
@@ -1914,6 +1914,9 @@
 	}
 	clear_bit(DO_NOT_INC_CONCNT,&mdev->flags);
 
+	/* it may still be set, because some unplug was on the fly */
+	NOT_IN_26(mdev->flags &= ~(1<<UNPLUG_QUEUED);)
+
 	INFO("Connection lost.\n");
 }
 

From drbd-cvs at lists.linbit.com  Fri Aug  5 15:21:31 2005
From: drbd-cvs at lists.linbit.com (drbd-cvs@lists.linbit.com)
Date: Fri Aug  5 15:21:32 2005
Subject: [DRBD-cvs] r1913 - in branches/drbd-0.7: . drbd
Message-ID: <20050805132131.9D222143B2@mail.linbit.com>

Author: lars
Date: 2005-08-05 15:21:30 +0200 (Fri, 05 Aug 2005)
New Revision: 1913

Modified:
   branches/drbd-0.7/Makefile
   branches/drbd-0.7/drbd/Makefile
   branches/drbd-0.7/drbd/drbd_fs.c
   branches/drbd-0.7/drbd/drbd_main.c
Log:
only allow invalidate during stable sates (Standalone or Connected)

if we say we always onle change thi->task within the spinlock, we should do so.
(this was uncritical, though).

include the "last changed" revision in the buildtag,
not the "last updated" or repository revision.


Modified: branches/drbd-0.7/Makefile
===================================================================
--- branches/drbd-0.7/Makefile	2005-08-01 08:03:53 UTC (rev 1912)
+++ branches/drbd-0.7/Makefile	2005-08-05 13:21:30 UTC (rev 1913)
@@ -149,6 +149,7 @@
 	fi
 
 prepare_release:
+	svn up
 	$(MAKE) tarball
 	$(MAKE) tarball PRESERVE_DEBIAN=1
 

Modified: branches/drbd-0.7/drbd/Makefile
===================================================================
--- branches/drbd-0.7/drbd/Makefile	2005-08-01 08:03:53 UTC (rev 1912)
+++ branches/drbd-0.7/drbd/Makefile	2005-08-05 13:21:30 UTC (rev 1913)
@@ -96,7 +96,8 @@
 	  fi;									\
 	  grep return $@ ;							\
 	else									\
-	  echo -ne "\treturn \"SVN Revision: "; svnversion -n ..; echo \";	\
+	  SVNREV=$$(svnversion -n -c ..);					\
+	  echo -e "\treturn \"SVN Revision: $${SVNREV##*:}\"";	 		\
 	fi ;									\
 	echo -e "\t\t\" build by $$USER@$$HOSTNAME, `date "+%F %T"`\";\n}";	\
        	mv $@{.new,}

Modified: branches/drbd-0.7/drbd/drbd_fs.c
===================================================================
--- branches/drbd-0.7/drbd/drbd_fs.c	2005-08-01 08:03:53 UTC (rev 1912)
+++ branches/drbd-0.7/drbd/drbd_fs.c	2005-08-05 13:21:30 UTC (rev 1913)
@@ -1268,9 +1268,9 @@
 		/* 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 ||
+		if( (mdev->state == Primary ||
+		      (mdev->cstate != Connected &&
+		       mdev->cstate != StandAlone)) ||
 		    test_bit(DISKLESS,&mdev->flags) ||
 		    test_bit(PARTNER_DISKLESS,&mdev->flags) ) {
 			err = -EINPROGRESS;

Modified: branches/drbd-0.7/drbd/drbd_main.c
===================================================================
--- branches/drbd-0.7/drbd/drbd_main.c	2005-08-01 08:03:53 UTC (rev 1912)
+++ branches/drbd-0.7/drbd/drbd_main.c	2005-08-05 13:21:30 UTC (rev 1913)
@@ -484,8 +484,10 @@
 	drbd_daemonize();
 	D_ASSERT(get_t_state(thi) == Running);
 	D_ASSERT(thi->task == NULL);
+	spin_lock(&thi->t_lock);
 	thi->task = current;
 	smp_mb();
+	spin_unlock(&thi->t_lock);
 	complete(&thi->startstop); // notify: thi->task is set.
 
 	retval = thi->function(thi);

From drbd-cvs at lists.linbit.com  Wed Aug 10 14:46:44 2005
From: drbd-cvs at lists.linbit.com (drbd-cvs@lists.linbit.com)
Date: Wed Aug 10 14:46:45 2005
Subject: [DRBD-cvs] r1914 - branches/drbd-0.7/drbd
Message-ID: <20050810124644.D43C41435D@mail.linbit.com>

Author: lars
Date: 2005-08-10 14:46:43 +0200 (Wed, 10 Aug 2005)
New Revision: 1914

Modified:
   branches/drbd-0.7/drbd/drbd_bitmap.c
   branches/drbd-0.7/drbd/drbd_fs.c
   branches/drbd-0.7/drbd/drbd_main.c
   branches/drbd-0.7/drbd/drbd_receiver.c
Log:
* (try to) handle bitmap allocation failure more gracefully
* reduce a race between ioctl initiated invalidate
  and receiver thread initiated become-sync-source


Modified: branches/drbd-0.7/drbd/drbd_bitmap.c
===================================================================
--- branches/drbd-0.7/drbd/drbd_bitmap.c	2005-08-05 13:21:30 UTC (rev 1913)
+++ branches/drbd-0.7/drbd/drbd_bitmap.c	2005-08-10 12:46:43 UTC (rev 1914)
@@ -361,7 +361,7 @@
 	unsigned long bits, bytes, words, *nbm, *obm = 0;
 	int err = 0, growing;
 
-	D_BUG_ON(!b);
+	ERR_IF(!b) return -ENOMEM;
 	MUST_BE_LOCKED();
 
 	ERR_IF (down_trylock(&b->bm_change)) {
@@ -462,7 +462,7 @@
 	unsigned long s;
 	unsigned long flags;
 
-	D_BUG_ON(!(b && b->bm));
+	ERR_IF(!b) return 0;
 	// MUST_BE_LOCKED(); well. yes. but ...
 
 	spin_lock_irqsave(&b->bm_lock,flags);
@@ -475,7 +475,7 @@
 size_t drbd_bm_words(drbd_dev *mdev)
 {
 	struct drbd_bitmap *b = mdev->bitmap;
-	D_BUG_ON(!(b && b->bm));
+	ERR_IF(!b) return 0;
 
 	/* FIXME
 	 * actually yes. really. otherwise it could just change its size ...
@@ -497,7 +497,8 @@
 	unsigned long word, bits;
 	size_t n = number;
 
-	D_BUG_ON(!(b && b->bm));
+	ERR_IF(!b) return;
+	ERR_IF(!b->bm) return;
 	D_BUG_ON(offset        >= b->bm_words);
 	D_BUG_ON(offset+number >  b->bm_words);
 	D_BUG_ON(number > PAGE_SIZE/sizeof(long));
@@ -536,7 +537,8 @@
 	unsigned long word, bits;
 	size_t n = number;
 
-	D_BUG_ON(!(b && b->bm));
+	ERR_IF(!b) return;
+	ERR_IF(!b->bm) return;
 	D_BUG_ON(offset        >= b->bm_words);
 	D_BUG_ON(offset+number >  b->bm_words);
 	D_BUG_ON(number > PAGE_SIZE/sizeof(long));
@@ -573,7 +575,8 @@
 	struct drbd_bitmap *b = mdev->bitmap;
 	unsigned long *bm;
 
-	D_BUG_ON(!(b && b->bm));
+	ERR_IF(!b) return;
+	ERR_IF(!b->bm) return;
 	if ( (offset        >= b->bm_words) ||
 	     (offset+number >  b->bm_words) ||
 	     (number > PAGE_SIZE/sizeof(long)) ||
@@ -599,7 +602,8 @@
 void drbd_bm_set_all(drbd_dev *mdev)
 {
 	struct drbd_bitmap *b = mdev->bitmap;
-	D_BUG_ON(!(b && b->bm));
+	ERR_IF(!b) return;
+	ERR_IF(!b->bm) return;
 
 	MUST_BE_LOCKED();
 
@@ -743,7 +747,8 @@
 void drbd_bm_clear_all(drbd_dev *mdev)
 {
 	struct drbd_bitmap *b = mdev->bitmap;
-	D_BUG_ON(!(b && b->bm));
+	ERR_IF(!b) return;
+	ERR_IF(!b->bm) return;
 
 	MUST_BE_LOCKED();						\
 
@@ -757,7 +762,7 @@
 void drbd_bm_reset_find(drbd_dev *mdev)
 {
 	struct drbd_bitmap *b = mdev->bitmap;
-	D_BUG_ON(!(b && b->bm));
+	ERR_IF(!b) return;
 
 	MUST_BE_LOCKED();
 
@@ -777,7 +782,8 @@
 {
 	struct drbd_bitmap *b = mdev->bitmap;
 	unsigned long i = -1UL;
-	D_BUG_ON(!(b && b->bm));
+	ERR_IF(!b) return i;
+	ERR_IF(!b->bm) return i;
 
 	spin_lock_irq(&b->bm_lock);
 	BM_PARANOIA_CHECK();
@@ -810,7 +816,8 @@
 {
 	struct drbd_bitmap *b = mdev->bitmap;
 	int i;
-	D_BUG_ON(!(b && b->bm));
+	ERR_IF(!b) return 1;
+	ERR_IF(!b->bm) return 1;
 
 /*
  * only called from drbd_set_out_of_sync.
@@ -844,7 +851,8 @@
 {
 	struct drbd_bitmap *b = mdev->bitmap;
 	int i;
-	D_BUG_ON(!(b && b->bm));
+	ERR_IF(!b) return 0;
+	ERR_IF(!b->bm) return 0;
 
 	spin_lock_irq(&b->bm_lock);
 	BM_PARANOIA_CHECK();
@@ -877,7 +885,8 @@
 {
 	struct drbd_bitmap *b = mdev->bitmap;
 	int i;
-	D_BUG_ON(!(b && b->bm));
+	ERR_IF(!b) return 0;
+	ERR_IF(!b->bm) return 0;
 
 	spin_lock_irq(&b->bm_lock);
 	BM_PARANOIA_CHECK();
@@ -911,7 +920,8 @@
 	int count, s, e;
 	unsigned long flags;
 
-	D_BUG_ON(!(b && b->bm));
+	ERR_IF(!b) return 0;
+	ERR_IF(!b->bm) return 0;
 	spin_lock_irqsave(&b->bm_lock,flags);
 	BM_PARANOIA_CHECK();
 
@@ -938,7 +948,8 @@
 	struct drbd_bitmap *b = mdev->bitmap;
 	unsigned long weight;
 	int count, s, e;
-	D_BUG_ON(!(b && b->bm));
+	ERR_IF(!b) return 0;
+	ERR_IF(!b->bm) return 0;
 
 	MUST_BE_LOCKED();
 

Modified: branches/drbd-0.7/drbd/drbd_fs.c
===================================================================
--- branches/drbd-0.7/drbd/drbd_fs.c	2005-08-05 13:21:30 UTC (rev 1913)
+++ branches/drbd-0.7/drbd/drbd_fs.c	2005-08-10 12:46:43 UTC (rev 1914)
@@ -81,6 +81,7 @@
 	la_size = mdev->la_size;
 
 	rv = do_determin_dev_size(mdev);
+	if (rv < 0) goto out;
 
 	la_size_changed = (la_size != mdev->la_size);
 	md_moved = pmdss != drbd_md_ss(mdev) /* && mdev->md_index == -1 */;
@@ -96,6 +97,7 @@
 		// Write mdev->la_size to [possibly new position on] disk.
 		drbd_md_write(mdev);
 	}
+  out:
 	lc_unlock(mdev->act_log);
 
 	return rv;
@@ -116,7 +118,9 @@
 }
 
 
-/* Returns 1 if there is a disk-less node, 0 if both nodes have a disk. */
+/* Returns 1 if there is a disk-less node, 0 if both nodes have a disk.
+ * -ENOMEM if we could not allocate the bitmap
+ */
 /*
  * THINK do we want the size to be KB or sectors ?
  * note, *_capacity operates in 512 byte sectors!!
@@ -182,7 +186,7 @@
 			/* currently there is only one error: ENOMEM! */
 			size = drbd_bm_capacity(mdev)>>1;
 			if (size == 0) {
-				ERR("Could not allocate bitmap! Set device size => 0\n");
+				ERR("OUT OF MEMORY! Could not allocate bitmap! Set device size => 0\n");
 			} else {
 				/* FIXME this is problematic,
 				 * if we in fact are smaller now! */
@@ -190,6 +194,7 @@
 				    "Leaving size unchanged at size = %lu KB\n", 
 				    (unsigned long)size);
 			}
+			rv = err;
 		}
 		// racy, see comments above.
 		drbd_set_my_capacity(mdev,size<<1);
@@ -252,6 +257,8 @@
 	return 0;
 }
 
+STATIC int drbd_detach_ioctl(drbd_dev *mdev);
+
 STATIC
 int drbd_ioctl_set_disk(struct Drbd_Conf *mdev,
 			struct ioctl_disk_config * arg)
@@ -305,6 +312,9 @@
 		__module_get(THIS_MODULE);
 		mput = 1;
 	} else {
+		/* We currently cannot handle reattach while connected */
+		return -EBUSY;
+
 		/* FIXME allow reattach while connected,
 		 * and allow it in Primary/Diskless state...
 		 * currently there are strange races leading to a distributed
@@ -475,12 +485,23 @@
 /* FIXME if (md_gc_valid < 0) META DATA IO NOT POSSIBLE! */
 
 	drbd_bm_lock(mdev); // racy...
-	drbd_determin_dev_size(mdev);
-	/* FIXME
-	 * what if we now have la_size == 0 ?? eh?
-	 * BOOM?
-	 */
+	if (drbd_determin_dev_size(mdev) < 0) {
+		/* could not allocate bitmap.
+		 * try to undo ... */
+		D_ASSERT(mdev->cstate == Unconfigured);
+		D_ASSERT(mput == 1);
 
+		drbd_bm_unlock(mdev);
+
+		/* from drbd_detach_ioctl */
+		drbd_free_ll_dev(mdev);
+
+		set_cstate(mdev,Unconfigured);
+		drbd_mdev_cleanup(mdev);
+		module_put(THIS_MODULE);
+		return -ENOMEM;
+	}
+
 	if (md_gc_valid <= 0) {
 		INFO("Assuming that all blocks are out of sync (aka FullSync)\n");
 		drbd_bm_set_all(mdev);
@@ -494,7 +515,6 @@
 
 	i = drbd_check_al_size(mdev);
 	if (i) {
-// FATAL!
 		/* FIXME see the comment above.
 		 * if this fails I need to undo all changes,
 		 * go back into Unconfigured,
@@ -502,7 +522,6 @@
 		 */
 		// return i;
 		drbd_panic("Cannot allocate act_log\n");
-		drbd_suicide();
 	}
 
 	if (md_gc_valid > 0) {
@@ -1277,6 +1296,10 @@
 			break;
 		}
 
+		drbd_md_set_flag(mdev,MDF_FullSync);
+		drbd_md_clear_flag(mdev,MDF_Consistent);
+		drbd_md_write(mdev);
+
 		if (mdev->cstate == Connected) {
 			/* avoid races with set_in_sync
 			 * for successfull mirrored writes
@@ -1288,10 +1311,6 @@
 
 		drbd_bm_lock(mdev); // racy...
 
-		drbd_md_set_flag(mdev,MDF_FullSync);
-		drbd_md_clear_flag(mdev,MDF_Consistent);
-		drbd_md_write(mdev);
-
 		drbd_bm_set_all(mdev);
 		drbd_bm_write(mdev);
 

Modified: branches/drbd-0.7/drbd/drbd_main.c
===================================================================
--- branches/drbd-0.7/drbd/drbd_main.c	2005-08-05 13:21:30 UTC (rev 1913)
+++ branches/drbd-0.7/drbd/drbd_main.c	2005-08-10 12:46:43 UTC (rev 1914)
@@ -1472,6 +1472,7 @@
 	mdev->rs_mark_time = 0;
 	mdev->send_task    = NULL;
 	drbd_set_my_capacity(mdev,0);
+	drbd_bm_resize(mdev,0);
 
 	// just in case
 	drbd_free_resources(mdev);

Modified: branches/drbd-0.7/drbd/drbd_receiver.c
===================================================================
--- branches/drbd-0.7/drbd/drbd_receiver.c	2005-08-05 13:21:30 UTC (rev 1913)
+++ branches/drbd-0.7/drbd/drbd_receiver.c	2005-08-10 12:46:43 UTC (rev 1914)
@@ -1690,31 +1690,36 @@
 STATIC int receive_BecomeSyncTarget(drbd_dev *mdev, Drbd_Header *h)
 {
 	ERR_IF(!mdev->bitmap) return FALSE;
-
-	/* THINK
-	 * otherwise this does not make much sense, no?
-	 * and some other assertion maybe about cstate...
-	 */
-	ERR_IF(mdev->state != Secondary || mdev->cstate != Connected)
+	ERR_IF(mdev->state != Secondary)
 		return FALSE;
+	ERR_IF(mdev->cstate != Connected)
+		return FALSE;
+	ERR_IF(test_bit(DISKLESS,&mdev->flags))
+		return FALSE;
 
 	drbd_bm_lock(mdev);
 	drbd_bm_set_all(mdev);
 	drbd_bm_write(mdev);
 	drbd_start_resync(mdev,SyncTarget);
 	drbd_bm_unlock(mdev);
-	return TRUE; // cannot fail ?
+	return TRUE;
 }
 
 STATIC int receive_BecomeSyncSource(drbd_dev *mdev, Drbd_Header *h)
 {
-	// FIXME asserts ?
+	ERR_IF(mdev->cstate != Connected)
+		return FALSE;
+	ERR_IF(test_bit(DISKLESS,&mdev->flags))
+		return FALSE;
+	ERR_IF(!drbd_md_test_flag(mdev,MDF_Consistent))
+		return FALSE;
+
 	drbd_bm_lock(mdev);
 	drbd_bm_set_all(mdev);
 	drbd_bm_write(mdev);
 	drbd_start_resync(mdev,SyncSource);
 	drbd_bm_unlock(mdev);
-	return TRUE; // cannot fail ?
+	return TRUE;
 }
 
 STATIC int receive_UnplugRemote(drbd_dev *mdev, Drbd_Header *h)
@@ -2144,25 +2149,40 @@
 
 STATIC int got_NegDReply(drbd_dev *mdev, Drbd_Header* h)
 {
-	drbd_request_t *req;
+	/* drbd_request_t *req;
+	 * unused now */
 	Drbd_BlockAck_Packet *p = (Drbd_BlockAck_Packet*)h;
 
+	if (is_syncer_blk(mdev,p->block_id)) {
+		/* no resync data available. don't panic just yet ... */
+		printk(KERN_EMERG DEVICE_NAME "%d: "
+		       "Got NegDReply for resync request. "
+		       "WE ARE LOST. We lost our up-to-date disk.\n",
+			(int)(mdev-drbd_conf));
+		return FALSE;
+	} /* else { */
+
+#if 0
+	/* hey, we panic anyways. so why bother? */
 	req = (drbd_request_t *)(long)p->block_id;
-	D_ASSERT(req->w.cb == w_is_app_read);
+	if (VALID_POINTER(req)) {
+		D_ASSERT(req->w.cb == w_is_app_read);
 
-	spin_lock(&mdev->pr_lock);
-	list_del(&req->w.list);
-	spin_unlock(&mdev->pr_lock);
+		spin_lock(&mdev->pr_lock);
+		list_del(&req->w.list);
+		spin_unlock(&mdev->pr_lock);
 
-	INVALIDATE_MAGIC(req);
-	mempool_free(req,drbd_request_mempool);
+		INVALIDATE_MAGIC(req);
+		mempool_free(req,drbd_request_mempool);
+	}
+#endif
 
 	drbd_panic("Got NegDReply. WE ARE LOST. We lost our up-to-date disk.\n");
 
 	// THINK do we have other options, but panic?
 	//       what about bio_endio, in case we don't panic ??
 
-	return TRUE;
+	return FALSE;
 }
 
 STATIC int got_NegRSDReply(drbd_dev *mdev, Drbd_Header* h)

From drbd-cvs at lists.linbit.com  Mon Aug 22 16:11:42 2005
From: drbd-cvs at lists.linbit.com (drbd-cvs@lists.linbit.com)
Date: Mon Aug 22 16:11:43 2005
Subject: [DRBD-cvs] r1915 - branches/drbd-0.7/drbd
Message-ID: <20050822141142.89A4D14EC3@mail.linbit.com>

Author: phil
Date: 2005-08-22 16:11:41 +0200 (Mon, 22 Aug 2005)
New Revision: 1915

Modified:
   branches/drbd-0.7/drbd/drbd_int.h
   branches/drbd-0.7/drbd/drbd_main.c
   branches/drbd-0.7/drbd/drbd_proc.c
Log:
Changed proc_drbd.c to use the seq_file interface insted of the single
page buffer. The single page was apparently too small if you configure
more than 30 devices or so...


Modified: branches/drbd-0.7/drbd/drbd_int.h
===================================================================
--- branches/drbd-0.7/drbd/drbd_int.h	2005-08-10 12:46:43 UTC (rev 1914)
+++ branches/drbd-0.7/drbd/drbd_int.h	2005-08-22 14:11:41 UTC (rev 1915)
@@ -1078,7 +1078,7 @@
 
 // drbd_proc.c
 extern struct proc_dir_entry *drbd_proc;
-extern int drbd_proc_get_info(char *, char **, off_t, int, int *, void *);
+extern struct file_operations drbd_proc_fops;
 extern const char* cstate_to_name(Drbd_CState s);
 extern const char* nodestate_to_name(Drbd_State s);
 

Modified: branches/drbd-0.7/drbd/drbd_main.c
===================================================================
--- branches/drbd-0.7/drbd/drbd_main.c	2005-08-10 12:46:43 UTC (rev 1914)
+++ branches/drbd-0.7/drbd/drbd_main.c	2005-08-22 14:11:41 UTC (rev 1915)
@@ -1852,13 +1852,15 @@
 	/*
 	 * register with procfs
 	 */
-	// XXX maybe move to a seq_file interface
-	drbd_proc = create_proc_read_entry("drbd", 0, &proc_root,
-					   drbd_proc_get_info, NULL);
+	drbd_proc = create_proc_entry("drbd",  S_IFREG | S_IRUGO | S_IWUSR,
+				      &proc_root);
+
 	if (!drbd_proc)	{
 		printk(KERN_ERR DEVICE_NAME": unable to register proc file\n");
 		goto Enomem;
 	}
+	
+	drbd_proc->proc_fops = &drbd_proc_fops;
 	drbd_proc->owner = THIS_MODULE;
 #else
 # error "Currently drbd depends on the proc file system (CONFIG_PROC_FS)"

Modified: branches/drbd-0.7/drbd/drbd_proc.c
===================================================================
--- branches/drbd-0.7/drbd/drbd_proc.c	2005-08-10 12:46:43 UTC (rev 1914)
+++ branches/drbd-0.7/drbd/drbd_proc.c	2005-08-22 14:11:41 UTC (rev 1915)
@@ -35,12 +35,21 @@
 #include <linux/file.h>
 #include <linux/slab.h>
 #include <linux/proc_fs.h>
+#include <linux/seq_file.h>
 #include <linux/drbd.h>
 #include "drbd_int.h"
 
-int drbd_proc_get_info(char *, char **, off_t, int, int *, void *);
+STATIC int drbd_proc_open(struct inode *inode, struct file *file);
 
+
 struct proc_dir_entry *drbd_proc;
+struct file_operations drbd_proc_fops = {
+	.owner		= THIS_MODULE,
+	.open		= drbd_proc_open,
+	.read		= seq_read,
+	.llseek		= seq_lseek,
+	.release	= single_release,
+};
 
 /*lge
  * progress bars shamelessly adapted from driver/md/md.c
@@ -48,9 +57,8 @@
  *	[=====>..............] 33.5% (23456/123456)
  *	finish: 2:20:20 speed: 6,345 (6,456) K/sec
  */
-STATIC int drbd_syncer_progress(struct Drbd_Conf* mdev,char *buf)
+STATIC void drbd_syncer_progress(struct Drbd_Conf* mdev, struct seq_file *seq)
 {
-	int sz = 0;
 	unsigned long res , db, dt, dbdt, rt, rs_left;
 
 	/* the whole sector_div thingy was wrong (did overflow,
@@ -82,23 +90,23 @@
 	}
 	{
 		int i, y = res/50, x = 20-y;
-		sz += sprintf(buf + sz, "\t[");
+		seq_printf(seq, "\t[");
 		for (i = 1; i < x; i++)
-			sz += sprintf(buf + sz, "=");
-		sz += sprintf(buf + sz, ">");
+			seq_printf(seq, "=");
+		seq_printf(seq, ">");
 		for (i = 0; i < y; i++)
-			sz += sprintf(buf + sz, ".");
-		sz += sprintf(buf + sz, "] ");
+			seq_printf(seq, ".");
+		seq_printf(seq, "] ");
 	}
 	res = 1000L - res;
-	sz+=sprintf(buf+sz,"sync'ed:%3lu.%lu%% ", res / 10, res % 10);
+	seq_printf(seq,"sync'ed:%3lu.%lu%% ", res / 10, res % 10);
 	/* if more than 1 GB display in MB */
 	if (mdev->rs_total > 0x100000L) {
-		sz+=sprintf(buf+sz,"(%lu/%lu)M\n\t",
+		seq_printf(seq,"(%lu/%lu)M\n\t",
 			    (unsigned long) Bit2KB(rs_left) >> 10,
 			    (unsigned long) Bit2KB(mdev->rs_total) >> 10 );
 	} else {
-		sz+=sprintf(buf+sz,"(%lu/%lu)K\n\t",
+		seq_printf(seq,"(%lu/%lu)K\n\t",
 			    (unsigned long) Bit2KB(rs_left),
 			    (unsigned long) Bit2KB(mdev->rs_total) );
 	}
@@ -117,16 +125,16 @@
 	db = mdev->rs_mark_left - rs_left;
 	rt = (dt * (rs_left / (db/100+1)))/100; /* seconds */
 
-	sz += sprintf(buf + sz, "finish: %lu:%02lu:%02lu",
+	seq_printf(seq, "finish: %lu:%02lu:%02lu",
 		rt / 3600, (rt % 3600) / 60, rt % 60);
 
 	/* current speed average over (SYNC_MARKS * SYNC_MARK_STEP) jiffies */
 	dbdt = Bit2KB(db/dt);
 	if (dbdt > 1000)
-		sz += sprintf(buf + sz, " speed: %ld,%03ld",
+		seq_printf(seq, " speed: %ld,%03ld",
 			dbdt/1000,dbdt % 1000);
 	else
-		sz += sprintf(buf + sz, " speed: %ld", dbdt);
+		seq_printf(seq, " speed: %ld", dbdt);
 
 	/* mean speed since syncer started
 	 * we do account for PausedSync periods */
@@ -135,14 +143,12 @@
 	db = mdev->rs_total - rs_left;
 	dbdt = Bit2KB(db/dt);
 	if (dbdt > 1000)
-		sz += sprintf(buf + sz, " (%ld,%03ld)",
+		seq_printf(seq, " (%ld,%03ld)",
 			dbdt/1000,dbdt % 1000);
 	else
-		sz += sprintf(buf + sz, " (%ld)", dbdt);
+		seq_printf(seq, " (%ld)", dbdt);
 
-	sz += sprintf(buf+sz," K/sec\n");
-
-	return sz;
+	seq_printf(seq," K/sec\n");
 }
 
 const char* cstate_to_name(Drbd_CState s) {
@@ -183,16 +189,14 @@
 		              : state_names[s];
 }
 
-/* FIXME we should use snprintf, we only have guaranteed room for one page...
- * we should eventually use seq_file for this */
-int drbd_proc_get_info(char *buf, char **start, off_t offset,
-		       int len, int *unused, void *data)
+
+STATIC int drbd_seq_show(struct seq_file *seq, void *v)
 {
-	int rlen, i;
+	int i;
 	const char *sn;
 
-	rlen = sprintf(buf, "version: " REL_VERSION " (api:%d/proto:%d)\n%s\n",
-		       API_VERSION,PRO_VERSION, drbd_buildtag());
+	seq_printf(seq, "version: " REL_VERSION " (api:%d/proto:%d)\n%s\n",
+		    API_VERSION,PRO_VERSION, drbd_buildtag());
 
 	/*
 	  cs .. connection state
@@ -216,10 +220,9 @@
 				sn = "ServerForDLess";
 		}
 		if ( drbd_conf[i].cstate == Unconfigured )
-			rlen += sprintf( buf + rlen,
-			   "%2d: cs:Unconfigured\n", i);
+			seq_printf( seq, "%2d: cs:Unconfigured\n", i);
 		else
-			rlen += sprintf( buf + rlen,
+			seq_printf( seq,
 			   "%2d: cs:%s st:%s/%s ld:%s\n"
 			   "    ns:%u nr:%u dw:%u dr:%u al:%u bm:%u "
 			   "lo:%d pe:%d ua:%d ap:%d\n",
@@ -244,12 +247,15 @@
 
 		if ( drbd_conf[i].cstate == SyncSource ||
 		     drbd_conf[i].cstate == SyncTarget )
-			rlen += drbd_syncer_progress(drbd_conf+i,buf+rlen);
+			drbd_syncer_progress(drbd_conf+i,seq);
 	}
 
-	/* DEBUG & profile stuff end */
+	return 0;
+}
 
-	return rlen;
+STATIC int drbd_proc_open(struct inode *inode, struct file *file)
+{
+	return single_open(file, drbd_seq_show, PDE(inode)->data);
 }
 
 /* PROC FS stuff end */

From drbd-cvs at lists.linbit.com  Wed Aug 24 12:04:19 2005
From: drbd-cvs at lists.linbit.com (drbd-cvs@lists.linbit.com)
Date: Wed Aug 24 12:04:20 2005
Subject: [DRBD-cvs] r1916 - in branches/drbd-0.7: . drbd/linux user
Message-ID: <20050824100419.39D9514F36@mail.linbit.com>

Author: phil
Date: 2005-08-24 12:04:18 +0200 (Wed, 24 Aug 2005)
New Revision: 1916

Modified:
   branches/drbd-0.7/ChangeLog
   branches/drbd-0.7/drbd/linux/drbd_config.h
   branches/drbd-0.7/user/drbdadm_parser.y
Log:
Preparing 0.7.12


Modified: branches/drbd-0.7/ChangeLog
===================================================================
--- branches/drbd-0.7/ChangeLog	2005-08-22 14:11:41 UTC (rev 1915)
+++ branches/drbd-0.7/ChangeLog	2005-08-24 10:04:18 UTC (rev 1916)
@@ -1,9 +1,34 @@
 Latest:
 ------
- ChangeLog last updated: r1806 2005-05-23
+ ChangeLog last updated: r1915 2005-08-22
  Cumulative changes since last tarball.
  For even more detail, use "svn log" and "svn diff".
 
+0.7.12 (api:77/proto:74)
+-----
+ * The /proc/drbd code used a fixed single page buffer. This breaks 
+   at about 30 configured devices. Changed that to use the seq_file
+   interface.
+ * Bind the source of TCP connections to the IP address that is
+   mentioned in the configuration. 
+ * Fixed a connection flip-flop bug when the two peers used different
+   user provided sizes.
+ * Various fixes in the online-resize code path, including online shrinking
+   and handling the case that the memory allocation for the new bitmap
+   failed.
+ * Random improvements to drbdadm: 
+   * The "size" option is now allowed in the disk section
+   * A new "disable-ip-verification" option for the global section
+   * The "disable-io-hints" option is not longer available.
+ * Fixed a potential very unlikely race condigtion that in the end would
+   trigger an ERR in drbd_actlog.c:607. Actually I never saw this trigger.
+ * Fixed a logic bug in _drbd_process_ee() that, paired with a race condition
+   could trigger a "ASSERT(b->n_req == set_size)" upon disconnect.
+ * Removed the "disable_io_hints" module parameter.
+ * Added the "disable_bd_claim" module parameter, to allow users, WHO 
+   KNOW WHAT THEY DO, to read-access the data on the secondary node.
+ * Allow "drbdadm invalidate" only in StandAlone and Connected states. 
+
 0.7.11 (api:77/proto:74)
 -----
  * The upper limit of the runtime tuning parameter max_buffers 

Modified: branches/drbd-0.7/drbd/linux/drbd_config.h
===================================================================
--- branches/drbd-0.7/drbd/linux/drbd_config.h	2005-08-22 14:11:41 UTC (rev 1915)
+++ branches/drbd-0.7/drbd/linux/drbd_config.h	2005-08-24 10:04:18 UTC (rev 1916)
@@ -22,7 +22,7 @@
 
 extern const char * drbd_buildtag(void);
 
-#define REL_VERSION "0.7.11"
+#define REL_VERSION "0.7.12"
 #define API_VERSION 77
 #define PRO_VERSION 74
 

Modified: branches/drbd-0.7/user/drbdadm_parser.y
===================================================================
--- branches/drbd-0.7/user/drbdadm_parser.y	2005-08-22 14:11:41 UTC (rev 1915)
+++ branches/drbd-0.7/user/drbdadm_parser.y	2005-08-24 10:04:18 UTC (rev 1916)
@@ -12,7 +12,7 @@
 extern void yyerror(char* text);
 extern int  yylex(void);
 
-#define YYDEBUG 1
+// #define YYDEBUG 1
 
 #define APPEND(LIST,ITEM) ({		      \
   typeof((LIST)) _l = (LIST);		      \

From drbd-cvs at lists.linbit.com  Wed Aug 24 15:21:21 2005
From: drbd-cvs at lists.linbit.com (drbd-cvs@lists.linbit.com)
Date: Wed Aug 24 15:21:23 2005
Subject: [DRBD-cvs] r1917 - in branches/drbd-0.7: . debian documentation
	scripts
Message-ID: <20050824132121.BB3EF14F27@mail.linbit.com>

Author: phil
Date: 2005-08-24 15:21:20 +0200 (Wed, 24 Aug 2005)
New Revision: 1917

Modified:
   branches/drbd-0.7/ChangeLog
   branches/drbd-0.7/debian/changelog
   branches/drbd-0.7/debian/control
   branches/drbd-0.7/debian/drbd0.7-utils.prerm
   branches/drbd-0.7/debian/rules
   branches/drbd-0.7/documentation/drbd.conf.sgml
   branches/drbd-0.7/drbd.spec.in
   branches/drbd-0.7/scripts/drbd.conf
Log:
* Integrated debian's changes to drbd-0.7.11
* Fixed the spec file
* Documented "isable-ip-verification" nd "size" in the "disk" section.



Modified: branches/drbd-0.7/ChangeLog
===================================================================
--- branches/drbd-0.7/ChangeLog	2005-08-24 10:04:18 UTC (rev 1916)
+++ branches/drbd-0.7/ChangeLog	2005-08-24 13:21:20 UTC (rev 1917)
@@ -20,7 +20,7 @@
    * The "size" option is now allowed in the disk section
    * A new "disable-ip-verification" option for the global section
    * The "disable-io-hints" option is not longer available.
- * Fixed a potential very unlikely race condigtion that in the end would
+ * Fixed a potential very unlikely race condition that in the end would
    trigger an ERR in drbd_actlog.c:607. Actually I never saw this trigger.
  * Fixed a logic bug in _drbd_process_ee() that, paired with a race condition
    could trigger a "ASSERT(b->n_req == set_size)" upon disconnect.

Modified: branches/drbd-0.7/debian/changelog
===================================================================
--- branches/drbd-0.7/debian/changelog	2005-08-24 10:04:18 UTC (rev 1916)
+++ branches/drbd-0.7/debian/changelog	2005-08-24 13:21:20 UTC (rev 1917)
@@ -1,23 +1,63 @@
-drbd (0.7.11-0) unstable; urgency=low
+drbd (0.7.12-0) unstable; urgency=low
 
-  * (Philipp Reisner)
-     - New upstream release
+  * New upstream release
 
- -- Philipp Reisner <phil@linbit.com>  Mon, 23 May 2005 15:29:21 +0200
+ -- <Philipp Reisner <phil@linbit.com>  Wed, 24 Aug 2005 15:01:10 +0100
 
-drbd (0.7.10-0) unstable; urgency=low
+drbd (0.7.11-1) unstable; urgency=low
 
-  * (Philipp Reisner)
+  * New upstream release
+
+ -- Cyril Bouthors <cyril@bouthors.org>  Mon, 20 Jun 2005 15:49:40 +0300
+
+drbd (0.7.10-4) unstable; urgency=low
+
+  * debian/control: added missing dependency to dpatch for
+    drbd0.7-module-source (closes: #308295).
+  * debian/control: updated Maintainer and Uploaders fields to match
+    reality.
+
+ -- Cyril Bouthors <cyril@bouthors.org>  Mon, 30 May 2005 11:22:46 +0300
+
+drbd (0.7.10-3) unstable; urgency=low
+
+  * (Cyril Bouthors)
+     - scripts/drbd: explicit modprobe and rmmod pathnames
+       (initscript_explicit_pathname.patch) (closes: #303060, #302556).
+
+ -- Cyril Bouthors <cyril@bouthors.org>  Sun, 17 Apr 2005 18:08:30 +0300
+
+drbd (0.7.10-2) unstable; urgency=low
+
+  * (Cyril Bouthors)
+     - debian/drbd0.7-utils.prerm: silently ignore the initscript return
+       code if we remove or deconfigure the package or carefully pay
+       attention to it if we upgrade the package. (closes: #295533).
+     - debian/control: fixed drbd0.7-module-source description.
+
+ -- Cyril Bouthors <cyril@bouthors.org>  Wed, 16 Feb 2005 21:05:51 +0100
+
+drbd (0.7.10-1) unstable; urgency=low
+
+  * (Cyril Bouthors)
      - New upstream release
 
- -- Philipp Reisner <phil@linbit.com>  Mon, 31 Jan 2005 10:17:00 +0100
+ -- Cyril Bouthors <cyril@bouthors.org>  Mon, 31 Jan 2005 17:29:27 +0300
 
-drbd (0.7.9-0) unstable; urgency=low
+drbd (0.7.9-2) unstable; urgency=low
 
-  * (Philipp Reisner)
+  * (Cyril Bouthors)
+     - Applied patch from Lars Marowsky-Bree <lmb@suse.de> that fixes a
+       "severe [...] memory corruption bug [...]".
+
+ -- Cyril Bouthors <cyril@bouthors.org>  Thu, 27 Jan 2005 13:55:00 +0300
+
+drbd (0.7.9-1) unstable; urgency=low
+
+  * (Cyril Bouthors)
      - New upstream release
 
- -- Philipp Reisner <phil@linbit.com>  Tue, 25 Jan 2005 11:31:00 +0100
+ -- Cyril Bouthors <cyril@bouthors.org>  Thu, 27 Jan 2005 11:35:19 +0300
 
 drbd (0.7.8-1) unstable; urgency=low
 

Modified: branches/drbd-0.7/debian/control
===================================================================
--- branches/drbd-0.7/debian/control	2005-08-24 10:04:18 UTC (rev 1916)
+++ branches/drbd-0.7/debian/control	2005-08-24 13:21:20 UTC (rev 1917)
@@ -1,9 +1,9 @@
 Source: drbd
 Section: admin
 Priority: extra
-Maintainer: David Krovich <dkrovich@csee.wvu.edu>
-Uploaders: Philipp Hug <debian@hug.cx>, Cyril Bouthors <cyril@bouthors.org>
-Build-Depends: debhelper (>= 4), debconf-utils, sp, docbook-utils, bison, flex
+Maintainer: Cyril Bouthors <cyril@bouthors.org>
+Uploaders: David Krovich <dkrovich@csee.wvu.edu>, Philipp Hug <debian@hug.cx>
+Build-Depends: debhelper (>= 4), debconf-utils, sp, docbook-utils, bison, flex, dpatch
 Standards-Version: 3.6.1
 
 Package: drbd0.7-utils
@@ -16,34 +16,32 @@
 Suggests: heartbeat
 Description: RAID 1 over tcp/ip for Linux utilities
  Drbd is a block device which is designed to build high availability
- clusters by providing a virtual shared device which keeps disks in nodes
- synchronised using TCP/IP. This simulates RAID 1 but avoiding the 
- use of uncommon hardware (shared SCSI buses or Fibre Channel). 
+ clusters by providing a virtual shared device which keeps disks in
+ nodes synchronised using TCP/IP. This simulates RAID 1 but avoiding
+ the use of uncommon hardware (shared SCSI buses or Fibre Channel).
  It is currently limited to fail-over HA clusters.
  .
- This package contains the programs that will control the 
- drbd kernel module provided in drbd-source. You will need a clustering
- service (such as heartbeat) to fully implement it.
+ This package contains the programs that will control the drbd kernel
+ module provided in drbd-source. You will need a clustering service
+ (such as heartbeat) to fully implement it.
  .
  Homepage: http://www.drbd.org
 
 Package: drbd0.7-module-source
 Architecture: all
 Section: admin
-Depends: module-assistant, debhelper (>= 4), 
+Depends: module-assistant, debhelper (>= 4), dpatch
 Conflicts: drbd-module-source, drbd-source
 Provides: drbd-module-source
 Replaces: drbd-module-source, drbd-source
 Recommends:  dpkg-dev, kernel-package, debconf-utils
 Description: RAID 1 over tcp/ip for Linux module source
  Drbd is a block device which is designed to build high availability
- clusters by providing a virtual shared device which keeps disks in nodes
- synchronised using TCP/IP. This simulates RAID 1 but avoiding the 
- use of uncommon hardware (shared SCSI buses or Fibre Channel). 
+ clusters by providing a virtual shared device which keeps disks in
+ nodes synchronised using TCP/IP. This simulates RAID 1 but avoiding
+ the use of uncommon hardware (shared SCSI buses or Fibre Channel).
  It is currently limited to fail-over HA clusters.
  .
- This package contains the programs that will control the 
- drbd kernel module provided in drbd-source. You will need a clustering
- service (such as heartbeat) to fully implement it.
+ This package contains the source code for the drbd kernel module.
  .
  Homepage: http://www.drbd.org

Modified: branches/drbd-0.7/debian/drbd0.7-utils.prerm
===================================================================
--- branches/drbd-0.7/debian/drbd0.7-utils.prerm	2005-08-24 10:04:18 UTC (rev 1916)
+++ branches/drbd-0.7/debian/drbd0.7-utils.prerm	2005-08-24 13:21:20 UTC (rev 1917)
@@ -1,6 +1,30 @@
 #!/bin/sh
 
-if [ -x "/etc/init.d/drbd" ]; then
-	/etc/init.d/drbd stop
+# This script silently ignores the initscript return code if we remove
+# or deconfigure the package or carefully pay attention to it if we
+# upgrade the package.
+
+# Cyril Bouthors <cyril@bouthors.org>
+# Wed Feb 16 21:01:11 CET 2005
+
+set -e
+
+if [ -x "/etc/init.d/drbd" ]
+then
+    case "$1" in
+	remove|deconfigure)
+	    /etc/init.d/drbd stop || true
+	    ;;
+
+	upgrade|failed-upgrade)
+	    /etc/init.d/drbd stop
+	    ;;
+
+	*)
+	    echo "prerm called with unknown argument \`$1'" >&2
+	    exit 0
+	    ;;
+    esac
 fi
+
 #DEBHELPER#

Modified: branches/drbd-0.7/debian/rules
===================================================================
--- branches/drbd-0.7/debian/rules	2005-08-24 10:04:18 UTC (rev 1916)
+++ branches/drbd-0.7/debian/rules	2005-08-24 13:21:20 UTC (rev 1917)
@@ -7,8 +7,10 @@
 # build-arch and build-indep targets  by Bill Allombert 2001
 
 # Uncomment this to turn on verbose mode.
-#export DH_VERBOSE=1
+# export DH_VERBOSE=1
 
+include /usr/share/dpatch/dpatch.make
+
 # This has to be exported to make some magic below work.
 export DH_OPTIONS
 
@@ -34,7 +36,7 @@
 KO=k
 endif
 
-kdist_clean:
+kdist_clean: unpatch
 	dh_clean
 	-$(MAKE) -C drbd clean
 
@@ -60,11 +62,11 @@
 	dh_md5sums
 	dh_builddeb --destdir=$(DEB_DESTDIR)
 
-#Architecture 
-build: build-arch build-indep
+#Architecture
+build: patch build-arch build-indep
 
 build-arch: build-arch-stamp
-build-arch-stamp: 
+build-arch-stamp:
 	dh_testdir
 	$(MAKE) -C user
 	$(MAKE) -C scripts
@@ -73,10 +75,10 @@
 	touch build-arch-stamp
 
 build-indep: build-indep-stamp
-build-indep-stamp: 
+build-indep-stamp:
 	touch build-indep-stamp
 
-clean:
+clean: unpatch
 	dh_testdir
 	dh_testroot
 	rm -f build-arch-stamp build-indep-stamp #CONFIGURE-STAMP#
@@ -89,13 +91,13 @@
 	-$(MAKE) -C benchmark clean
 	-$(MAKE) -C documentation clean
 	-$(MAKE) -C drbd clean
-	dh_clean 
+	dh_clean
 
 install: install-arch install-indep
 install-indep:
 	dh_testdir
 	dh_testroot
-	dh_clean -k -i 
+	dh_clean -k -i
 	dh_installdirs -i
 	cp -a drbd/* debian/$(PACKAGE)-source/usr/src/modules/drbd/drbd
 	cp Makefile debian/$(PACKAGE)-source/usr/src/modules/drbd
@@ -115,7 +117,7 @@
 install-arch:
 	dh_testdir
 	dh_testroot
-	dh_clean -k -s 
+	dh_clean -k -s
 	dh_installdirs -s
 	$(MAKE) PREFIX=$(CURDIR)/debian/drbd0.7-utils/ -C user install
 	$(MAKE) PREFIX=$(CURDIR)/debian/drbd0.7-utils/ -C scripts install
@@ -133,8 +135,8 @@
 	dh_installdocs
 	dh_installexamples
 #	dh_installmenu
-#	dh_installdebconf	
-#	dh_installlogrotate	
+#	dh_installdebconf
+#	dh_installlogrotate
 #	dh_installemacsen
 #	dh_installpam
 #	dh_installmime
@@ -144,7 +146,7 @@
 	dh_installman
 	dh_link
 	dh_strip
-	dh_compress 
+	dh_compress
 	dh_fixperms
 #	dh_perl
 #	dh_python
@@ -163,4 +165,4 @@
 	$(MAKE) -f debian/rules DH_OPTIONS=-a binary-common
 
 binary: binary-arch binary-indep
-.PHONY: build clean binary-indep binary-arch binary install install-indep install-arch
+.PHONY: build clean binary-indep binary-arch binary install install-indep install-arch patch unpatch

Modified: branches/drbd-0.7/documentation/drbd.conf.sgml
===================================================================
--- branches/drbd-0.7/documentation/drbd.conf.sgml	2005-08-24 10:04:18 UTC (rev 1916)
+++ branches/drbd-0.7/documentation/drbd.conf.sgml	2005-08-24 13:21:20 UTC (rev 1917)
@@ -111,7 +111,7 @@
   <listitem><para>
     Configures some global parameters. Currently only
     <option>minor-count</option>, <option>dialog-refresh</option> 
-    and <option>disable-io-hints</option>
+    and <option>disable-ip-verification</option>
     are allowed here. You may only have one global section, preferably
     as the first section.
   </para>
@@ -155,7 +155,8 @@
     refer to <citerefentry><refentrytitle>drbdsetup</refentrytitle>
     <manvolnum>8</manvolnum></citerefentry> for detailed description of 
     the parameters.
-    Optional parameter: <option>on-io-error</option>.
+    Optional parameter: <option>on-io-error</option>,
+    <option>size</option>.
   </para>
   </listitem>
 </varlistentry>
@@ -238,13 +239,13 @@
 </varlistentry>
 
 <varlistentry>
-  <term><option>disable-io-hints</option></term>
+  <term><option>disable-ip-verification</option></term>
   <listitem>
-  <para>Use <replaceable>disable-io-hints</replaceable>
-   if you want to set up a DRBD device via the
-   loopback network interface or between two virtual machines on the same
-   box, for testing/simulating/presentationn
-   otherwise it could trigger a run_tasq_queue deadlock.</para>
+  <para>Use <replaceable>disable-ip-verification</replaceable>
+   if, for some obscure reasons, drbdadm can/might not use ip or ifconfig
+   to do a santiy check for the IP address, you can disable it with this
+   this option.
+   </para>
    </listitem>
 </varlistentry>
 

Modified: branches/drbd-0.7/drbd.spec.in
===================================================================
--- branches/drbd-0.7/drbd.spec.in	2005-08-24 10:04:18 UTC (rev 1916)
+++ branches/drbd-0.7/drbd.spec.in	2005-08-24 13:21:20 UTC (rev 1917)
@@ -190,6 +190,31 @@
 /sbin/depmod -a -F /boot/System.map-%{kernelversion} %{kernelversion} >/dev/null 2>&1 || true
 
 %changelog
+* Wed 24 Aug 2005 15:01:10 +0200 Philipp Reisner <phil@linbit.com>
+- drbd (0.7.12-1)
+ * The /proc/drbd code used a fixed single page buffer. This breaks 
+   at about 30 configured devices. Changed that to use the seq_file
+   interface.
+ * Bind the source of TCP connections to the IP address that is
+   mentioned in the configuration. 
+ * Fixed a connection flip-flop bug when the two peers used different
+   user provided sizes.
+ * Various fixes in the online-resize code path, including online shrinking
+   and handling the case that the memory allocation for the new bitmap
+   failed.
+ * Random improvements to drbdadm: 
+   * The "size" option is now allowed in the disk section
+   * A new "disable-ip-verification" option for the global section
+   * The "disable-io-hints" option is not longer available.
+ * Fixed a potential very unlikely race condition that in the end would
+   trigger an ERR in drbd_actlog.c:607. Actually I never saw this trigger.
+ * Fixed a logic bug in _drbd_process_ee() that, paired with a race condition
+   could trigger a "ASSERT(b->n_req == set_size)" upon disconnect.
+ * Removed the "disable_io_hints" module parameter.
+ * Added the "disable_bd_claim" module parameter, to allow users, WHO 
+   KNOW WHAT THEY DO, to read-access the data on the secondary node.
+ * Allow "drbdadm invalidate" only in StandAlone and Connected states. 
+
 * Tue Jun  7 2005 19:13:00 +0200 Lars Ellenberg <lars@linbit.com>
 - drbd (0.7.11-1)
  * The upper limit of the runtime tuning parameter max_buffers 

Modified: branches/drbd-0.7/scripts/drbd.conf
===================================================================
--- branches/drbd-0.7/scripts/drbd.conf	2005-08-24 10:04:18 UTC (rev 1916)
+++ branches/drbd-0.7/scripts/drbd.conf	2005-08-24 13:21:20 UTC (rev 1917)
@@ -76,18 +76,8 @@
     #
     # dialog-refresh 5; # 5 seconds
 
-    # this is for people who set up a drbd device via the
-    # loopback network interface or between two VMs on the same
-    # box, for testing/simulating/presentation
-    # otherwise it could trigger a run_tasq_queue deadlock.
-    # I'm not sure whether this deadlock can happen with two
-    # nodes, but it seems at least extremely unlikely; and since
-    # the io_hints boost performance, keep them enabled.
-    #
-    # With linux 2.6 it no longer makes sense.
-    # So this option should vanish.	--lge
-    #
-    # disable-io-hints;
+    # You might disable one of drbdadm's sanity check.
+    # disable-ip-verification;
 # }
 
 #
@@ -149,6 +139,11 @@
     #                 continues in disk less mode.
     #
     on-io-error   detach;
+
+    # In case you only want to use a fraction of the available space
+    # you might use the "size" option here.
+    #
+    # size 10G;
   }
 
   net {

From drbd-cvs at lists.linbit.com  Wed Aug 24 15:27:13 2005
From: drbd-cvs at lists.linbit.com (drbd-cvs@lists.linbit.com)
Date: Wed Aug 24 15:27:14 2005
Subject: [DRBD-cvs] r1918 - in branches/drbd-0.7: . drbd
Message-ID: <20050824132713.4DAF614F27@mail.linbit.com>

Author: lars
Date: 2005-08-24 15:27:12 +0200 (Wed, 24 Aug 2005)
New Revision: 1918

Modified:
   branches/drbd-0.7/drbd.spec.in
   branches/drbd-0.7/drbd/drbd_main.c
Log:

/proc/drbd is readonly

fix reference of example config file
  /usr/share/doc/packages/drbd/drbd.conf
                          ^^^^^


Modified: branches/drbd-0.7/drbd/drbd_main.c
===================================================================
--- branches/drbd-0.7/drbd/drbd_main.c	2005-08-24 13:21:20 UTC (rev 1917)
+++ branches/drbd-0.7/drbd/drbd_main.c	2005-08-24 13:27:12 UTC (rev 1918)
@@ -1852,8 +1852,7 @@
 	/*
 	 * register with procfs
 	 */
-	drbd_proc = create_proc_entry("drbd",  S_IFREG | S_IRUGO | S_IWUSR,
-				      &proc_root);
+	drbd_proc = create_proc_entry("drbd",  S_IFREG | S_IRUGO , &proc_root);
 
 	if (!drbd_proc)	{
 		printk(KERN_ERR DEVICE_NAME": unable to register proc file\n");

Modified: branches/drbd-0.7/drbd.spec.in
===================================================================
--- branches/drbd-0.7/drbd.spec.in	2005-08-24 13:21:20 UTC (rev 1917)
+++ branches/drbd-0.7/drbd.spec.in	2005-08-24 13:27:12 UTC (rev 1918)
@@ -110,7 +110,7 @@
 cat <<___ > etc/drbd.conf
 #
 # please have a a look at the example configuration file in
-# %{_docdir}/drbd.conf
+# %{_docdir}/%{name}/drbd.conf
 #
 ___
 

From drbd-cvs at lists.linbit.com  Wed Aug 24 16:00:53 2005
From: drbd-cvs at lists.linbit.com (drbd-cvs@lists.linbit.com)
Date: Wed Aug 24 16:01:00 2005
Subject: [DRBD-cvs] r1919 - branches/drbd-0.7
Message-ID: <20050824140058.4E54314F27@mail.linbit.com>

Author: phil
Date: 2005-08-24 16:00:52 +0200 (Wed, 24 Aug 2005)
New Revision: 1919

Modified:
   branches/drbd-0.7/drbd.spec.in
Log:
RPM is very picky about the date format...


Modified: branches/drbd-0.7/drbd.spec.in
===================================================================
--- branches/drbd-0.7/drbd.spec.in	2005-08-24 13:27:12 UTC (rev 1918)
+++ branches/drbd-0.7/drbd.spec.in	2005-08-24 14:00:52 UTC (rev 1919)
@@ -190,7 +190,7 @@
 /sbin/depmod -a -F /boot/System.map-%{kernelversion} %{kernelversion} >/dev/null 2>&1 || true
 
 %changelog
-* Wed 24 Aug 2005 15:01:10 +0200 Philipp Reisner <phil@linbit.com>
+* Wed Aug 24 2005 15:01:10 +0200 Philipp Reisner <phil@linbit.com>
 - drbd (0.7.12-1)
  * The /proc/drbd code used a fixed single page buffer. This breaks 
    at about 30 configured devices. Changed that to use the seq_file

From drbd-cvs at lists.linbit.com  Wed Aug 24 17:31:47 2005
From: drbd-cvs at lists.linbit.com (drbd-cvs@lists.linbit.com)
Date: Wed Aug 24 17:31:49 2005
Subject: [DRBD-cvs] r1920 - branches/drbd-0.7/drbd
Message-ID: <20050824153147.5D7E014F27@mail.linbit.com>

Author: phil
Date: 2005-08-24 17:31:46 +0200 (Wed, 24 Aug 2005)
New Revision: 1920

Modified:
   branches/drbd-0.7/drbd/drbd_proc.c
Log:
Make the new proc stuff to work on kernels older than 2.4.23

!! Do not propagate me to drbd-0.8 !!



Modified: branches/drbd-0.7/drbd/drbd_proc.c
===================================================================
--- branches/drbd-0.7/drbd/drbd_proc.c	2005-08-24 14:00:52 UTC (rev 1919)
+++ branches/drbd-0.7/drbd/drbd_proc.c	2005-08-24 15:31:46 UTC (rev 1920)
@@ -40,6 +40,7 @@
 #include "drbd_int.h"
 
 STATIC int drbd_proc_open(struct inode *inode, struct file *file);
+STATIC int drbd_seq_show(struct seq_file *seq, void *v);
 
 
 struct proc_dir_entry *drbd_proc;
@@ -48,9 +49,33 @@
 	.open		= drbd_proc_open,
 	.read		= seq_read,
 	.llseek		= seq_lseek,
-	.release	= single_release,
+	.release	= seq_release,
 };
 
+// We ommit single_open and single_release, since that is only available
+// after 2.4.23
+static void *single_start(struct seq_file *p, loff_t *pos)
+{
+	return NULL + (*pos == 0);
+}
+
+static void *single_next(struct seq_file *p, void *v, loff_t *pos)
+{
+	++*pos;
+	return NULL;
+}
+
+static void single_stop(struct seq_file *p, void *v)
+{
+}
+
+struct seq_operations drbd_proc_seq_ops = {
+	.start		= single_start,
+	.next		= single_next,
+	.stop		= single_stop,
+	.show		= drbd_seq_show,
+};
+
 /*lge
  * progress bars shamelessly adapted from driver/md/md.c
  * output looks like
@@ -255,7 +280,7 @@
 
 STATIC int drbd_proc_open(struct inode *inode, struct file *file)
 {
-	return single_open(file, drbd_seq_show, PDE(inode)->data);
+	return seq_open(file, &drbd_proc_seq_ops);
 }
 
 /* PROC FS stuff end */

From drbd-cvs at lists.linbit.com  Wed Aug 24 17:32:18 2005
From: drbd-cvs at lists.linbit.com (drbd-cvs@lists.linbit.com)
Date: Wed Aug 24 17:32:18 2005
Subject: [DRBD-cvs] r1921 - branches/drbd-0.7/debian
Message-ID: <20050824153218.4ACF014F27@mail.linbit.com>

Author: phil
Date: 2005-08-24 17:32:17 +0200 (Wed, 24 Aug 2005)
New Revision: 1921

Modified:
   branches/drbd-0.7/debian/changelog
Log:
Typo


Modified: branches/drbd-0.7/debian/changelog
===================================================================
--- branches/drbd-0.7/debian/changelog	2005-08-24 15:31:46 UTC (rev 1920)
+++ branches/drbd-0.7/debian/changelog	2005-08-24 15:32:17 UTC (rev 1921)
@@ -2,7 +2,7 @@
 
   * New upstream release
 
- -- <Philipp Reisner <phil@linbit.com>  Wed, 24 Aug 2005 15:01:10 +0100
+ -- Philipp Reisner <phil@linbit.com>  Wed, 24 Aug 2005 15:01:10 +0200
 
 drbd (0.7.11-1) unstable; urgency=low
 

From drbd-cvs at lists.linbit.com  Thu Aug 25 10:54:22 2005
From: drbd-cvs at lists.linbit.com (drbd-cvs@lists.linbit.com)
Date: Thu Aug 25 10:54:24 2005
Subject: [DRBD-cvs] r1922 - branches/drbd-0.7/drbd
Message-ID: <20050825085423.023CC14F66@mail.linbit.com>

Author: lars
Date: 2005-08-25 10:54:21 +0200 (Thu, 25 Aug 2005)
New Revision: 1922

Modified:
   branches/drbd-0.7/drbd/drbd_actlog.c
   branches/drbd-0.7/drbd/drbd_fs.c
   branches/drbd-0.7/drbd/drbd_receiver.c
Log:

 * balance module count in case a diskless secondary loses connection
 * quieten drbd_md_sync_page_io
 * clean receiver exit after "no good data anymore" panic



Modified: branches/drbd-0.7/drbd/drbd_actlog.c
===================================================================
--- branches/drbd-0.7/drbd/drbd_actlog.c	2005-08-24 15:32:17 UTC (rev 1921)
+++ branches/drbd-0.7/drbd/drbd_actlog.c	2005-08-25 08:54:21 UTC (rev 1922)
@@ -98,6 +98,7 @@
 	D_ASSERT(semaphore_is_locked(&mdev->md_io_mutex));
 
 	if (!mdev->md_bdev) {
+		if (test_bit(DISKLESS,&mdev->flags)) return 0;
 		if (DRBD_ratelimit(5*HZ,5)) {
 			ERR("mdev->md_bdev==NULL\n");
 			dump_stack();

Modified: branches/drbd-0.7/drbd/drbd_fs.c
===================================================================
--- branches/drbd-0.7/drbd/drbd_fs.c	2005-08-24 15:32:17 UTC (rev 1921)
+++ branches/drbd-0.7/drbd/drbd_fs.c	2005-08-25 08:54:21 UTC (rev 1922)
@@ -1209,7 +1209,8 @@
 		if (test_bit(DISKLESS,&mdev->flags)) {
 			set_cstate(mdev,Unconfigured);
 			drbd_mdev_cleanup(mdev);
-			module_put(THIS_MODULE);
+			/* was done in disconnect already.
+			 * module_put(THIS_MODULE); */
 		} else set_cstate(mdev,StandAlone);
 
 		break;

Modified: branches/drbd-0.7/drbd/drbd_receiver.c
===================================================================
--- branches/drbd-0.7/drbd/drbd_receiver.c	2005-08-24 15:32:17 UTC (rev 1921)
+++ branches/drbd-0.7/drbd/drbd_receiver.c	2005-08-25 08:54:21 UTC (rev 1922)
@@ -1895,7 +1895,9 @@
 	if ( mdev->state == Primary &&
 	    ( test_bit(DISKLESS,&mdev->flags)
 	    || !drbd_md_test_flag(mdev,MDF_Consistent) ) ) {
+		drbd_thread_stop_nowait(&mdev->receiver);
 		drbd_panic("Sorry, I have no access to good data anymore.\n");
+		return;
 	}
 
 	if (get_t_state(&mdev->receiver) == Exiting) {
@@ -1903,6 +1905,7 @@
 			// Secondary
 			set_cstate(mdev,Unconfigured);
 			drbd_mdev_cleanup(mdev);
+			module_put(THIS_MODULE);
 		} else {
 			set_cstate(mdev,StandAlone);
 			drbd_thread_start(&mdev->worker);

From drbd-cvs at lists.linbit.com  Thu Aug 25 11:28:24 2005
From: drbd-cvs at lists.linbit.com (drbd-cvs@lists.linbit.com)
Date: Thu Aug 25 11:28:25 2005
Subject: [DRBD-cvs] r1923 - branches/drbd-0.7/drbd
Message-ID: <20050825092824.4302E14EE4@mail.linbit.com>

Author: phil
Date: 2005-08-25 11:28:22 +0200 (Thu, 25 Aug 2005)
New Revision: 1923

Modified:
   branches/drbd-0.7/drbd/drbd_fs.c
   branches/drbd-0.7/drbd/drbd_receiver.c
Log:
Do not shoot too fast ;)


Modified: branches/drbd-0.7/drbd/drbd_fs.c
===================================================================
--- branches/drbd-0.7/drbd/drbd_fs.c	2005-08-25 08:54:21 UTC (rev 1922)
+++ branches/drbd-0.7/drbd/drbd_fs.c	2005-08-25 09:28:22 UTC (rev 1923)
@@ -1209,8 +1209,7 @@
 		if (test_bit(DISKLESS,&mdev->flags)) {
 			set_cstate(mdev,Unconfigured);
 			drbd_mdev_cleanup(mdev);
-			/* was done in disconnect already.
-			 * module_put(THIS_MODULE); */
+			module_put(THIS_MODULE);
 		} else set_cstate(mdev,StandAlone);
 
 		break;

Modified: branches/drbd-0.7/drbd/drbd_receiver.c
===================================================================
--- branches/drbd-0.7/drbd/drbd_receiver.c	2005-08-25 08:54:21 UTC (rev 1922)
+++ branches/drbd-0.7/drbd/drbd_receiver.c	2005-08-25 09:28:22 UTC (rev 1923)
@@ -1905,7 +1905,6 @@
 			// Secondary
 			set_cstate(mdev,Unconfigured);
 			drbd_mdev_cleanup(mdev);
-			module_put(THIS_MODULE);
 		} else {
 			set_cstate(mdev,StandAlone);
 			drbd_thread_start(&mdev->worker);

From drbd-cvs at lists.linbit.com  Thu Aug 25 14:46:40 2005
From: drbd-cvs at lists.linbit.com (drbd-cvs@lists.linbit.com)
Date: Thu Aug 25 14:46:41 2005
Subject: [DRBD-cvs] r1924 - in branches/drbd-0.7: . drbd user
Message-ID: <20050825124640.2F84F14EE4@mail.linbit.com>

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

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



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

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

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

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

From drbd-cvs at lists.linbit.com  Thu Aug 25 16:29:16 2005
From: drbd-cvs at lists.linbit.com (drbd-cvs@lists.linbit.com)
Date: Thu Aug 25 16:29:17 2005
Subject: [DRBD-cvs] r1925 - branches/drbd-0.6/drbd
Message-ID: <20050825142916.2056614EE4@mail.linbit.com>

Author: lars
Date: 2005-08-25 16:29:15 +0200 (Thu, 25 Aug 2005)
New Revision: 1925

Modified:
   branches/drbd-0.6/drbd/drbd_receiver.c
   branches/drbd-0.6/drbd/drbd_req-2.4.c
Log:

clear the "write hint queued" bit on disconnect.



Modified: branches/drbd-0.6/drbd/drbd_receiver.c
===================================================================
--- branches/drbd-0.6/drbd/drbd_receiver.c	2005-08-25 12:46:37 UTC (rev 1924)
+++ branches/drbd-0.6/drbd/drbd_receiver.c	2005-08-25 14:29:15 UTC (rev 1925)
@@ -1379,6 +1379,9 @@
 
 	clear_bit(DO_NOT_INC_CONCNT,&drbd_conf[minor].flags);
 
+	/* it may still be set, because some unplug was on the fly */
+	if (!disable_io_hints) mdev->flags &= ~(1<<WRITE_HINT_QUEUED);
+
 	printk(KERN_INFO DEVICE_NAME "%d: Connection lost.\n",minor);
 }
 

Modified: branches/drbd-0.6/drbd/drbd_req-2.4.c
===================================================================
--- branches/drbd-0.6/drbd/drbd_req-2.4.c	2005-08-25 12:46:37 UTC (rev 1924)
+++ branches/drbd-0.6/drbd/drbd_req-2.4.c	2005-08-25 14:29:15 UTC (rev 1925)
@@ -253,7 +253,9 @@
 	}
 
 	if(!test_and_set_bit(WRITE_HINT_QUEUED,&mdev->flags)) {
-		queue_task(&mdev->write_hint_tq, &tq_disk);
+		/* if it could not be queued, clear our flag again, too */
+		if (!queue_task(&mdev->write_hint_tq, &tq_disk))
+			clear_bit(WRITE_HINT_QUEUED,&mdev->flags);
 	}
 
 	submit_bh(rw,nbh);

From drbd-cvs at lists.linbit.com  Thu Aug 25 16:43:52 2005
From: drbd-cvs at lists.linbit.com (drbd-cvs@lists.linbit.com)
Date: Thu Aug 25 16:43:52 2005
Subject: [DRBD-cvs] r1926 - tags
Message-ID: <20050825144352.2C76714EE4@mail.linbit.com>

Author: phil
Date: 2005-08-25 16:43:51 +0200 (Thu, 25 Aug 2005)
New Revision: 1926

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


Copied: tags/drbd-0.7.12 (from rev 1925, branches/drbd-0.7)

From drbd-cvs at lists.linbit.com  Thu Aug 25 17:09:27 2005
From: drbd-cvs at lists.linbit.com (drbd-cvs@lists.linbit.com)
Date: Thu Aug 25 17:09:28 2005
Subject: [DRBD-cvs] r1929 - branches/drbd-0.6/drbd
Message-ID: <20050825150927.0275A14EE4@mail.linbit.com>

Author: lars
Date: 2005-08-25 17:09:27 +0200 (Thu, 25 Aug 2005)
New Revision: 1929

Modified:
   branches/drbd-0.6/drbd/drbd_int.h
Log:

and declaration of disable_io_hints , now that it is use in drbd_receiver.c, too



Modified: branches/drbd-0.6/drbd/drbd_int.h
===================================================================
--- branches/drbd-0.6/drbd/drbd_int.h	2005-08-25 15:05:59 UTC (rev 1928)
+++ branches/drbd-0.6/drbd/drbd_int.h	2005-08-25 15:09:27 UTC (rev 1929)
@@ -47,6 +47,9 @@
 #include <linux/completion.h>
 #endif
 
+// module parameter defined in drbd_main.c
+extern int disable_io_hints;
+
 /* Using the major_nr of the network block device
    prevents us from deadlocking with no request entries
    left on all_requests...

From drbd-cvs at lists.linbit.com  Thu Aug 25 17:24:53 2005
From: drbd-cvs at lists.linbit.com (drbd-cvs@lists.linbit.com)
Date: Thu Aug 25 17:25:00 2005
Subject: [DRBD-cvs] r1930 - branches/drbd-0.6/drbd
Message-ID: <20050825152458.E1FEA14EE4@mail.linbit.com>

Author: lars
Date: 2005-08-25 17:24:53 +0200 (Thu, 25 Aug 2005)
New Revision: 1930

Modified:
   branches/drbd-0.6/drbd/drbd_receiver.c
Log:
yes, 0.6 uses minor number all over the place...

Modified: branches/drbd-0.6/drbd/drbd_receiver.c
===================================================================
--- branches/drbd-0.6/drbd/drbd_receiver.c	2005-08-25 15:09:27 UTC (rev 1929)
+++ branches/drbd-0.6/drbd/drbd_receiver.c	2005-08-25 15:24:53 UTC (rev 1930)
@@ -1380,7 +1380,7 @@
 	clear_bit(DO_NOT_INC_CONCNT,&drbd_conf[minor].flags);
 
 	/* it may still be set, because some unplug was on the fly */
-	if (!disable_io_hints) mdev->flags &= ~(1<<WRITE_HINT_QUEUED);
+	if (!disable_io_hints) drbd_conf[minor].flags &= ~(1<<WRITE_HINT_QUEUED);
 
 	printk(KERN_INFO DEVICE_NAME "%d: Connection lost.\n",minor);
 }

From drbd-cvs at lists.linbit.com  Wed Aug 31 19:04:26 2005
From: drbd-cvs at lists.linbit.com (drbd-cvs@lists.linbit.com)
Date: Wed Aug 31 19:04:28 2005
Subject: [DRBD-cvs] r1937 - branches/drbd-0.7/drbd
Message-ID: <20050831170426.AE1DD1435D@mail.linbit.com>

Author: phil
Date: 2005-08-31 19:04:25 +0200 (Wed, 31 Aug 2005)
New Revision: 1937

Modified:
   branches/drbd-0.7/drbd/drbd_receiver.c
Log:
This was really hard. 

In the kernel's API there are two variants of all bitops. The atomic
ones set_bit(), clear_bit(), test_bit() etc...  and the non atomic
ones __set_bit(), __clear_bit() ...

The race condition:
 CPU1 was in an IO completion handler and used the __set_bit(SYNC_STARTED,..)
 there. Non atomic means: First, it fetched the word from memory....
  ... CPU2 was exiting the _drbd_process_ee() function and did the clear bit 
 clear_bit(PROCESS_EE_RUNNING) atomic = fetch, modify and write...
  ... back on CPU1 we now do the modify and write...
  
So CPU2 sets the PROCESS_EE_RUNNING bit again, because it fetched
the word before CPU1 did it's atomic update.
  
So I conclude, that the rule is:
  
  If you use the atomic bitops on a word, you may never ever user the
  non atomic bitops on the same word anywhere in your code.

But it feels good, to understand what was going on!



Modified: branches/drbd-0.7/drbd/drbd_receiver.c
===================================================================
--- branches/drbd-0.7/drbd/drbd_receiver.c	2005-08-29 11:32:43 UTC (rev 1936)
+++ branches/drbd-0.7/drbd/drbd_receiver.c	2005-08-31 17:04:25 UTC (rev 1937)
@@ -934,7 +934,7 @@
 			 */
 		}
 		ok = drbd_send_ack(mdev,WriteAck,e);
-		__set_bit(SYNC_STARTED,&mdev->flags);
+		set_bit(SYNC_STARTED,&mdev->flags);
 	} else {
 		ok = drbd_send_ack(mdev,NegAck,e);
 		ok&= drbd_io_error(mdev);
@@ -2118,7 +2118,7 @@
 
 		if( is_syncer_blk(mdev,p->block_id)) {
 			drbd_set_in_sync(mdev,sector,blksize);
-			__set_bit(SYNC_STARTED,&mdev->flags);
+			set_bit(SYNC_STARTED,&mdev->flags);
 		} else {
 			req=(drbd_request_t*)(long)p->block_id;
 

From drbd-cvs at lists.linbit.com  Wed Aug 31 20:07:06 2005
From: drbd-cvs at lists.linbit.com (drbd-cvs@lists.linbit.com)
Date: Wed Aug 31 20:07:06 2005
Subject: [DRBD-cvs] r1938 - branches/drbd-0.7/drbd
Message-ID: <20050831180706.55B3A1435D@mail.linbit.com>

Author: lars
Date: 2005-08-31 20:07:05 +0200 (Wed, 31 Aug 2005)
New Revision: 1938

Modified:
   branches/drbd-0.7/drbd/drbd_proc.c
Log:

if syncer is stalled, show that in /proc/drbd



Modified: branches/drbd-0.7/drbd/drbd_proc.c
===================================================================
--- branches/drbd-0.7/drbd/drbd_proc.c	2005-08-31 17:04:25 UTC (rev 1937)
+++ branches/drbd-0.7/drbd/drbd_proc.c	2005-08-31 18:07:05 UTC (rev 1938)
@@ -146,6 +146,14 @@
 	 * rt: remaining time
 	 */
 	dt = (jiffies - mdev->rs_mark_time) / HZ;
+
+	if (dt > HZ*20) {
+		/* if we made no update to rs_mark_time for too long,
+		 * we are stalled. show that. */
+		seq_printf(seq, "stalled\n");
+		return;
+	}
+
 	if (!dt) dt++;
 	db = mdev->rs_mark_left - rs_left;
 	rt = (dt * (rs_left / (db/100+1)))/100; /* seconds */

