All Virtuozzo development lists (kernel + QEMU)
 help / color / mirror / Atom feed
From: Konstantin Khorenko <khorenko@virtuozzo.com>
To: Alexander Ivanov <alexander.ivanov@virtuozzo.com>
Cc: devel@openvz.org
Subject: Re: [Devel] [PATCH hci-8.1 v11 08/10] dm-qcow2: leak clusters allocated for a failed L1/L2 writeback
Date: Mon, 09 Nov 2026 16:42:38 +0100	[thread overview]
Message-ID: <179423895898.3398823.16047552713436808512.b4-review@b4> (raw)
In-Reply-To: <20261109140143.1408038-9-alexander.ivanov@virtuozzo.com>

I won't apply this version, please send v12 with the changes below.

On 11/9/26 15:01, Alexander Ivanov wrote:
>  		spin_unlock_irqrestore(&qcow2->md_pages_lock, flags);
>
> +		list_for_each_entry(qio, &end_list, link)
> +			qio->ext->cleanup_mask &= ~FREE_ALLOCATED_CLU;
>  		qcow2_dispatch_qios(qcow2, NULL, &wait_list);

Item 1 of the cover letter reply: queue the L1-allocation qio on
l1.md->wbd->dependent_list instead of l1.md->wait_list.

Why: that qio does not reach end_list. It waits on l1.md->wait_list,
and on a failed L1 writeback clear_writeback_status() sends it back to
work. The reverted L1 entry is 0 again, so it allocates another
L2-table cluster, and the L1 page is written again in the same worker
pass. Nothing slows this down: with a persistent L1 write error every
round leaks one more cluster and grows the file. Before this patch the
same loop freed the cluster and reused it.

On success a dependent qio goes back to work the same way as a waiter,
so moving it costs nothing there. Today only the qios added in
process_indexes_write() sit on dependent_list, and they all have ext.
A plain write that allocates an L2 table may have none, so check
qio->ext in the new loop.

> Keep the refcount of these clusters instead. If L1/L2 on disk points to
> such a cluster, the image stays consistent; otherwise the cluster is
> leaked, which check repairs by freeing it. So the image needs no check
> and resume needs no refusal.

Item 2 of the cover letter reply: say what is leaked, one cluster per
failed L1/L2 write of a request.

Why: your v10 answer bounded the leak by "refcounts reach the disk
before L1/L2". In this driver it is the other way round: R1/R2 pages
wait on slow_wb_batch_list for the timer (see the comment above
mark_cluster_used()), while L1/L2 pages are written in the same worker
pass. And an L1 update has no data write that could fail first.

-- 
Konstantin Khorenko,
Virtuozzo Linux Kernel Team

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

  parent reply	other threads:[~2026-11-09 15:44 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-09 14:01 [Devel] [PATCH hci-8.1 v11 00/10] dm-qcow2: truncate unused tail of image on suspend Alexander Ivanov
2026-11-09 14:01 ` [Devel] [PATCH hci-8.1 v11 01/10] dm-qcow2: add qcow2_md_page_read_sync() helper Alexander Ivanov
2026-11-09 14:06   ` no-reply
2026-11-09 14:01 ` [Devel] [PATCH hci-8.1 v11 02/10] dm-qcow2: drop duplicate prefix from QC_ERR/QC_INFO messages Alexander Ivanov
2026-11-09 14:05   ` no-reply
2026-11-09 14:01 ` [Devel] [PATCH hci-8.1 v11 03/10] dm-qcow2: extend the file for a new refblock in allocate_cluster() Alexander Ivanov
2026-11-09 14:06   ` no-reply
2026-11-09 14:01 ` [Devel] [PATCH hci-8.1 v11 04/10] dm-qcow2: complete wbd before ending the data qio Alexander Ivanov
2026-11-09 14:09   ` no-reply
2026-11-09 14:01 ` [Devel] [PATCH hci-8.1 v11 05/10] dm-qcow2: flush lower md before clearing dirty bit on merge failure Alexander Ivanov
2026-11-09 14:08   ` no-reply
2026-11-09 14:01 ` [Devel] [PATCH hci-8.1 v11 06/10] dm-qcow2: keep the dirty bit of an image that needs check Alexander Ivanov
2026-11-09 14:11   ` no-reply
2026-11-09 14:01 ` [Devel] [PATCH hci-8.1 v11 07/10] dm-qcow2: flag the image for check if reftable relocation fails late Alexander Ivanov
2026-11-09 14:11   ` no-reply
2026-11-09 15:42   ` Konstantin Khorenko
2026-11-09 14:01 ` [Devel] [PATCH hci-8.1 v11 08/10] dm-qcow2: leak clusters allocated for a failed L1/L2 writeback Alexander Ivanov
2026-11-09 14:14   ` no-reply
2026-11-09 14:36     ` Alexander Ivanov
2026-11-09 15:42   ` Konstantin Khorenko [this message]
2026-11-09 14:01 ` [Devel] [PATCH hci-8.1 v11 09/10] dm-qcow2: retry R1/R2 writeback that failed with ENOSPC Alexander Ivanov
2026-11-09 14:16   ` no-reply
2026-11-09 14:39     ` Alexander Ivanov
2026-11-09 15:42   ` Konstantin Khorenko
2026-11-09 14:01 ` [Devel] [PATCH hci-8.1 v11 10/10] dm-qcow2: truncate unused tail of image on suspend Alexander Ivanov
2026-11-09 14:18   ` no-reply
2026-11-09 14:47     ` Alexander Ivanov
2026-11-09 15:42   ` Konstantin Khorenko
2026-11-09 15:42 ` [Devel] [PATCH hci-8.1 v11 00/10] " Konstantin Khorenko
2026-11-09 15:54 ` Konstantin Khorenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179423895898.3398823.16047552713436808512.b4-review@b4 \
    --to=khorenko@virtuozzo.com \
    --cc=alexander.ivanov@virtuozzo.com \
    --cc=devel@openvz.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.