[Devel] [PATCH rh8 7/7] ploop: Care about timeout on process_update_delta_index()
Kirill Tkhai
ktkhai at virtuozzo.com
Tue Mar 10 15:16:46 MSK 2020
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
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