Received: from eggs.gnu.org ([2001:4830:134:3::10]:56887) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aybu6-0008Su-KT for qemu-devel@nongnu.org; Fri, 06 May 2016 05:18:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aybtv-0005dO-0a for qemu-devel@nongnu.org; Fri, 06 May 2016 05:18:29 -0400 From: Alberto Garcia In-Reply-To: <1462354765-14037-3-git-send-email-kwolf@redhat.com> References: <1462354765-14037-1-git-send-email-kwolf@redhat.com> <1462354765-14037-3-git-send-email-kwolf@redhat.com> Date: Fri, 06 May 2016 11:17:00 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH 02/14] block: Cancel jobs first in bdrv_close_all() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf , qemu-block@nongnu.org Cc: mreitz@redhat.com, jcody@redhat.com, jsnow@redhat.com, qemu-devel@nongnu.org On Wed 04 May 2016 11:39:13 AM CEST, Kevin Wolf wrote: > void bdrv_close_all(void) > { > - BlockDriverState *bs; > - AioContext *aio_context; > + block_job_cancel_sync_all(); > > /* Drop references from requests still in flight, such as canceled block > * jobs whose AIO context has not been polled yet */ > @@ -2174,26 +2173,6 @@ void bdrv_close_all(void) > > blk_remove_all_bs(); > blockdev_close_all_bdrv_states(); > - > - /* Cancel all block jobs */ > - while (!QTAILQ_EMPTY(&all_bdrv_states)) { > - QTAILQ_FOREACH(bs, &all_bdrv_states, bs_list) { > - aio_context = bdrv_get_aio_context(bs); > - > - aio_context_acquire(aio_context); > - if (bs->job) { > - block_job_cancel_sync(bs->job); > - aio_context_release(aio_context); > - break; > - } > - aio_context_release(aio_context); > - } > - > - /* All the remaining BlockDriverStates are referenced directly or > - * indirectly from block jobs, so there needs to be at least one BDS > - * directly used by a block job */ > - assert(bs); > - } > } You could add an assert(QTAILQ_EMPTY(&all_bdrv_states)) as it was suggested some days ago. The rest looks good. Reviewed-by: Alberto Garcia Berto