From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53930) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XgXEn-0000zS-OQ for qemu-devel@nongnu.org; Tue, 21 Oct 2014 07:04:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XgXEf-0002SC-3V for qemu-devel@nongnu.org; Tue, 21 Oct 2014 07:04:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41132) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XgXEe-0002S3-S3 for qemu-devel@nongnu.org; Tue, 21 Oct 2014 07:04:17 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s9LB4GL8013739 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Tue, 21 Oct 2014 07:04:16 -0400 From: Stefan Hajnoczi Date: Tue, 21 Oct 2014 12:03:53 +0100 Message-Id: <1413889440-32577-5-git-send-email-stefanha@redhat.com> In-Reply-To: <1413889440-32577-1-git-send-email-stefanha@redhat.com> References: <1413889440-32577-1-git-send-email-stefanha@redhat.com> Subject: [Qemu-devel] [PATCH v2 04/11] blockdev: add note that block_job_cb() must be thread-safe List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Paolo Bonzini , Fam Zheng , Stefan Hajnoczi , Max Reitz This function is correct but we should document the constraint that everything must be thread-safe. Emitting QMP events and scheduling BHs are both thread-safe so nothing needs to be done here. Signed-off-by: Stefan Hajnoczi Reviewed-by: Max Reitz --- blockdev.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/blockdev.c b/blockdev.c index c46876c..a891f8e 100644 --- a/blockdev.c +++ b/blockdev.c @@ -1953,6 +1953,11 @@ out: static void block_job_cb(void *opaque, int ret) { + /* Note that this function may be executed from another AioContext besides + * the QEMU main loop. If you need to access anything that assumes the + * QEMU global mutex, use a BH or introduce a mutex. + */ + BlockDriverState *bs = opaque; const char *msg = NULL; -- 1.9.3