[Devel] [PATCH RH8] dm-ploop: Fix race in put_piwb()

Kirill Tkhai ktkhai at virtuozzo.com
Fri Aug 27 18:32:12 MSK 2021


We need update comp_bi_status before completion.
Otherwise, completion-waiter reads status before
we updated it.

https://jira.sw.ru/browse/PSBM-133509

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 drivers/md/dm-ploop-map.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/dm-ploop-map.c b/drivers/md/dm-ploop-map.c
index a3f63c238198..16c70ec6901c 100644
--- a/drivers/md/dm-ploop-map.c
+++ b/drivers/md/dm-ploop-map.c
@@ -853,9 +853,9 @@ static void put_piwb(struct ploop_index_wb *piwb)
 			ploop_advance_local_after_bat_wb(ploop, piwb, false);
 
 		if (piwb->comp) {
-			complete(piwb->comp);
 			if (piwb->comp_bi_status)
 				*piwb->comp_bi_status = piwb->bi_status;
+			complete(piwb->comp);
 		}
 		free_piwb(piwb);
 	}




More information about the Devel mailing list