From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45048) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c2Hts-00078m-ID for qemu-devel@nongnu.org; Thu, 03 Nov 2016 09:17:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c2Htm-0004ng-Sc for qemu-devel@nongnu.org; Thu, 03 Nov 2016 09:17:48 -0400 Date: Thu, 3 Nov 2016 14:17:34 +0100 From: Kevin Wolf Message-ID: <20161103131734.GC5352@noname.redhat.com> References: <1478109056-25198-1-git-send-email-jsnow@redhat.com> <1478109056-25198-6-git-send-email-jsnow@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1478109056-25198-6-git-send-email-jsnow@redhat.com> Subject: Re: [Qemu-devel] [PATCH v3 5/6] blockjob: refactor backup_start as backup_job_create List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: John Snow Cc: qemu-block@nongnu.org, vsementsov@virtuozzo.com, stefanha@redhat.com, pbonzini@redhat.com, jcody@redhat.com, qemu-devel@nongnu.org Am 02.11.2016 um 18:50 hat John Snow geschrieben: > Refactor backup_start as backup_job_create, which only creates the job, > but does not automatically start it. The old interface, 'backup_start', > is not kept in favor of limiting the number of nearly-identical interfaces > that would have to be edited to keep up with QAPI changes in the future. > > Callers that wish to synchronously start the backup_block_job can > instead just call block_job_start immediately after calling > backup_job_create. > > Transactions are updated to use the new interface, calling block_job_start > only during the .commit phase, which helps prevent race conditions where > jobs may finish before we even finish building the transaction. This may > happen, for instance, during empty block backup jobs. > > Reported-by: Vladimir Sementsov-Ogievskiy > Signed-off-by: John Snow > +static void drive_backup_commit(BlkActionState *common) > +{ > + DriveBackupState *state = DO_UPCAST(DriveBackupState, common, common); > + if (state->job) { > + block_job_start(state->job); > + } > } How could state->job ever be NULL? Same question for abort, and for blockdev_backup_commit/abort. Kevin