From: Max Reitz <mreitz@redhat.com>
To: "sochin.jiang" <sochin.jiang@huawei.com>, kwolf@redhat.com
Cc: qemu-block@nongnu.org, qemu-devel@nongnu.org,
eric.fangyi@huawei.com, subo7@huawei.com, xieyingtai@huawei.com,
lina.lulina@huawei.com, zhangshuai13@huawei.com,
lizhengui@huawei.com
Subject: Re: [Qemu-devel] [PATCH] fix: avoid infinite loop when blockjob encountering failure
Date: Fri, 16 Jun 2017 15:06:28 +0200 [thread overview]
Message-ID: <d75de7fa-e356-9324-253c-d6bb4675d9f9@redhat.com> (raw)
In-Reply-To: <d9eea04a-9ea7-34b4-121e-f635786cac58@huawei.com>
[-- Attachment #1: Type: text/plain, Size: 1381 bytes --]
On 2017-06-15 04:38, sochin.jiang wrote:
> Thanks for your kindly reply.
>
> I do have made a mistake that ignoring the AIOContext lock.
>
> About the patch, firstly, if job->ret comes to be non-zero(also means job->completed to be true) , blockjob 'callback'(common_block_job_cb) will be called, blockjob error will be put into errp. It won't report success.
Oh, right, good.
> Secondly, blockjob fails with 'ret < 0' and without calling block_job_complete_sync(), we won't have segfault because bdrv_reopen won't be called.
commit_active_start() invokes bdrv_reopen(), and that segfaults for me
if the backing file is a bit unusual. See:
$ qemu-img create -f qcow2 \
-b "json:{'driver':'raw','file':{
'driver':'blkdebug','inject-error':[{
'event':'write_aio','once':true
}],
'image':{'driver':'null-co'}}}" \
overlay.qcow2
$ qemu-img commit overlay.qcow2
[1] 11080 segmentation fault (core dumped) qemu-img commit overlay.qcow2
Same if you actually write something to the overlay to trigger the write
error (which would fail the block job).
Yes, not directly related to your patch, which is why I've fixed it myself:
http://lists.nongnu.org/archive/html/qemu-block/2017-06/msg00424.html
> Also, with the use-after-free problems.
No, but I see you noticed that. :-)
Max
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 498 bytes --]
prev parent reply other threads:[~2017-06-16 13:06 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-14 6:22 [Qemu-devel] [PATCH] fix: avoid infinite loop when blockjob encountering failure sochin.jiang
2017-06-14 6:33 ` no-reply
2017-06-14 6:46 ` Fam Zheng
2017-06-14 6:58 ` sochin.jiang
2017-06-14 13:12 ` Max Reitz
2017-06-15 2:38 ` sochin.jiang
2017-06-15 3:24 ` sochin.jiang
2017-06-16 13:06 ` 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=d75de7fa-e356-9324-253c-d6bb4675d9f9@redhat.com \
--to=mreitz@redhat.com \
--cc=eric.fangyi@huawei.com \
--cc=kwolf@redhat.com \
--cc=lina.lulina@huawei.com \
--cc=lizhengui@huawei.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=sochin.jiang@huawei.com \
--cc=subo7@huawei.com \
--cc=xieyingtai@huawei.com \
--cc=zhangshuai13@huawei.com \
/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).