[rh8,5/7] ploop: Care about timeout on process_notify_delta_merged()

Submitted by Kirill Tkhai on March 10, 2020, 12:16 p.m.

Details

Message ID 158384259492.212417.13317565111396103429.stgit@localhost.localdomain
State New
Series "ploop: Make service operations care about timeout"
Headers show

Commit Message

Kirill Tkhai March 10, 2020, 12:16 p.m.
Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
---
 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 */
 }