[DRBD-cvs] drbd by phil; Fixed two 'brown paper bag' bugs, pointe...

drbd-user@lists.linbit.com drbd-user@lists.linbit.com
Wed, 7 Apr 2004 09:45:18 +0200 (CEST)


DRBD CVS committal

Author  : phil
Module  : drbd

Dir     : drbd/drbd


Modified Files:
      Tag: rel-0_7-branch
	drbd_req-2.4.c 


Log Message:
Fixed two 'brown paper bag' bugs, pointed out by LGE

* Double call to drbd_bio_endio().
* drbd_set_in_sync() was too early in the code path.

===================================================================
RCS file: /var/lib/cvs/drbd/drbd/drbd/drbd_req-2.4.c,v
retrieving revision 1.33.2.63
retrieving revision 1.33.2.64
diff -u -3 -r1.33.2.63 -r1.33.2.64
--- drbd_req-2.4.c	6 Apr 2004 14:07:00 -0000	1.33.2.63
+++ drbd_req-2.4.c	7 Apr 2004 07:45:13 -0000	1.33.2.64
@@ -82,26 +82,24 @@
 		}
 	}
 
-	if(mdev->conf.wire_protocol==DRBD_PROT_C && mdev->cstate > Connected) {
-		drbd_set_in_sync(mdev,rsector,drbd_req_get_size(req));
-	}
-
 	uptodate = req->rq_status & 0x0001;
 	if( !uptodate && mdev->on_io_error == Detach) {
 		drbd_set_out_of_sync(mdev,rsector, drbd_req_get_size(req));
 		// It should also be as out of sync on 
 		// the other side!  See w_io_error()
 
-		drbd_bio_endio(req->master_bio,uptodate);
-		// The assumption is that we wrote it on the peer.
-
 		drbd_bio_endio(req->master_bio,1);
+		// The assumption is that we wrote it on the peer.
 
 		req->w.cb = w_io_error;
 		drbd_queue_work(mdev,&mdev->data.work,&req->w);
 
 		goto out;
 
+	}
+
+	if(mdev->conf.wire_protocol==DRBD_PROT_C && mdev->cstate > Connected) {
+		drbd_set_in_sync(mdev,rsector,drbd_req_get_size(req));
 	}
 
 	drbd_bio_endio(req->master_bio,uptodate);