[Devel] [PATCH RHEL8 COMMIT] ploop: Care about timeout on grow and snapshot
Konstantin Khorenko
khorenko at virtuozzo.com
Tue Mar 10 18:44:58 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 30689b512ecc243e78a351d4e167a6920d48adb0
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date: Tue Mar 10 18:44:57 2020 +0300
ploop: Care about timeout on grow and snapshot
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 | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/drivers/md/dm-ploop-cmd.c b/drivers/md/dm-ploop-cmd.c
index 0d245ef505aa..75b4ade68097 100644
--- a/drivers/md/dm-ploop-cmd.c
+++ b/drivers/md/dm-ploop-cmd.c
@@ -227,7 +227,7 @@ static int ploop_grow_relocate_cluster(struct ploop *ploop,
{
struct bio *bio = cmd->resize.bio;
unsigned int new_dst, cluster, dst_cluster;
- bool is_locked;
+ bool is_locked, defer_bio_count = false;
int ret = 0;
dst_cluster = cmd->resize.dst_cluster;
@@ -252,7 +252,10 @@ static int ploop_grow_relocate_cluster(struct ploop *ploop,
/* Redirect bios to kwork and wait inflights, which may use @cluster */
force_defer_bio_count_inc(ploop);
- ploop_inflight_bios_ref_switch(ploop, false);
+ defer_bio_count = true;
+ ret = ploop_inflight_bios_ref_switch(ploop, true);
+ if (ret < 0)
+ goto out;
/* Read full cluster sync */
ret = ploop_read_cluster_sync(ploop, bio, dst_cluster);
@@ -294,7 +297,7 @@ static int ploop_grow_relocate_cluster(struct ploop *ploop,
/* Zero new BAT entries on disk. */
ret = ploop_write_zero_cluster_sync(ploop, bio, dst_cluster);
out:
- if (cluster != UINT_MAX)
+ if (defer_bio_count)
force_defer_bio_count_dec(ploop);
return ret;
@@ -1009,9 +1012,12 @@ static int ploop_update_delta_index(struct ploop *ploop, unsigned int level,
static void process_switch_top_delta(struct ploop *ploop, struct ploop_cmd *cmd)
{
unsigned int i, size, bat_clusters, level = ploop->nr_deltas;
+ int ret;
force_defer_bio_count_inc(ploop);
- ploop_inflight_bios_ref_switch(ploop, false);
+ ret = ploop_inflight_bios_ref_switch(ploop, true);
+ if (ret)
+ goto out;
/* If you add more two-stages-actions, you must cancel them here too */
cancel_discard_bios(ploop);
@@ -1036,9 +1042,10 @@ static void process_switch_top_delta(struct ploop *ploop, struct ploop_cmd *cmd)
ploop->nr_deltas++;
write_unlock_irq(&ploop->bat_rwlock);
+out:
force_defer_bio_count_dec(ploop);
- cmd->retval = 0;
+ cmd->retval = ret;
complete(&cmd->comp); /* Last touch of cmd memory */
}
More information about the Devel
mailing list