From: Kevin Wolf <kwolf@redhat.com>
To: Vladimir Sementsov-Ogievskiy <v.sementsov-og@mail.ru>
Cc: eesposit@redhat.com, Hanna Reitz <hreitz@redhat.com>,
John Snow <jsnow@redhat.com>,
qemu-devel@nongnu.org, qemu-block@nongnu.org
Subject: Re: [PATCH] block/stream: Drain subtree around graph change
Date: Tue, 5 Apr 2022 16:41:08 +0200 [thread overview]
Message-ID: <YkxVBCbrSa1F9k+S@redhat.com> (raw)
In-Reply-To: <303aace0-2545-91a1-ef48-568f74680ca8@mail.ru>
Am 05.04.2022 um 14:12 hat Vladimir Sementsov-Ogievskiy geschrieben:
> Thanks Kevin! I have already run out of arguments in the battle
> against using subtree-drains to isolate graph modification operations
> from each other in different threads in the mailing list)
>
> (Note also, that the top-most version of this patch is "[PATCH v2]
> block/stream: Drain subtree around graph change")
Oops, I completely missed the v2. Thanks!
> About avoiding polling during graph-modifying operations, there is a
> problem: some IO operations are involved into block-graph modifying
> operations. At least it's rewriting "backing_file_offset" and
> "backing_file_size" fields in qcow2 header.
>
> We can't just separate rewriting metadata from graph modifying
> operation: this way another graph-modifying operation may interleave
> and we'll write outdated metadata.
Hm, generally we don't update image metadata when we reconfigure the
graph. Most changes are temporary (like insertion of filter nodes) and
the image header only contains a "default configuration" to be used on
the next start.
There are only a few places that update the image header; I think it's
generally block job completions. They obviously update the in-memory
graph, too, but they don't write to the image file (and therefore
potentially poll) in the middle of updating the in-memory graph, but
they do both in separate steps.
I think this is okay. We must just avoid polling in the middle of graph
updates because if something else changes the graph there, it's not
clear any more that we're really doing what the caller had in mind.
> So I still think, we need a kind of global lock for graph modifying
> operations. Or a kind per-BDS locks as you propose. But in this case
> we need to be sure that taking all needed per-BDS locks we'll avoid
> deadlocking.
I guess this depends on the exact granularity of the locks we're using.
If you take the lock only while updating a single edge, I don't think
you could easily deadlock. If you hold it for more complex operations,
it becomes harder to tell without checking the code.
Kevin
next prev parent reply other threads:[~2022-04-05 14:42 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-24 12:57 [PATCH] block/stream: Drain subtree around graph change Hanna Reitz
2022-04-05 10:14 ` Kevin Wolf
2022-04-05 11:47 ` Hanna Reitz
2022-04-05 12:05 ` Hanna Reitz
2022-04-05 14:12 ` Kevin Wolf
2022-04-05 12:12 ` Vladimir Sementsov-Ogievskiy
2022-04-05 14:41 ` Kevin Wolf [this message]
2022-04-05 21:48 ` Vladimir Sementsov-Ogievskiy
2022-04-05 13:09 ` Emanuele Giuseppe Esposito
2022-04-05 15:04 ` Kevin Wolf
2022-04-05 17:53 ` Emanuele Giuseppe Esposito
2022-04-05 18:24 ` Emanuele Giuseppe Esposito
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=YkxVBCbrSa1F9k+S@redhat.com \
--to=kwolf@redhat.com \
--cc=eesposit@redhat.com \
--cc=hreitz@redhat.com \
--cc=jsnow@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=v.sementsov-og@mail.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 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.