From: Changlong Xie <xiecl.fnst@cn.fujitsu.com>
To: Eric Blake <eblake@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
qemu devel <qemu-devel@nongnu.org>, Jeff Cody <jcody@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>, Fam Zheng <famz@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
Max Reitz <mreitz@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 1/2] blockjob: assert(cb) in the entry functions of blockjob
Date: Thu, 23 Jun 2016 09:04:08 +0800 [thread overview]
Message-ID: <576B3588.1070806@cn.fujitsu.com> (raw)
In-Reply-To: <576ACB8C.7050304@redhat.com>
On 06/23/2016 01:31 AM, Eric Blake wrote:
> On 06/22/2016 04:19 AM, Paolo Bonzini wrote:
>>
>>
>> On 22/06/2016 12:12, Changlong Xie wrote:
>>>
>>> commit/mirror/stream/backup use block_job_create(..., cb,..) to create
>>> relevant blockjob. When they finished, these jobs will invoke
>>> block_job_completed, then invoke job->cb() unconditionally. So i think
>>> we need this to avoid segment fault. Actually backup has implemented this.
>>
>> So this suggests that the right place to put the assertion would be
>> block_job_create. But it's even better to add a
>>
>> #define QEMU_NONNULL __attribute__((__nonnull__))
>>
>> to include/qemu/compiler.h and declare the arguments as non-null.
>
> Or alternatively fix things to only invoke job->cb() if it is non-NULL,
> so that callers don't have to pass in a no-op callback just to appease a
> non-NULL attribute.
>
Is there any reason, that we should invoke job->cb() unconditionally
without nonnull check? There is no relevant clue in the historical
commit messages. If yes, i prefer paolo's suggestion; otherwise eric's
solution is better.
Thanks
-Xie
next prev parent reply other threads:[~2016-06-23 0:59 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-22 9:16 [Qemu-devel] [PATCH 0/2] small fix of block job Changlong Xie
2016-06-22 9:16 ` [Qemu-devel] [PATCH 1/2] blockjob: assert(cb) in the entry functions of blockjob Changlong Xie
2016-06-22 9:50 ` Paolo Bonzini
2016-06-22 10:12 ` Changlong Xie
2016-06-22 10:19 ` Paolo Bonzini
2016-06-22 17:31 ` Eric Blake
2016-06-23 1:04 ` Changlong Xie [this message]
2016-06-23 6:21 ` Kevin Wolf
2016-06-23 6:57 ` Changlong Xie
2016-06-22 9:16 ` [Qemu-devel] [PATCH 2/2] mirror: fix misleading comments Changlong Xie
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=576B3588.1070806@cn.fujitsu.com \
--to=xiecl.fnst@cn.fujitsu.com \
--cc=eblake@redhat.com \
--cc=famz@redhat.com \
--cc=jcody@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.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 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.