[DRBD-cvs] svn commit by lars - r2692 - trunk/drbd - if we decide to fail READA early, we need to fail it wi

drbd-cvs at lists.linbit.com drbd-cvs at lists.linbit.com
Mon Jan 15 10:41:52 CET 2007


Author: lars
Date: 2007-01-15 10:41:51 +0100 (Mon, 15 Jan 2007)
New Revision: 2692

Modified:
   trunk/drbd/drbd_req.c
Log:
if we decide to fail READA early, we need to fail it with "EAGAIN" aka EWOULDBLOCK.


Modified: trunk/drbd/drbd_req.c
===================================================================
--- trunk/drbd/drbd_req.c	2007-01-15 09:40:18 UTC (rev 2691)
+++ trunk/drbd/drbd_req.c	2007-01-15 09:41:51 UTC (rev 2692)
@@ -778,6 +778,7 @@
 	struct drbd_barrier *b = NULL;
 	drbd_request_t *req;
 	int local, remote;
+	int err = -EIO;
 
 	/* allocate outside of all locks; get a "reference count" (ap_bio_cnt)
 	 * to avoid races with the disconnect/reconnect code.  */
@@ -847,6 +848,7 @@
 	 *        if network is slow, READA won't do any good.
 	 */
 	if (rw == READA && mdev->state.disk >= Inconsistent && !local) {
+		err = -EWOULDBLOCK;
 		goto fail_and_free_req;
 	}
 
@@ -881,6 +883,7 @@
 		b = kmalloc(sizeof(struct drbd_barrier),GFP_NOIO);
 		if(!b) {
 			ERR("Failed to alloc barrier.");
+			err = -ENOMEM;
 			goto fail_and_free_req;
 		}
 	}
@@ -1023,7 +1026,7 @@
 
   fail_and_free_req:
 	if (b) kfree(b);
-	bio_endio(bio, bio->bi_size, -EIO);
+	bio_endio(bio, bio->bi_size, err);
 	drbd_req_free(req);
 	return 0;
 }



More information about the drbd-cvs mailing list