[RHEL7,COMMIT] ploop: Add sanity check on stop

Submitted by Konstantin Khorenko on June 14, 2019, 4:16 p.m.

Details

Message ID 201906141616.x5EGGBW8009406@finist-ce7.sw.ru
State New
Series "ploop: Add sanity check on stop"
Headers show

Commit Message

Konstantin Khorenko June 14, 2019, 4:16 p.m.
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@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@virtuozzo.com>
---
 drivers/block/ploop/dev.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

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