[DRBD-cvs] svn commit by phil - r2916 - branches/drbd-8.0/drbd - Patch suggested by Ernest. I changed it to Linux coding

drbd-cvs at lists.linbit.com drbd-cvs at lists.linbit.com
Tue Jun 12 16:39:07 CEST 2007


Author: phil
Date: 2007-06-12 16:39:06 +0200 (Tue, 12 Jun 2007)
New Revision: 2916

Modified:
   branches/drbd-8.0/drbd/drbd_nl.c
Log:
Patch suggested by Ernest. I changed it to Linux coding style,
and shortened it a bit.


Modified: branches/drbd-8.0/drbd/drbd_nl.c
===================================================================
--- branches/drbd-8.0/drbd/drbd_nl.c	2007-06-08 09:48:01 UTC (rev 2915)
+++ branches/drbd-8.0/drbd/drbd_nl.c	2007-06-12 14:39:06 UTC (rev 2916)
@@ -676,7 +676,7 @@
 	struct inode *inode, *inode2;
 	struct lru_cache* resync_lru = NULL;
 	drbd_state_t ns,os;
-	int rv;
+	int rv,ntries=0;
 
 	/* if you want to reconfigure, please tear down first */
 	if (mdev->state.disk > Diskless) {
@@ -684,6 +684,20 @@
 		goto fail;
 	}
 
+       /* 
+        * We may have gotten here very quickly from a detach. Wait for a bit
+        * then fail.
+        */
+	while(mdev->bc != NULL) {
+		if(ntries++ >= 5) {
+			WARN("drbd_nl_disk_conf: mdev->bc not NULL.\n");
+			retcode=HaveDiskConfig;
+			goto fail;
+		}
+		set_current_state(TASK_INTERRUPTIBLE);
+		schedule_timeout(HZ/10);
+	}
+
 	nbc = kmalloc(sizeof(struct drbd_backing_dev),GFP_KERNEL);
 	if(!nbc) {
 		retcode=KMallocFailed;



More information about the drbd-cvs mailing list