qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
	Changlong Xie <xiecl.fnst@cn.fujitsu.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: Wed, 22 Jun 2016 11:31:56 -0600	[thread overview]
Message-ID: <576ACB8C.7050304@redhat.com> (raw)
In-Reply-To: <233d4f8a-8d64-ffa8-9470-8c51463ef69b@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 936 bytes --]

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.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

  reply	other threads:[~2016-06-22 17:32 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 [this message]
2016-06-23  1:04           ` Changlong Xie
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=576ACB8C.7050304@redhat.com \
    --to=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 \
    --cc=xiecl.fnst@cn.fujitsu.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).