[Devel] [PATCH RHEL9 COMMIT] dm-ploop: do not (endless) resubmit zero length partial IO

Konstantin Khorenko khorenko at virtuozzo.com
Tue Jun 18 19:26:02 MSK 2024


The commit is pushed to "branch-rh9-5.14.0-425.vz9.60.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh9-5.14.0-425.vz9.60.5
------>
commit 34797f07906ae636cebcfb852e3b9ac69cf3c28f
Author: Alexander Atanasov <alexander.atanasov at virtuozzo.com>
Date:   Thu Jun 13 16:38:46 2024 +0300

    dm-ploop: do not (endless) resubmit zero length partial IO
    
    If a pio terminates with 0 bytes dm-ploop resubmits that pio
    advanced zero bytes which again results in zero lenght IO.
    To avoid that terminate such case with EIO - as this could
    only happen as a result of a BUG choose the error so that
    any potential damage is prevented.
    
    https://virtuozzo.atlassian.net/browse/PSBM-156506
    Signed-off-by: Alexander Atanasov <alexander.atanasov at virtuozzo.com>
    
    Feature: dm-ploop: ploop target driver
---
 drivers/md/dm-ploop-map.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c
index ea04b3e53567..33aac1a69fdf 100644
--- a/drivers/md/dm-ploop-map.c
+++ b/drivers/md/dm-ploop-map.c
@@ -1202,15 +1202,21 @@ static void ploop_data_rw_complete(struct pio *pio)
 		if (pio->ret >= 0) {
 			/* Partial IO */
 			WARN_ON_ONCE(pio->ret == 0);
-			ploop_pio_advance(pio, pio->ret);
-			ploop_queue_resubmit(pio);
-			return;
+			/* Do not resubmit zero length pio */
+			if (pio->ret > 0) {
+				ploop_pio_advance(pio, pio->ret);
+				ploop_queue_resubmit(pio);
+				return;
+			} else {
+				pio->bi_status = BLK_STS_IOERR;
+				goto check_da;
+			}
 		}
 		if (static_branch_unlikely(&ploop_standby_check))
 			ploop_check_standby_mode(pio->ploop, pio->ret);
 		pio->bi_status = errno_to_blk_status(pio->ret);
 	}
-
+check_da:
 	if (pio->is_data_alloc) {
 		completed = ploop_data_pio_end(pio);
 		if (!completed)


More information about the Devel mailing list