[DRBD-cvs] svn commit by phil - r2374 - trunk/drbd - The fix for another issue found by Simon Graham. It see

drbd-cvs at lists.linbit.com drbd-cvs at lists.linbit.com
Wed Aug 16 16:03:41 CEST 2006


Author: phil
Date: 2006-08-16 16:03:40 +0200 (Wed, 16 Aug 2006)
New Revision: 2374

Modified:
   trunk/drbd/drbd_int.h
   trunk/drbd/drbd_req.c
   trunk/drbd/drbd_worker.c
Log:
The fix for another issue found by Simon Graham.

It seems that under some conditions it is possible that the
ACK for a packet comes in even before the drbd_send_dblock()
functions returns. This leads to a crash, probably when 
__bio_for_each_segment() wants to exit its loop the bio
it works on is already free()d.

This patch fixes this.


Modified: trunk/drbd/drbd_int.h
===================================================================
--- trunk/drbd/drbd_int.h	2006-08-15 12:24:33 UTC (rev 2373)
+++ trunk/drbd/drbd_int.h	2006-08-16 14:03:40 UTC (rev 2374)
@@ -233,9 +233,9 @@
 #define RQ_DRBD_NOTHING	  0x0001
 #define RQ_DRBD_SENT      0x0010   // We got an ack
 #define RQ_DRBD_LOCAL     0x0020   // We wrote it to the local disk
-#define RQ_DRBD_DONE      0x0030   // We are done ;)
 #define RQ_DRBD_IN_TL     0x0040   // Set when it is in the TL
 #define RQ_DRBD_ON_WIRE   0x0080   // Set as soon as it is on the socket...
+#define RQ_DRBD_DONE      ( RQ_DRBD_SENT + RQ_DRBD_LOCAL + RQ_DRBD_ON_WIRE )
 
 /* drbd_meta-data.c (still in drbd_main.c) */
 #define DRBD_MD_MAGIC (DRBD_MAGIC+4) // 4th incarnation of the disk layout.

Modified: trunk/drbd/drbd_req.c
===================================================================
--- trunk/drbd/drbd_req.c	2006-08-15 12:24:33 UTC (rev 2373)
+++ trunk/drbd/drbd_req.c	2006-08-16 14:03:40 UTC (rev 2374)
@@ -341,7 +341,7 @@
 	if (!local)
 		req->rq_status |= RQ_DRBD_LOCAL;
 	if (!remote)
-		req->rq_status |= RQ_DRBD_SENT;
+		req->rq_status |= RQ_DRBD_SENT | RQ_DRBD_ON_WIRE;
 
 	/* we need to plug ALWAYS since we possibly need to kick lo_dev */
 	drbd_plug_device(mdev);

Modified: trunk/drbd/drbd_worker.c
===================================================================
--- trunk/drbd/drbd_worker.c	2006-08-15 12:24:33 UTC (rev 2373)
+++ trunk/drbd/drbd_worker.c	2006-08-16 14:03:40 UTC (rev 2374)
@@ -564,12 +564,10 @@
 
 	ok = drbd_send_dblock(mdev,req);
 	if (ok) {
-		spin_lock_irq(&mdev->req_lock);
-		req->rq_status |= RQ_DRBD_ON_WIRE;
-		spin_unlock_irq(&mdev->req_lock);
-
 		inc_ap_pending(mdev);
 
+		drbd_end_req(req,RQ_DRBD_ON_WIRE,1,drbd_req_get_sector(req));
+
 		if(mdev->net_conf->wire_protocol == DRBD_PROT_A) {
 			dec_ap_pending(mdev);
 			drbd_end_req(req, RQ_DRBD_SENT, 1, 



More information about the drbd-cvs mailing list