drbd: detach must not try to abort non-local requests

Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index 2090b78..edd0227 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -501,6 +501,8 @@
 	while (b) {
 		list_for_each_safe(le, tle, &b->requests) {
 			req = list_entry(le, struct drbd_request, tl_requests);
+			if (!(req->rq_state & RQ_LOCAL_PENDING))
+				continue;
 			if (req->w.mdev == mdev)
 				_req_mod(req, ABORT_DISK_IO);
 		}
@@ -509,6 +511,8 @@
 
 	list_for_each_safe(le, tle, &tconn->barrier_acked_requests) {
 		req = list_entry(le, struct drbd_request, tl_requests);
+		if (!(req->rq_state & RQ_LOCAL_PENDING))
+			continue;
 		if (req->w.mdev == mdev)
 			_req_mod(req, ABORT_DISK_IO);
 	}