[RHEL8,COMMIT] ploop: Care about timeout on process_notify_delta_merged()

Submitted by Konstantin Khorenko on March 10, 2020, 3:44 p.m.

Details

Message ID 202003101544.02AFixDI024995@finist_co8.work.ct
State New
Series "ploop: Make service operations care about timeout"
Headers show

Commit Message

Konstantin Khorenko March 10, 2020, 3:44 p.m.
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 9e4000c30e81565bff5ce964bb65e60be9e9d534
Author: Kirill Tkhai <ktkhai@virtuozzo.com>
Date:   Tue Mar 10 18:44:59 2020 +0300

    ploop: Care about timeout on process_notify_delta_merged()
    
    Signed-off-by: Kirill Tkhai <ktkhai@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 | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/md/dm-ploop-cmd.c b/drivers/md/dm-ploop-cmd.c
index 8201b1a4c8b2..ad6635b1d14c 100644
--- a/drivers/md/dm-ploop-cmd.c
+++ b/drivers/md/dm-ploop-cmd.c
@@ -817,6 +817,14 @@  static void process_notify_delta_merged(struct ploop *ploop,
 	u8 level = cmd->notify_delta_merged.level;
 	struct file *file;
 	u8 *bat_levels;
+	int ret;
+
+	force_defer_bio_count_inc(ploop);
+	ret = ploop_inflight_bios_ref_switch(ploop, true);
+	if (ret) {
+		cmd->retval = ret;
+		goto out;
+	}
 
 	bat_entries = ploop->bat_entries;
 	bat_levels = ploop->bat_levels;
@@ -853,10 +861,10 @@  static void process_notify_delta_merged(struct ploop *ploop,
 	ploop->deltas[--ploop->nr_deltas].file = NULL;
 	write_unlock_irq(&ploop->bat_rwlock);
 
-	ploop_inflight_bios_ref_switch(ploop, false);
 	fput(file);
-
 	cmd->retval = 0;
+out:
+	force_defer_bio_count_dec(ploop);
 	complete(&cmd->comp); /* Last touch of cmd memory */
 }