[Devel] [PATCH RHEL8 COMMIT] ploop: Care about timeout on tracking start

Konstantin Khorenko khorenko at virtuozzo.com
Tue Mar 10 18:44:58 MSK 2020


The commit is pushed to "branch-rh8-4.18.0-80.1.2.vz8.3.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-80.1.2.vz8.3.2
------>
commit e4c58741d6a53228dc96938ac0f16ef97f1a6338
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Tue Mar 10 18:44:58 2020 +0300

    ploop: Care about timeout on tracking start
    
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
    
    =====================
    Patchset description:
    
    ploop: Make service operations care about timeout
    
    Recently in vz7 we met a situation, when fuse daemon lost a request.
    This patch set makes ploop service operations use timeout to prevent
    a hang in such the situations.
    
    Kirill Tkhai (7):
          ploop: Add timeout to ploop_inflight_bios_ref_switch()
          ploop: Care about timeout on grow and snapshot
          ploop: Care about timeout on tracking start
          ploop: Care about timeout on discard
          ploop: Care about timeout on process_notify_delta_merged()
          ploop: Care about timeout on process_merge_latest_snapshot_cmd()
          ploop: Care about timeout on process_update_delta_index()
---
 drivers/md/dm-ploop-cmd.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/md/dm-ploop-cmd.c b/drivers/md/dm-ploop-cmd.c
index 75b4ade68097..8201b1a4c8b2 100644
--- a/drivers/md/dm-ploop-cmd.c
+++ b/drivers/md/dm-ploop-cmd.c
@@ -1149,7 +1149,9 @@ static void process_tracking_start(struct ploop *ploop, struct ploop_cmd *cmd)
 	 * Here we care about ploop_map() sees ploop->tracking_bitmap,
 	 * since the rest of submitting are made from *this* kwork.
 	 */
-	ploop_inflight_bios_ref_switch(ploop, false);
+	ret = ploop_inflight_bios_ref_switch(ploop, true);
+	if (ret)
+		goto out;
 
 	write_lock_irq(&ploop->bat_rwlock);
 	for_each_clear_bit(i, ploop->holes_bitmap, ploop->hb_nr)
@@ -1166,7 +1168,7 @@ static void process_tracking_start(struct ploop *ploop, struct ploop_cmd *cmd)
 	}
 unlock:
 	write_unlock_irq(&ploop->bat_rwlock);
-
+out:
 	cmd->retval = ret;
 	complete(&cmd->comp); /* Last touch of cmd memory */
 }
@@ -1205,6 +1207,7 @@ static int ploop_tracking_cmd(struct ploop *ploop, const char *suffix,
 	struct ploop_cmd cmd = { {0} };
 	void *tracking_bitmap = NULL;
 	unsigned int i, tb_nr, size;
+	int ret = 0;
 
 	if (ploop_is_ro(ploop))
 		return -EROFS;
@@ -1248,9 +1251,13 @@ static int ploop_tracking_cmd(struct ploop *ploop, const char *suffix,
 		ploop_queue_deferred_cmd(ploop, &cmd);
 		wait_for_completion(&cmd.comp);
 		ploop->maintaince = true;
+		ret = cmd.retval;
+		if (ret)
+			goto stop;
 	} else if (!strcmp(suffix, "stop")) {
 		if (!ploop->tracking_bitmap)
 			return -ENOENT;
+stop:
 		write_lock_irq(&ploop->bat_rwlock);
 		kvfree(ploop->tracking_bitmap);
 		ploop->tracking_bitmap = NULL;
@@ -1260,7 +1267,7 @@ static int ploop_tracking_cmd(struct ploop *ploop, const char *suffix,
 		return -EINVAL;
 	}
 
-	return 0;
+	return ret;
 }
 
 static int ploop_set_noresume(struct ploop *ploop, char *mode)


More information about the Devel mailing list