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> --- 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 7604b3c8d644..9f2e55df2904 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) @@ -2695,7 +2700,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); } /* -- 2.43.5 _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel