[Devel] [PATCH rh7] ploop: fix counting bio_qlen

Maxim Patlasov mpatlasov at virtuozzo.com
Thu Jun 16 16:50:55 PDT 2016


The commit ec1eeb868 (May 22 2015) ported "separate queue for discard bio"
patch from RHEL6-based kernel incorrectly. Original patch stated clearly
that if we want to decrement bio_discard_qlen, bio_qlen must not change:

@@ -500,7 +502,7 @@ ploop_bio_queue(struct ploop_device * pl
                    (err = ploop_discard_add_bio(plo->fbd, bio))) {
                        BIO_ENDIO(bio, err);
                        list_add(&preq->list, &plo->free_list);
-                       plo->bio_qlen--;
+                       plo->bio_discard_qlen--;
                        plo->bio_total--;
                        return;
                }

but that port did the opposite:

@@ -521,6 +523,7 @@ ploop_bio_queue(struct ploop_device * plo, struct bio * bio,
                        BIO_ENDIO(plo->queue, bio, err);
                        list_add(&preq->list, &plo->free_list);
                        plo->bio_qlen--;
+                       plo->bio_discard_qlen--;
                        plo->bio_total--;
                        return;
                }

Signed-off-by: Maxim Patlasov <mpatlasov at virtuozzo.com>
---
 drivers/block/ploop/dev.c |    1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/block/ploop/dev.c b/drivers/block/ploop/dev.c
index db55be3..e1fbfcf 100644
--- a/drivers/block/ploop/dev.c
+++ b/drivers/block/ploop/dev.c
@@ -523,7 +523,6 @@ ploop_bio_queue(struct ploop_device * plo, struct bio * bio,
 			}
 			BIO_ENDIO(plo->queue, bio, err);
 			list_add(&preq->list, &plo->free_list);
-			plo->bio_qlen--;
 			plo->bio_discard_qlen--;
 			plo->bio_total--;
 			return;



More information about the Devel mailing list