[Devel] [PATCH rh7] ploop: Replace delta under quiesce state

Kirill Tkhai ktkhai at virtuozzo.com
Thu Mar 5 12:26:49 MSK 2020


This is used for vstorage to replace broken image with
a stub. Race is possible here, so we have to disable IO
before calling for ->replace_delta.

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 drivers/block/ploop/dev.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/block/ploop/dev.c b/drivers/block/ploop/dev.c
index 5f68353875d2..25150fb0467b 100644
--- a/drivers/block/ploop/dev.c
+++ b/drivers/block/ploop/dev.c
@@ -3440,13 +3440,15 @@ static int ploop_replace_delta(struct ploop_device * plo, unsigned long arg)
 		goto out_close;
 	}
 
+	ploop_quiesce(plo);
 	if (delta->ops->replace_delta) {
 		err = delta->ops->replace_delta(delta);
-		if (err)
+		if (err) {
+			ploop_relax(plo);
 			goto out_kobj_del;
+		}
 	}
 
-	ploop_quiesce(plo);
 	ploop_map_destroy(&plo->map);
 	list_replace_init(&old_delta->list, &delta->list);
 	clear_bit(PLOOP_S_ABORT, &plo->state);




More information about the Devel mailing list