From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52943) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YROom-0007ui-LP for qemu-devel@nongnu.org; Fri, 27 Feb 2015 12:35:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YROol-0001KO-UQ for qemu-devel@nongnu.org; Fri, 27 Feb 2015 12:35:16 -0500 Message-ID: <54F0AAC8.3010706@redhat.com> Date: Fri, 27 Feb 2015 18:35:04 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1425045947-9271-1-git-send-email-mreitz@redhat.com> <20150227165723.GB32542@stefanha-thinkpad.redhat.com> <54F0A86E.7000608@weilnetz.de> In-Reply-To: <54F0A86E.7000608@weilnetz.de> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH v2] block/vdi: Add locking for parallel requests List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Weil , Stefan Hajnoczi , Max Reitz Cc: Kevin Wolf , qemu-devel@nongnu.org, qemu-block@nongnu.org, qemu-stable@nongnu.org On 27/02/2015 18:25, Stefan Weil wrote: > block/vdi.c was never written for multi-threaded access, see my comment > in the header of block/vdi.c: It is not using threads, only coroutines. Preemption points of coroutines are well defined, and I think that the bug could be present even in the initial AIO-based version. > * The code is not thread safe (missing locks for changes in header and > * block table, no problem with current QEMU). > > This was true in the past, but obviously later multi-threaded access was > introduced for QEMU. Locking was added for qcow2 and other drivers in > 2012 and 2013, but never for vdi. qcow2 already had locking (based on AsyncContexts) before the conversion to coroutines. Other drivers implicitly had locking because they were synchronous; locking was added because the conversion to coroutines made them asynchronous. vdi never got its locking because it was already asynchronous. Paolo