[DRBD-cvs] svn commit by phil - r2540 - 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 16:47:16 CEST 2006


Author: phil
Date: 2006-10-17 16:47:14 +0200 (Tue, 17 Oct 2006)
New Revision: 2540

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

* Fixed the return code of e_end_resync_block()
* Moved the drbd_sync_me() out of the after_state_ch() function to
  avoid deadlocks.
* Ingore it when the resync timer fires unexpectedly, this can happen
  if we abort a resync due to an IO error.
* In the state santitising code: Also recognise an aborted resync
  on the SyncSource node.
* drbd_send_ack_dp() sent the size with the wrong endianess!



Modified: trunk/drbd/drbd_main.c
===================================================================
--- trunk/drbd/drbd_main.c	2006-10-17 10:55:37 UTC (rev 2539)
+++ trunk/drbd/drbd_main.c	2006-10-17 14:47:14 UTC (rev 2540)
@@ -668,7 +668,7 @@
 		ns.pdsk = DUnknown;
 	}
 
-	if( ns.conn > Connected && ns.disk <= Failed ) {
+	if( ns.conn > Connected && (ns.disk <= Failed || ns.pdsk <= Failed )) {
 		warn_sync_abort=1;
 		ns.conn = Connected;
 	}
@@ -1027,8 +1027,6 @@
 	}
 
 	if ( os.disk > Diskless && ns.disk == Diskless ) {
-		drbd_sync_me(mdev);
-
 		/* since inc_local() only works as long as disk>=Inconsistent,
 		   and it is Diskless here, local_cnt can only go down, it can
 		   not increase... It will reach zero */
@@ -1501,7 +1499,8 @@
 	const int header_size = sizeof(Drbd_Data_Packet) - sizeof(Drbd_Header);
 	int data_size  = ((Drbd_Header*)dp)->length - header_size;
 
-	return _drbd_send_ack(mdev,cmd,dp->sector,data_size,dp->block_id);
+	return _drbd_send_ack(mdev,cmd,dp->sector,cpu_to_be32(data_size),
+			      dp->block_id);
 }
 
 int drbd_send_ack_rp(drbd_dev *mdev, Drbd_Packet_Cmd cmd, 

Modified: trunk/drbd/drbd_nl.c
===================================================================
--- trunk/drbd/drbd_nl.c	2006-10-17 10:55:37 UTC (rev 2539)
+++ trunk/drbd/drbd_nl.c	2006-10-17 14:47:14 UTC (rev 2540)
@@ -922,6 +922,7 @@
 STATIC int drbd_nl_detach(drbd_dev *mdev, struct drbd_nl_cfg_req *nlp,
 			  struct drbd_nl_cfg_reply *reply)
 {
+	drbd_sync_me(mdev);
 	reply->ret_code = drbd_request_state(mdev,NS(disk,Diskless));
 
 	return 0;

Modified: trunk/drbd/drbd_receiver.c
===================================================================
--- trunk/drbd/drbd_receiver.c	2006-10-17 10:55:37 UTC (rev 2539)
+++ trunk/drbd/drbd_receiver.c	2006-10-17 14:47:14 UTC (rev 2540)
@@ -1031,22 +1031,8 @@
 	 * FIXME because ... */
 	drbd_rs_complete_io(mdev,sector);
 	if (likely( drbd_bio_uptodate(e->private_bio) )) {
-		/* "optimization" only...  state could still change anytime
-		 * while we are calling drbd_set_in_sync */
-		ok = mdev->state.disk >= Inconsistent &&
-			mdev->state.pdsk >= Inconsistent;
-		if (likely( ok )) {
-			drbd_set_in_sync(mdev, sector, e->size);
-			ok = drbd_send_ack(mdev,WriteAck,e);
-		} else {
-			/* FIXME think:
-			 * send a WriteAck anyways?
-			 * send a NegAck?
-			 * just ignore it?  (ignoring it is valid, peer has no
-			 * structs referencing this) */
-		}
-		/* FIXME what exactly do we need this flag for, again??
-		 * and why do we set it only in the "up-to-date" branch? */
+		drbd_set_in_sync(mdev, sector, e->size);
+		ok = drbd_send_ack(mdev,WriteAck,e);
 		set_bit(SYNC_STARTED,&mdev->flags);
 	} else {
 		// Record failure to sync
@@ -3026,7 +3012,7 @@
 	 */
 	if(is_syncer_block_id(p->block_id)) {
 		sector_t sector = be64_to_cpu(p->sector);
-		unsigned long size = be32_to_cpu(p->blksize);
+		int size = be32_to_cpu(p->blksize);
 
 		dec_rs_pending(mdev);
 
@@ -3167,7 +3153,10 @@
 		}
 
 		while(1) {
-			if (!drbd_process_done_ee(mdev)) goto err;
+			if (!drbd_process_done_ee(mdev)) {
+				ERR("process_done_ee() = NOT_OK\n");
+				goto err;
+			}
 			set_bit(SIGNAL_ASENDER, &mdev->flags);
 			spin_lock_irq(&mdev->req_lock);
 			empty = list_empty(&mdev->done_ee);

Modified: trunk/drbd/drbd_worker.c
===================================================================
--- trunk/drbd/drbd_worker.c	2006-10-17 10:55:37 UTC (rev 2539)
+++ trunk/drbd/drbd_worker.c	2006-10-17 14:47:14 UTC (rev 2540)
@@ -226,7 +226,7 @@
 {
 	ERR_IF(cancel) return 1;
 	ERR("resync inactive, but callback triggered??\n");
-	return 0;
+	return 1; // Simply ignore this!
 }
 
 /* for debug assertion only */



More information about the drbd-cvs mailing list