diff options
author | Philipp Reisner <philipp.reisner@linbit.com> | 2011-07-18 10:25:15 -0400 |
---|---|---|
committer | Philipp Reisner <philipp.reisner@linbit.com> | 2012-05-09 09:15:43 -0400 |
commit | fd2491f4a4a403b376f71a336a36848158efb0fe (patch) | |
tree | 7571481867dd5ab427541a377a885f3152994fa1 | |
parent | 79f16f5dbc95da372c25afddac80f4adef3cfce1 (diff) |
drbd: detach must not try to abort non-local requests from drbd-8.4
Cherry picked form 8.4
Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
-rw-r--r-- | drivers/block/drbd/drbd_main.c | 43 |
1 files changed, 34 insertions, 9 deletions
diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c index 0ee05315f9ac..56569a803331 100644 --- a/drivers/block/drbd/drbd_main.c +++ b/drivers/block/drbd/drbd_main.c | |||
@@ -344,7 +344,7 @@ bail: | |||
344 | * @what: The action/event to perform with all request objects | 344 | * @what: The action/event to perform with all request objects |
345 | * | 345 | * |
346 | * @what might be one of connection_lost_while_pending, resend, fail_frozen_disk_io, | 346 | * @what might be one of connection_lost_while_pending, resend, fail_frozen_disk_io, |
347 | * restart_frozen_disk_io, abort_disk_io. | 347 | * restart_frozen_disk_io. |
348 | */ | 348 | */ |
349 | static void _tl_restart(struct drbd_conf *mdev, enum drbd_req_event what) | 349 | static void _tl_restart(struct drbd_conf *mdev, enum drbd_req_event what) |
350 | { | 350 | { |
@@ -368,12 +368,6 @@ static void _tl_restart(struct drbd_conf *mdev, enum drbd_req_event what) | |||
368 | } | 368 | } |
369 | tmp = b->next; | 369 | tmp = b->next; |
370 | 370 | ||
371 | if (what == abort_disk_io) { | ||
372 | /* Only walk the TL, leave barrier objects in place */ | ||
373 | b = tmp; | ||
374 | continue; | ||
375 | } | ||
376 | |||
377 | if (n_writes) { | 371 | if (n_writes) { |
378 | if (what == resend) { | 372 | if (what == resend) { |
379 | b->n_writes = n_writes; | 373 | b->n_writes = n_writes; |
@@ -422,7 +416,6 @@ static void _tl_restart(struct drbd_conf *mdev, enum drbd_req_event what) | |||
422 | /* Actions operating on the disk state, also want to work on | 416 | /* Actions operating on the disk state, also want to work on |
423 | requests that got barrier acked. */ | 417 | requests that got barrier acked. */ |
424 | switch (what) { | 418 | switch (what) { |
425 | case abort_disk_io: | ||
426 | case fail_frozen_disk_io: | 419 | case fail_frozen_disk_io: |
427 | case restart_frozen_disk_io: | 420 | case restart_frozen_disk_io: |
428 | list_for_each_safe(le, tle, &mdev->barrier_acked_requests) { | 421 | list_for_each_safe(le, tle, &mdev->barrier_acked_requests) { |
@@ -483,6 +476,38 @@ void tl_restart(struct drbd_conf *mdev, enum drbd_req_event what) | |||
483 | } | 476 | } |
484 | 477 | ||
485 | /** | 478 | /** |
479 | * tl_abort_disk_io() - Abort disk I/O for all requests for a certain mdev in the TL | ||
480 | * @mdev: DRBD device. | ||
481 | */ | ||
482 | void tl_abort_disk_io(struct drbd_conf *mdev) | ||
483 | { | ||
484 | struct drbd_tl_epoch *b; | ||
485 | struct list_head *le, *tle; | ||
486 | struct drbd_request *req; | ||
487 | |||
488 | spin_lock_irq(&mdev->req_lock); | ||
489 | b = mdev->oldest_tle; | ||
490 | while (b) { | ||
491 | list_for_each_safe(le, tle, &b->requests) { | ||
492 | req = list_entry(le, struct drbd_request, tl_requests); | ||
493 | if (!(req->rq_state & RQ_LOCAL_PENDING)) | ||
494 | continue; | ||
495 | _req_mod(req, abort_disk_io); | ||
496 | } | ||
497 | b = b->next; | ||
498 | } | ||
499 | |||
500 | list_for_each_safe(le, tle, &mdev->barrier_acked_requests) { | ||
501 | req = list_entry(le, struct drbd_request, tl_requests); | ||
502 | if (!(req->rq_state & RQ_LOCAL_PENDING)) | ||
503 | continue; | ||
504 | _req_mod(req, abort_disk_io); | ||
505 | } | ||
506 | |||
507 | spin_unlock_irq(&mdev->req_lock); | ||
508 | } | ||
509 | |||
510 | /** | ||
486 | * cl_wide_st_chg() - true if the state change is a cluster wide one | 511 | * cl_wide_st_chg() - true if the state change is a cluster wide one |
487 | * @mdev: DRBD device. | 512 | * @mdev: DRBD device. |
488 | * @os: old (current) state. | 513 | * @os: old (current) state. |
@@ -1577,7 +1602,7 @@ static void after_state_ch(struct drbd_conf *mdev, union drbd_state os, | |||
1577 | 1602 | ||
1578 | /* Immediately allow completion of all application IO, that waits | 1603 | /* Immediately allow completion of all application IO, that waits |
1579 | for completion from the local disk. */ | 1604 | for completion from the local disk. */ |
1580 | tl_restart(mdev, abort_disk_io); | 1605 | tl_abort_disk_io(mdev); |
1581 | 1606 | ||
1582 | /* current state still has to be D_FAILED, | 1607 | /* current state still has to be D_FAILED, |
1583 | * there is only one way out: to D_DISKLESS, | 1608 | * there is only one way out: to D_DISKLESS, |