[Devel,rh7] ploop: push_backup: ploop_pb_init must always spawn health_monitor

Submitted by Maxim Patlasov on Oct. 26, 2016, 10:46 p.m.

Details

Message ID 147752192908.11728.793276992246263694.stgit@maxim-thinkpad
State New
Series "ploop: push_backup: ploop_pb_init must always spawn health_monitor"
Headers show

Commit Message

Maxim Patlasov Oct. 26, 2016, 10:46 p.m.
Due to a silly mistake, ploop_pb_init forgot to spawn health_monitor thread
for full backup. The aftermath is disastrous in case of slow/hanged
vz_backup_client: push_backup timeout handler moves backup state from
ALIVE to STOPPING, but nobody finalizes hanged requests and moves the
state to DEAD (as expected from health_monitor).

Signed-off-by: Maxim Patlasov <mpatlasov@virtuozzo.com>
---
 drivers/block/ploop/push_backup.c |   26 ++++++++++++--------------
 1 file changed, 12 insertions(+), 14 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/block/ploop/push_backup.c b/drivers/block/ploop/push_backup.c
index f825575..8f19310 100644
--- a/drivers/block/ploop/push_backup.c
+++ b/drivers/block/ploop/push_backup.c
@@ -380,7 +380,6 @@  static int ploop_pb_health_monitor(void * data)
 int ploop_pb_init(struct ploop_pushbackup_desc *pbd, __u8 *uuid, bool full)
 {
 	struct task_struct *ts;
-	int rc;
 
 	memcpy(pbd->cbt_uuid, uuid, sizeof(pbd->cbt_uuid));
 
@@ -396,21 +395,20 @@  int ploop_pb_init(struct ploop_pushbackup_desc *pbd, __u8 *uuid, bool full)
 			__clear_bit(off, page_address(pbd->ppb_map[i]));
 			off++;
 		}
-		return 0;
+	} else {
+		int rc = blk_cbt_map_copy_once(pbd->plo->queue,
+					       uuid,
+					       &pbd->cbt_map,
+					       &pbd->cbt_block_max,
+					       &pbd->cbt_block_bits);
+		if (rc)
+			return rc;
+
+		rc = convert_map_to_map(pbd);
+		if (rc)
+			return rc;
 	}
 
-	rc = blk_cbt_map_copy_once(pbd->plo->queue,
-				   uuid,
-				   &pbd->cbt_map,
-				   &pbd->cbt_block_max,
-				   &pbd->cbt_block_bits);
-	if (rc)
-		return rc;
-
-	rc = convert_map_to_map(pbd);
-	if (rc)
-		return rc;
-
 	ts = kthread_create(ploop_pb_health_monitor, pbd, "ploop_pb_hm%d",
 			    pbd->plo->index);
 	if (IS_ERR(ts))