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

Konstantin Khorenko khorenko at virtuozzo.com
Fri Aug 27 20:18:31 MSK 2021


The commit is pushed to "branch-rh8-4.18.0-305.3.1.vz8.7.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-305.3.1.vz8.7.10
------>
commit f00285a72e6c1e9520f4087f8a4921202bc3766f
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Fri Aug 27 20:18:31 2021 +0300

    dm-ploop: Fix race in put_piwb()
    
    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