drbd: Consider that read requests could be NEG_ACKEDed
authorPhilipp Reisner <philipp.reisner@linbit.com>
Tue, 13 Dec 2011 10:36:57 +0000 (11:36 +0100)
committerPhilipp Reisner <philipp.reisner@linbit.com>
Thu, 8 Nov 2012 15:58:12 +0000 (16:58 +0100)
ap_in_flight only counts writes. NEG_ACKED is an action
on a request that might be called for reads and writes.

This bug was there forever, but it becomes much more
relevant with the read balincing code.

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
drivers/block/drbd/drbd_req.c

index b1957d6c8bf57bf7583c18a0c779aa1b13644bf3..cf3c10e23c509b5b5b51a5fd71e9c4f7673d19f2 100644 (file)
@@ -628,7 +628,8 @@ int __req_mod(struct drbd_request *req, enum drbd_req_event what,
                /* assert something? */
                if (req->rq_state & RQ_NET_PENDING) {
                        dec_ap_pending(mdev);
-                       atomic_sub(req->i.size >> 9, &mdev->ap_in_flight);
+                       if (req->rq_state & RQ_WRITE)
+                               atomic_sub(req->i.size >> 9, &mdev->ap_in_flight);
                }
                req->rq_state &= ~(RQ_NET_OK|RQ_NET_PENDING);