[Devel] [PATCH rh7] ploop: Also decrement active_reqs before bio_endio() in ploop_complete_request()
Kirill Tkhai
ktkhai at virtuozzo.com
Tue Jun 25 12:15:25 MSK 2019
This is needed for ploop_ioctl() debug hook correct work.
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
drivers/block/ploop/dev.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/drivers/block/ploop/dev.c b/drivers/block/ploop/dev.c
index 10b4abc00592..64d205e691ba 100644
--- a/drivers/block/ploop/dev.c
+++ b/drivers/block/ploop/dev.c
@@ -1344,6 +1344,15 @@ static void ploop_complete_request(struct ploop_request * preq)
__TRACE("Z %p %u\n", preq, preq->req_cluster);
+ /*
+ * Decrement active_reqs before BIO_IOEND() to make
+ * a hook in ploop_stop() work properly. This is
+ * mostly needed for debug purposes.
+ */
+ spin_lock_irq(&plo->lock);
+ plo->active_reqs--;
+ spin_unlock_irq(&plo->lock);
+
while (preq->bl.head) {
struct bio * bio = preq->bl.head;
preq->bl.head = bio->bi_next;
@@ -1382,7 +1391,6 @@ static void ploop_complete_request(struct ploop_request * preq)
if (!list_empty(&preq->delay_list))
list_splice_init(&preq->delay_list, plo->ready_queue.prev);
- plo->active_reqs--;
preq->eng_state = PLOOP_E_ENTRY;
ploop_entry_add(plo, preq);
@@ -1437,8 +1445,6 @@ static void ploop_complete_request(struct ploop_request * preq)
preq->preq_ub = NULL;
#endif
- plo->active_reqs--;
-
if (unlikely(test_bit(PLOOP_REQ_ZERO, &preq->state))) {
ploop_fb_put_zero_request(plo->fbd, preq);
} else {
More information about the Devel
mailing list