From: Denis V. Lunev <[email protected]>

ploop_prepare_reloc_index_wb() marks the BAT page of a relocated
cluster MD_UPDATING and MD_DIRTY and allocates the cluster to copy it
to. When ploop_write_cluster_sync() then fails, an I/O error or ENOSPC
on the host file system, ploop_grow_relocate_cluster() only frees the
piwb. The resize fails and submission resumes with both bits set:

- every allocating write, discard or COW on a cluster of that page is
  parked in md->wait_llist, which only a writeback completion of the
  page drains, and none comes. These requests never complete, a dm
  suspend of the device hangs and later ploop cmds time out in the
  inflight ref switch;

- the allocated cluster stays taken in holes_bitmap until the image is
  reopened.

Clear the bits as the error path of ploop_prepare_reloc_index_wb()
does and give the cluster back. Submission is stopped for the whole
resize, so no pio waits on the page and none has to be resubmitted.

Fixes: 018063db0eeb ("dm-ploop: fix resize and grow to use the new way of 
updating md pages")
Reported-by: Konstantin Khorenko <[email protected]>
https://virtuozzo.atlassian.net/browse/VSTOR-152981
Feature: dm-ploop: ploop target driver
Reviewed-by: Andrey Zhadchenko <[email protected]>
Reviewed-by: Konstantin Khorenko <[email protected]>
Signed-off-by: Denis V. Lunev <[email protected]>
---
 drivers/md/dm-ploop-cmd.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/md/dm-ploop-cmd.c b/drivers/md/dm-ploop-cmd.c
index 29f9a7ee7540..1cb186a2e0cd 100644
--- a/drivers/md/dm-ploop-cmd.c
+++ b/drivers/md/dm-ploop-cmd.c
@@ -351,6 +351,12 @@ static int ploop_grow_relocate_cluster(struct ploop *ploop,
                PL_ERR("reloc: failed write: %d", ret);
                /* piwb can not change here we are the only user of md page */
                ploop_break_bat_update(ploop, md, piwb);
+               spin_lock_irq(&ploop->bat_lock);
+               if (add_for_wb)
+                       clear_bit(MD_DIRTY, &md->status);
+               clear_bit(MD_UPDATING, &md->status);
+               ploop_hole_set_bit(new_dst, ploop);
+               spin_unlock_irq(&ploop->bat_lock);
                goto out;
        }
 
-- 
2.53.0

_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to