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

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

    ploop: Care about timeout on process_merge_latest_snapshot_cmd()
    
    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 | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/md/dm-ploop-cmd.c b/drivers/md/dm-ploop-cmd.c
index ad6635b1d14c..cf4795f4cda1 100644
--- a/drivers/md/dm-ploop-cmd.c
+++ b/drivers/md/dm-ploop-cmd.c
@@ -727,6 +727,7 @@ static void process_merge_latest_snapshot_cmd(struct ploop *ploop,
 	unsigned int *cluster = &cmd->merge.cluster;
 	unsigned int level, dst_cluster;
 	struct file *file;
+	int ret;
 
 	if (cmd->retval)
 		goto out;
@@ -765,12 +766,17 @@ static void process_merge_latest_snapshot_cmd(struct ploop *ploop,
 
 	if (cmd->retval == 0 && !cmd->merge.do_repeat) {
 		/* Delta merged. Release delta's file */
+		ret = ploop_inflight_bios_ref_switch(ploop, true);
+		if (ret) {
+			cmd->retval = ret;
+			goto complete;
+		}
 		write_lock_irq(&ploop->bat_rwlock);
 		file = ploop->deltas[--ploop->nr_deltas].file;
 		write_unlock_irq(&ploop->bat_rwlock);
-		ploop_inflight_bios_ref_switch(ploop, false);
 		fput(file);
 	}
+complete:
 	complete(&cmd->comp); /* Last touch of cmd memory */
 }
 


More information about the Devel mailing list