[rh7] ploop: Replace delta under quiesce state

Submitted by Kirill Tkhai on March 5, 2020, 9:26 a.m.

Details

Message ID 158340040316.129289.10177463138871714272.stgit@localhost.localdomain
State New
Series "ploop: Replace delta under quiesce state"
Headers show

Commit Message

Kirill Tkhai March 5, 2020, 9:26 a.m.
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@virtuozzo.com>
---
 drivers/block/ploop/dev.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

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);