[Devel] [RFC PATCH vz9 v6 42/62] dm-ploop: properly end pios attached to piwb pios

Alexander Atanasov alexander.atanasov at virtuozzo.com
Fri Dec 6 00:56:15 MSK 2024


Fix a bug in ploop_data_pio_end.

If piwb is already completed, which can happen if we attach
a flush pio to it, pio is not added to the list and ploop_pio_endio
is never called on it. This results in a hang since pio is never completed.

Avoid this by calling ploop_pio_endio directly in case piwb is
already completed.

https://virtuozzo.atlassian.net/browse/VSTOR-91821
Signed-off-by: Alexander Atanasov <alexander.atanasov at virtuozzo.com>
---
 drivers/md/dm-ploop-map.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c
index 6192ddca3693..276e8cf3b178 100644
--- a/drivers/md/dm-ploop-map.c
+++ b/drivers/md/dm-ploop-map.c
@@ -1204,6 +1204,9 @@ static bool ploop_data_pio_end(struct pio *pio)
 	else if (!pio->bi_status)
 		pio->bi_status = piwb->bi_status;
 	spin_unlock_irqrestore(&piwb->lock, flags);
+	/* If pio is late then end it here. this can happen with flushes */
+	if (completed)
+		ploop_pio_endio(pio);
 
 	ploop_put_piwb(piwb);
 
-- 
2.43.0



More information about the Devel mailing list