[Devel] [PATCH rh8 6/7] ploop: Care about timeout on process_merge_latest_snapshot_cmd()

Kirill Tkhai ktkhai at virtuozzo.com
Tue Mar 10 15:16:40 MSK 2020


Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 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