From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47398) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFm0P-0002fL-DT for qemu-devel@nongnu.org; Wed, 22 Jun 2016 13:32:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bFm0M-0001KF-7H for qemu-devel@nongnu.org; Wed, 22 Jun 2016 13:32:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:47823) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bFm0L-0001KB-VR for qemu-devel@nongnu.org; Wed, 22 Jun 2016 13:31:58 -0400 References: <1466587008-3933-1-git-send-email-xiecl.fnst@cn.fujitsu.com> <1466587008-3933-2-git-send-email-xiecl.fnst@cn.fujitsu.com> <2b17fa8d-d2bb-d20e-2445-e010aa7066b1@redhat.com> <576A6486.4070409@cn.fujitsu.com> <233d4f8a-8d64-ffa8-9470-8c51463ef69b@redhat.com> From: Eric Blake Message-ID: <576ACB8C.7050304@redhat.com> Date: Wed, 22 Jun 2016 11:31:56 -0600 MIME-Version: 1.0 In-Reply-To: <233d4f8a-8d64-ffa8-9470-8c51463ef69b@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="xBRmBk1KNODN2Rh3Sdc95Rr7qndPj6ON2" Subject: Re: [Qemu-devel] [PATCH 1/2] blockjob: assert(cb) in the entry functions of blockjob List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini , Changlong Xie , qemu devel , Jeff Cody Cc: Kevin Wolf , Fam Zheng , Stefan Hajnoczi , Max Reitz This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --xBRmBk1KNODN2Rh3Sdc95Rr7qndPj6ON2 From: Eric Blake To: Paolo Bonzini , Changlong Xie , qemu devel , Jeff Cody Cc: Kevin Wolf , Fam Zheng , Stefan Hajnoczi , Max Reitz Message-ID: <576ACB8C.7050304@redhat.com> Subject: Re: [Qemu-devel] [PATCH 1/2] blockjob: assert(cb) in the entry functions of blockjob References: <1466587008-3933-1-git-send-email-xiecl.fnst@cn.fujitsu.com> <1466587008-3933-2-git-send-email-xiecl.fnst@cn.fujitsu.com> <2b17fa8d-d2bb-d20e-2445-e010aa7066b1@redhat.com> <576A6486.4070409@cn.fujitsu.com> <233d4f8a-8d64-ffa8-9470-8c51463ef69b@redhat.com> In-Reply-To: <233d4f8a-8d64-ffa8-9470-8c51463ef69b@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 06/22/2016 04:19 AM, Paolo Bonzini wrote: >=20 >=20 > 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 t= his. >=20 > So this suggests that the right place to put the assertion would be > block_job_create. But it's even better to add a >=20 > #define QEMU_NONNULL __attribute__((__nonnull__)) >=20 > 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. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --xBRmBk1KNODN2Rh3Sdc95Rr7qndPj6ON2 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJXasuMAAoJEKeha0olJ0NqzLcIAKO0a1bs9rTNmeGQlzqk49V+ Z3sCVQzzeFN5S8wmZrua5ThEfqSqpV0UPIhwv/nk+/yfB7HA/kk7bJ8uYT23mFl+ ZbReGNiXHSVhXQyguCNtNPmFK4m+YLCcRKua38s+ePwSOotGi629qBvPZKyGCvp6 7+auMN7z6+9jpSR1NdTpdJzm2K9hn0LGoSU/Y5V7noRBXP8lcxKK0JOtlU+Swlmw 550qSXwkRwUr9RFzO6Im6ju2M4EwQk+Os4Qy8fBOzaHzXFBM/OtrNLfa+gxOgTTX 2cf71Z2XQXojgH/3eb/N/IPwqq5nNPtptNWHsRbs/5nX/hGGIXzRpv2T6f1nN64= =lroW -----END PGP SIGNATURE----- --xBRmBk1KNODN2Rh3Sdc95Rr7qndPj6ON2--