[Devel] [PATCH RHEL7 COMMIT] ploop: Add sanity check on stop

Konstantin Khorenko khorenko at virtuozzo.com
Fri Jun 14 19:16:13 MSK 2019


The commit is pushed to "branch-rh7-3.10.0-957.12.2.vz7.96.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-957.12.2.vz7.96.15
------>
commit c52a19a726b50c06fb79259aaf96baa375f255ed
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Fri Jun 14 19:16:10 2019 +0300

    ploop: Add sanity check on stop
    
    Check for (unbelievable) case, when we there are uncompleted
    requests on stop.
    
    https://jira.sw.ru/browse/PSBM-95247
    https://jira.sw.ru/browse/PSBM-95347
    
    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 2cb6e99a9b3c..9d932d1b959f 100644
--- a/drivers/block/ploop/dev.c
+++ b/drivers/block/ploop/dev.c
@@ -4133,7 +4133,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;
 
@@ -4184,6 +4184,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