From: Max Reitz <mreitz@redhat.com>
To: Anthony PERARD <anthony.perard@citrix.com>, qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
Stefano Stabellini <sstabellini@kernel.org>,
qemu-block@nongnu.org, Paul Durrant <paul@xen.org>,
qemu-stable@nongnu.org, Stefan Hajnoczi <stefanha@redhat.com>,
xen-devel@lists.xenproject.org
Subject: Re: [PATCH v2 for-5.0] xen-block: Fix double qlist remove and request leak
Date: Tue, 7 Apr 2020 13:50:36 +0200 [thread overview]
Message-ID: <49d00051-13fc-e0b0-26e3-b1171ed876d3@redhat.com> (raw)
In-Reply-To: <20200406140217.1441858-1-anthony.perard@citrix.com>
[-- Attachment #1.1: Type: text/plain, Size: 1804 bytes --]
On 06.04.20 16:02, Anthony PERARD wrote:
> Commit a31ca6801c02 ("qemu/queue.h: clear linked list pointers on
> remove") revealed that a request was removed twice from a list, once
> in xen_block_finish_request() and a second time in
> xen_block_release_request() when both function are called from
> xen_block_complete_aio(). But also, the `requests_inflight' counter is
> decreased twice, and thus became negative.
>
> This is a bug that was introduced in bfd0d6366043, where a `finished'
> list was removed.
>
> That commit also introduced a leak of request in xen_block_do_aio().
> That function calls xen_block_finish_request() but the request is
> never released after that.
>
> To fix both issue, we do two changes:
> - we squash finish_request() and release_request() together as we want
> to remove a request from 'inflight' list to add it to 'freelist'.
> - before releasing a request, we need to let now the result to the
> other end, thus we should call xen_block_send_response() before
> releasing a request.
>
> The first change fix the double QLIST_REMOVE() as we remove the extra
> call. The second change makes the leak go away because if we want to
> call finish_request(), we need to call a function that do all of
> finish, send response, and release.
>
> Fixes: bfd0d6366043 ("xen-block: improve response latency")
> Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
> ---
> hw/block/dataplane/xen-block.c | 48 ++++++++++++----------------------
> 1 file changed, 16 insertions(+), 32 deletions(-)
I’m going to send a pull request today anyway, so I hope you won’t mind
and let me take this patch to my branch (with Paul’s suggestions
incorporated):
https://git.xanclic.moe/XanClic/qemu/commits/branch/block
Max
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
prev parent reply other threads:[~2020-04-07 11:51 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-02 13:08 [PATCH for-5.0] xen-block: Fix double qlist remove Anthony PERARD
2020-04-02 14:27 ` Paul Durrant
2020-04-06 10:59 ` Anthony PERARD
2020-04-06 14:02 ` [PATCH v2 for-5.0] xen-block: Fix double qlist remove and request leak Anthony PERARD
2020-04-06 14:34 ` Paul Durrant
2020-04-07 11:50 ` Max Reitz [this message]
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=49d00051-13fc-e0b0-26e3-b1171ed876d3@redhat.com \
--to=mreitz@redhat.com \
--cc=anthony.perard@citrix.com \
--cc=kwolf@redhat.com \
--cc=paul@xen.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@nongnu.org \
--cc=sstabellini@kernel.org \
--cc=stefanha@redhat.com \
--cc=xen-devel@lists.xenproject.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;
as well as URLs for NNTP newsgroup(s).