OpenVZ / Virtuozzo kernel development (devel@openvz.org)
 help / color / mirror / Atom feed
From: no-reply@sashiko.virtuozzo.com
To: Alexander Ivanov <alexander.ivanov@virtuozzo.com>,
	andrey.zhadchenko@virtuozzo.com
Cc: devel@openvz.org
Subject: Re: [Devel] [PATCH hci-8.1 v12 12/12] dm-qcow2: fix WARN in qrq_endio() on flush failing with ENOSPC
Date: Tue, 10 Nov 2026 08:07:46 +0000	[thread overview]
Message-ID: <010701a1c47fb471-53e30c8d-3fbb-4b1e-8251-53c60e0911db-000000@eu-central-1.amazonses.com> (raw)
In-Reply-To: <20261110075140.1475607-13-alexander.ivanov@virtuozzo.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] dm-qcow2: retried flush after fsync ENOSPC can succeed because errseq reports the error once
--

commit cfe92a6a11a8e762b7903b1085d1bba233f67647
Author: Alexander Ivanov <alexander.ivanov@virtuozzo.com>

dm-qcow2: fix WARN in qrq_endio() on flush failing with ENOSPC

This patch relaxes the WARN_ON_ONCE in qrq_endio() so that a REQ_OP_FLUSH
completing with BLK_STS_NOSPC no longer triggers the warning. The flush is
still delayed and resubmitted through qcow2_try_delay_enospc().

> diff --git a/drivers/md/dm-qcow2-map.c b/drivers/md/dm-qcow2-map.c
> --- a/drivers/md/dm-qcow2-map.c
> +++ b/drivers/md/dm-qcow2-map.c

[ ... ]

> @@ -4491,7 +4491,8 @@ static void qrq_endio(struct qcow2_target *tgt, struct qio *qio,
>  	 * callers receive -ENOSPC synchronous without intermediaries.
>  	 */
>  	if (unlikely(bi_status == BLK_STS_NOSPC)) {
> -		WARN_ON_ONCE(!op_is_write(qio->bi_op));
> +		WARN_ON_ONCE(!op_is_write(qio->bi_op) &&
> +			     qio->bi_op != REQ_OP_FLUSH);
>  		if (qcow2_try_delay_enospc(tgt, qrq, qio))
>  			return;
>  	}

[Severity: Medium]
The commit message says "Delaying and resubmitting the flush is already
correct". Is that accurate?

The flush ENOSPC originates in do_qcow2_fsync_work():

    if (fsync_ret == -EAGAIN)
        fsync_ret = vfs_fsync(qcow2->file, 0);

    end_qios(&flush_qios, errno_to_blk_status(fsync_ret));

On -ENOSPC, qrq_endio() calls qcow2_try_delay_enospc(), which requeues the
qio on tgt->enospc_qios. After the timer fires, qcow2_submit_embedded_qio()
sends it back to the fsync worker:

    WARN_ON_ONCE(qio->bi_op != REQ_OP_FLUSH);
    queue_list_id = QLIST_FLUSH;
    worker = &qcow2->fsync_worker;

The worker then calls vfs_fsync() again on the same struct file.

Writeback errors are reported through errseq. As documented in
file_check_and_advance_wb_err(), fsync reports errors that occurred since
the last fsync, and the call advances file->f_wb_err:

    err = errseq_check_and_advance(&mapping->wb_err,
                                   &file->f_wb_err);

Can the retried vfs_fsync() on the same qcow2->file therefore return 0 on
ext4 or xfs, which the commit message names for "a failed delayed write"?

If so, the flush that originally failed with -ENOSPC would complete with
BLK_STS_OK. The upper layer could then treat earlier writes as durable
when they were not.

A retried write resends its data, but a retried flush resends nothing. Is
there something in dm-qcow2 that retains the earlier failure, or that
otherwise makes the retry safe?

Could the commit message explain why resubmitting the flush is correct,
given the errseq behaviour?

-- 
Sashiko AI review · https://sashiko.vzint.dev/#/patchset/20261110075140.1475607-1-alexander.ivanov@virtuozzo.com?part=12

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

  reply	other threads:[~2026-11-10  8:09 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-10  7:51 [Devel] [PATCH hci-8.1 v12 00/12] dm-qcow2: truncate unused tail of image on suspend Alexander Ivanov
2026-11-10  7:51 ` [Devel] [PATCH hci-8.1 v12 01/12] dm-qcow2: add qcow2_md_page_read_sync() helper Alexander Ivanov
2026-11-10  7:55   ` no-reply
2026-11-10  7:51 ` [Devel] [PATCH hci-8.1 v12 02/12] dm-qcow2: drop duplicate prefix from QC_ERR/QC_INFO messages Alexander Ivanov
2026-11-10  7:55   ` no-reply
2026-11-10  7:51 ` [Devel] [PATCH hci-8.1 v12 03/12] dm-qcow2: extend the file for a new refblock in allocate_cluster() Alexander Ivanov
2026-11-10  7:56   ` no-reply
2026-11-10  7:51 ` [Devel] [PATCH hci-8.1 v12 04/12] dm-qcow2: complete wbd before ending the data qio Alexander Ivanov
2026-11-10  7:58   ` no-reply
2026-11-10  7:51 ` [Devel] [PATCH hci-8.1 v12 05/12] dm-qcow2: flush lower md before clearing dirty bit on merge failure Alexander Ivanov
2026-11-10  7:58   ` no-reply
2026-11-10  7:51 ` [Devel] [PATCH hci-8.1 v12 06/12] dm-qcow2: keep the dirty bit of an image that needs check Alexander Ivanov
2026-11-10  7:59   ` no-reply
2026-11-10  7:51 ` [Devel] [PATCH hci-8.1 v12 07/12] dm-qcow2: flag the image for check if reftable relocation fails late Alexander Ivanov
2026-11-10  8:00   ` no-reply
2026-11-10  7:51 ` [Devel] [PATCH hci-8.1 v12 08/12] dm-qcow2: fail the L2 table allocation request on L1 writeback error Alexander Ivanov
2026-11-10  8:01   ` no-reply
2026-11-10  7:51 ` [Devel] [PATCH hci-8.1 v12 09/12] dm-qcow2: leak clusters allocated for a failed L1/L2 writeback Alexander Ivanov
2026-11-10  8:04   ` no-reply
2026-11-10  8:25     ` Alexander Ivanov
2026-11-10  7:51 ` [Devel] [PATCH hci-8.1 v12 10/12] dm-qcow2: retry R1/R2 writeback that failed with ENOSPC Alexander Ivanov
2026-11-10  8:06   ` no-reply
2026-11-10  8:31     ` Alexander Ivanov
2026-11-10  7:51 ` [Devel] [PATCH hci-8.1 v12 11/12] dm-qcow2: truncate unused tail of image on suspend Alexander Ivanov
2026-11-10  8:07   ` no-reply
2026-11-10  7:51 ` [Devel] [PATCH hci-8.1 v12 12/12] dm-qcow2: fix WARN in qrq_endio() on flush failing with ENOSPC Alexander Ivanov
2026-11-10  8:07   ` no-reply [this message]
2026-11-10  8:35     ` Alexander Ivanov
2026-11-10 11:42 ` [Devel] [PATCH hci-8.1 v12 00/12] dm-qcow2: truncate unused tail of image on suspend Konstantin Khorenko
2026-11-10 11:43 ` 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=010701a1c47fb471-53e30c8d-3fbb-4b1e-8251-53c60e0911db-000000@eu-central-1.amazonses.com \
    --to=no-reply@sashiko.virtuozzo.com \
    --cc=alexander.ivanov@virtuozzo.com \
    --cc=andrey.zhadchenko@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox