[Devel] [PATCH rh7] ploop: Add sanity check on stop

Kirill Tkhai ktkhai at virtuozzo.com
Fri Jun 14 13:40:26 MSK 2019


Check for (unbelievable) case, when we there are uncompleted
requests on stop.

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

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

diff --git a/drivers/block/ploop/dev.c b/drivers/block/ploop/dev.c
index 9bbb2ad02fa2..0c9534f588c5 100644
--- a/drivers/block/ploop/dev.c
+++ b/drivers/block/ploop/dev.c
@@ -4132,7 +4132,7 @@ static int ploop_start(struct ploop_device * plo, struct block_device *bdev)
 
 static int ploop_stop(struct ploop_device * plo, struct block_device *bdev)
 {
-	int p;
+	int p, active_reqs;
 	struct ploop_delta * delta;
 	int cnt;
 
@@ -4183,6 +4183,13 @@ static int ploop_stop(struct ploop_device * plo, struct block_device *bdev)
 		return -EBUSY;
 	}
 
+	active_reqs = plo->active_reqs;
+	if (active_reqs) {
+		WARN_ONCE(1, "stop ploop%d failed (active_reqs=%d)\n",
+			     plo->index, active_reqs);
+		return -EBUSY;
+	}
+
 	clear_bit(PLOOP_S_PUSH_BACKUP, &plo->state);
 	ploop_pb_stop(plo->pbd, true);
 



More information about the Devel mailing list