[Devel] [PATCH RHEL8 COMMIT] ploop: Care about timeout on process_update_delta_index()

Konstantin Khorenko khorenko at virtuozzo.com
Tue Mar 10 18:45:01 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 5c2b2572aabc500d94f6b9030606bbf25dedac45
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Tue Mar 10 18:45:01 2020 +0300

    ploop: Care about timeout on process_update_delta_index()
    
    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 | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/md/dm-ploop-cmd.c b/drivers/md/dm-ploop-cmd.c
index cf4795f4cda1..30fea812b9c0 100644
--- a/drivers/md/dm-ploop-cmd.c
+++ b/drivers/md/dm-ploop-cmd.c
@@ -880,7 +880,12 @@ static void process_update_delta_index(struct ploop *ploop,
 	const char *map = cmd->update_delta_index.map;
 	u8 level = cmd->update_delta_index.level;
 	unsigned int cluster, dst_cluster, n;
-	int ret = -EINVAL;
+	int ret;
+
+	force_defer_bio_count_inc(ploop);
+	ret = ploop_inflight_bios_ref_switch(ploop, true);
+	if (ret)
+		goto out;
 
 	write_lock_irq(&ploop->bat_rwlock);
 	/* Check all */
@@ -891,8 +896,10 @@ static void process_update_delta_index(struct ploop *ploop,
 			break;
 		map += n;
 	}
-	if (map[0] != '\0')
+	if (map[0] != '\0') {
+		ret = -EINVAL;
 		goto unlock;
+	}
 	/* Commit all */
 	map = cmd->update_delta_index.map;
 	while (sscanf(map, "%u:%u;%n", &cluster, &dst_cluster, &n) == 2) {
@@ -903,9 +910,8 @@ static void process_update_delta_index(struct ploop *ploop,
 	ret = 0;
 unlock:
 	write_unlock_irq(&ploop->bat_rwlock);
-	if (!ret)
-		ploop_inflight_bios_ref_switch(ploop, false);
-
+out:
+	force_defer_bio_count_dec(ploop);
 	cmd->retval = ret;
 	complete(&cmd->comp); /* Last touch of cmd memory */
 }


More information about the Devel mailing list