[DRBD-cvs] svn commit by phil - r2542 - trunk/drbd - Fixed a number of bugs in the code pathes that handle I

drbd-cvs at lists.linbit.com drbd-cvs at lists.linbit.com
Tue Oct 17 19:39:58 CEST 2006


Author: phil
Date: 2006-10-17 19:39:57 +0200 (Tue, 17 Oct 2006)
New Revision: 2542

Modified:
   trunk/drbd/drbd_actlog.c
   trunk/drbd/drbd_receiver.c
   trunk/drbd/drbd_req.c
Log:
Fixed a number of bugs in the code pathes that handle IO errors.

* We should only set_out_of_sync if the peer is diskless in receive_data() !

* Moved the set_in_sync() from got_BlockAck() to _req_may_be_done().
 


Modified: trunk/drbd/drbd_actlog.c
===================================================================
--- trunk/drbd/drbd_actlog.c	2006-10-17 15:43:30 UTC (rev 2541)
+++ trunk/drbd/drbd_actlog.c	2006-10-17 17:39:57 UTC (rev 2542)
@@ -645,9 +645,10 @@
 			else
 				ext->rs_failed += count;
 			if (ext->rs_left < ext->rs_failed) {
-				ERR("BAD! sector=%lu enr=%u rs_left=%d rs_failed=%d count=%d\n",
-				     (unsigned long)sector,
+				ERR("BAD! sector=%llu enr=%u rs_left=%d rs_failed=%d count=%d\n",
+				     (unsigned long long)sector,
 				     ext->lce.lc_number, ext->rs_left, ext->rs_failed, count);
+				dump_stack();
 				// FIXME brrrgs. should never happen!
 				drbd_force_state(mdev,NS(conn,Disconnecting));
 				return;
@@ -715,6 +716,7 @@
 	unsigned long count = 0;
 	sector_t esector, nr_sectors;
 	int wake_up=0;
+	unsigned long flags;
 
 	if (size <= 0 || (size & 0x1ff) != 0 || size > DRBD_MAX_SEGMENT_SIZE) {
 		ERR("drbd_set_in_sync: sector=%lu size=%d nonsense!\n",
@@ -752,7 +754,7 @@
 	 * ok, (capacity & 7) != 0 sometimes, but who cares...
 	 * we count rs_{total,left} in bits, not sectors.
 	 */
-	spin_lock_irq(&mdev->al_lock);
+	spin_lock_irqsave(&mdev->al_lock,flags);
 	for(bnr=sbnr; bnr <= ebnr; bnr++) {
 		if (drbd_bm_clear_bit(mdev,bnr)) count++;
 	}
@@ -770,7 +772,7 @@
 		 * various lc_chaged(), lc_put() in drbd_try_clear_on_disk_bm(). */
 		wake_up=1;
 	}
-	spin_unlock_irq(&mdev->al_lock);
+	spin_unlock_irqrestore(&mdev->al_lock,flags);
 	if(wake_up) wake_up(&mdev->al_wait);
 }
 
@@ -786,6 +788,24 @@
 	unsigned long sbnr,ebnr,lbnr;
 	sector_t esector, nr_sectors;
 
+	/*  Find codepoints that call set_out_of_sync()  
+	unsigned long flags;
+	unsigned int enr;
+	struct bm_extent* ext;
+
+	if(inc_local(mdev)) {
+		enr = BM_SECT_TO_EXT(sector);
+		spin_lock_irqsave(&mdev->al_lock,flags);
+		ext = (struct bm_extent *) lc_find(mdev->resync,enr);
+		if (ext) {
+			WARN("BAD! things will happen, find this.\n");
+			dump_stack();
+		}
+		spin_unlock_irqrestore(&mdev->al_lock,flags);
+		dec_local(mdev);
+	}
+	*/
+
 	if (size <= 0 || (size & 0x1ff) != 0 || size > DRBD_MAX_SEGMENT_SIZE) {
 		ERR("sector: %lu, size: %d\n",(unsigned long)sector,size);
 		return;

Modified: trunk/drbd/drbd_receiver.c
===================================================================
--- trunk/drbd/drbd_receiver.c	2006-10-17 15:43:30 UTC (rev 2541)
+++ trunk/drbd/drbd_receiver.c	2006-10-17 17:39:57 UTC (rev 2542)
@@ -1468,7 +1468,7 @@
 		break;
 	}
 
-	if(mdev->state.pdsk <= Inconsistent) {
+	if(mdev->state.pdsk == Diskless) {
 		// In case we have the only disk of the cluster, 
 		drbd_set_out_of_sync(mdev,e->sector,e->size);
 		e->flags |= CALL_AL_COMPLETE_IO;
@@ -2979,10 +2979,6 @@
 				 ? write_acked_by_peer
 				 : recv_acked_by_peer);
 			spin_unlock_irq(&mdev->req_lock);
-
-			if (test_bit(SYNC_STARTED,&mdev->flags) &&
-			    mdev->net_conf->wire_protocol == DRBD_PROT_C)
-				drbd_set_in_sync(mdev,sector,blksize);
 		}
 	}
 

Modified: trunk/drbd/drbd_req.c
===================================================================
--- trunk/drbd/drbd_req.c	2006-10-17 15:43:30 UTC (rev 2541)
+++ trunk/drbd/drbd_req.c	2006-10-17 17:39:57 UTC (rev 2542)
@@ -213,6 +213,12 @@
 			if (!(s & RQ_NET_OK) || !(s & RQ_LOCAL_OK)) {
 				drbd_set_out_of_sync(mdev,req->sector,req->size);
 			}
+
+			if( (s & RQ_NET_OK) && (s & RQ_LOCAL_OK) && 
+			    test_bit(SYNC_STARTED,&mdev->flags) ) {
+				drbd_set_in_sync(mdev,req->sector,req->size);
+			}
+
 			if (s & RQ_LOCAL_MASK) {
 				drbd_al_complete_io(mdev, req->sector);
 			}



More information about the drbd-cvs mailing list