qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Hanna Czenczek <hreitz@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>,
	qemu-block@nongnu.org
Cc: qemu-devel@nongnu.org, kwolf@redhat.com, jsnow@redhat.com,
	Evanzhang@archeros.com, den@openvz.org,
	Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Subject: Re: [PATCH] block-jobs: add final flush
Date: Tue, 31 Oct 2023 15:05:13 +0100	[thread overview]
Message-ID: <fd7da9d6-be5a-40f7-9c59-593ac8de41d1@redhat.com> (raw)
In-Reply-To: <20231004135632.18196-1-vsementsov@yandex-team.ru>

On 04.10.23 15:56, Vladimir Sementsov-Ogievskiy wrote:
> From: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
>
> Actually block job is not completed without the final flush. It's
> rather unexpected to have broken target when job was successfully
> completed long ago and now we fail to flush or process just
> crashed/killed.
>
> Mirror job already has mirror_flush() for this. So, it's OK.
>
> Add similar things for other jobs: backup, stream, commit.
>
> Note, that stream has (documented) different treatment of IGNORE
> action: it don't retry the operation, continue execution and report
> error at last. We keep it for final flush too.
>
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
> ---
>
> Was: [PATCH v4] block-jobs: flush target at the end of .run()
>    But now rewritten.
> Supersedes: <20230725174008.1147467-1-vsementsov@yandex-team.ru>
>
>   block/backup.c             |  2 +-
>   block/block-copy.c         |  7 +++++++
>   block/commit.c             | 16 ++++++++++++----
>   block/stream.c             | 21 +++++++++++++++++----
>   include/block/block-copy.h |  1 +
>   5 files changed, 38 insertions(+), 9 deletions(-)

[...]

> diff --git a/block/commit.c b/block/commit.c
> index aa45beb0f0..5205c77ec9 100644
> --- a/block/commit.c
> +++ b/block/commit.c

[...]

> @@ -187,7 +187,15 @@ static int coroutine_fn commit_run(Job *job, Error **errp)
>           }
>       }
>   
> -    return 0;
> +    do {
> +        ret = blk_co_flush(s->base);
> +        if (ret < 0) {
> +            action = block_job_error_action(&s->common, s->on_error,
> +                                            false, -ret);
> +        }
> +    } while (ret < 0 && action != BLOCK_ERROR_ACTION_REPORT);

Do we need to yield in this loop somewhere so that 
BLOCK_ERROR_ACTION_STOP can pause the job?

Hanna



  reply	other threads:[~2023-10-31 14:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-04 13:56 [PATCH] block-jobs: add final flush Vladimir Sementsov-Ogievskiy
2023-10-31 14:05 ` Hanna Czenczek [this message]
2023-11-01 19:53   ` Vladimir Sementsov-Ogievskiy
2023-11-02 12:59     ` Hanna Czenczek
2023-11-02 13:33       ` Vladimir Sementsov-Ogievskiy

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=fd7da9d6-be5a-40f7-9c59-593ac8de41d1@redhat.com \
    --to=hreitz@redhat.com \
    --cc=Evanzhang@archeros.com \
    --cc=den@openvz.org \
    --cc=jsnow@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=vsementsov@virtuozzo.com \
    --cc=vsementsov@yandex-team.ru \
    /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;
as well as URLs for NNTP newsgroup(s).