The commit is pushed to "branch-rh9-5.14.0-427.55.1.vz9.82.x-ovz" and will 
appear at g...@bitbucket.org:openvz/vzkernel.git
after rh9-5.14.0-427.55.1.vz9.82.8
------>
commit 3f9825c0e19b04584cbd9b0f6fa31d82e30ddefc
Author: Andrey Zhadchenko <andrey.zhadche...@virtuozzo.com>
Date:   Wed Jul 16 12:37:53 2025 +0300

    dm-ploop: decrease inflight number after pio endio
    
    We do not increase inflight number when we chain pios, so we should
    decrease inflight only after all chained pios are also completed,
    e.g. pio->remaining is zero, and file is flushed if needed.
    
    https://virtuozzo.atlassian.net/browse/VSTOR-108540
    Signed-off-by: Andrey Zhadchenko <andrey.zhadche...@virtuozzo.com>
    Reviewed-by: Pavel Tikhomirov <ptikhomi...@virtuozzo.com>
    
    Feature: dm-ploop: ploop target driver
    
    ======
    Patchset description:
    dm-ploop: improve pio submission suspension
    
    Recently we encountered EBUSY errors while trying to resize ploop
    devices under load. This mostly happens because we are not waiting
    in-progess IO correctly:
     - initial pio is removed from inflight even if its split pios are
       still running
     - there is no wait for metadata writeback
    
    This patchset fixes that by moving inflight decrease later and
    introducing new counter for inflight metadata writeback.
    
    Note that for dm-qcow2 patches are not needed: it does not have
    delayed metadata writeback and inflight counters are decreased
    correctly at the time of endio_cb.
    
    https://virtuozzo.atlassian.net/browse/VSTOR-108540
---
 drivers/md/dm-ploop-map.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c
index f717967a8bde1..5648549d61546 100644
--- a/drivers/md/dm-ploop-map.c
+++ b/drivers/md/dm-ploop-map.c
@@ -214,6 +214,8 @@ static void ploop_prq_endio(struct pio *pio, void *prq_ptr,
        dm_complete_request(rq, bi_status);
 }
 
+static void ploop_dec_nr_inflight(struct ploop *ploop, struct pio *pio);
+
 static void ploop_wrkr_pio_endio(struct pio *pio)
 {
        ploop_endio_t endio_cb = pio->endio_cb;
@@ -223,6 +225,8 @@ static void ploop_wrkr_pio_endio(struct pio *pio)
 
        file = ploop_top_delta(pio->ploop)->file;
        vfs_fsync(file, 1);
+
+       ploop_dec_nr_inflight(pio->ploop, pio);
        endio_cb(pio, endio_cb_data, pio->bi_status);
        if (free_on_endio) {
                ploop_free_pio(pio->ploop, pio);
@@ -245,6 +249,7 @@ static void ploop_do_pio_endio(struct pio *pio)
                return;
        }
 
+       ploop_dec_nr_inflight(pio->ploop, pio);
        endio_cb(pio, endio_cb_data, pio->bi_status);
 
        if (free_on_endio)
@@ -2698,7 +2703,6 @@ static void ploop_handle_cleanup(struct ploop *ploop, 
struct pio *pio)
                ploop_discard_index_pio_end(ploop, pio);
 
        ploop_unlink_completed_pio(ploop, pio);
-       ploop_dec_nr_inflight(ploop, pio);
 }
 
 /*
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to