From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47749) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZmMTB-0008Ie-OY for qemu-devel@nongnu.org; Wed, 14 Oct 2015 09:51:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZmMTA-0008Kw-UE for qemu-devel@nongnu.org; Wed, 14 Oct 2015 09:51:53 -0400 Date: Wed, 14 Oct 2015 15:51:45 +0200 From: Stefan Hajnoczi Message-ID: <20151014135145.GB16162@stefanha-thinkpad.redhat.com> References: <1444731375-14716-1-git-send-email-famz@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1444731375-14716-1-git-send-email-famz@redhat.com> Subject: Re: [Qemu-devel] [PATCH] Revert "blockdev: add note that block_job_cb() must be thread-safe" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng Cc: kwolf@redhat.com, pbonzini@redhat.com, qemu-devel@nongnu.org, qemu-block@nongnu.org On Tue, Oct 13, 2015 at 06:16:15PM +0800, Fam Zheng wrote: > This reverts commit 723c5d93c51bdb3adbc238ce90195c0864aa6cd5. > > block_job_cb is called by block_job_completed, which is always called in > a main loop bottom half in existing block jobs. So we don't need to > worry about thread-safety here. This is not correct. Search for block_job_completed() callers. For example, block/stream.c has early exit cases that call block_job_completed() from the coroutine (i.e. dispatched from a coroutine in another AioContext+IOThread). I think you are assuming that all block_job_completed() callers are called from a function scheduled using block_job_defer_to_main_loop(). Please double-check this. Thanks, Stefan