From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=40123 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OUcjg-0005VL-Dt for qemu-devel@nongnu.org; Fri, 02 Jul 2010 05:40:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OUcje-00023I-4S for qemu-devel@nongnu.org; Fri, 02 Jul 2010 05:40:39 -0400 Received: from verein.lst.de ([213.95.11.210]:37022) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OUcjd-000236-Ov for qemu-devel@nongnu.org; Fri, 02 Jul 2010 05:40:38 -0400 Date: Fri, 2 Jul 2010 11:40:36 +0200 From: Christoph Hellwig Subject: Re: [Qemu-devel] [PATCH 2/2] block: Handle multiwrite errors only when all requests have completed Message-ID: <20100702094036.GB21116@lst.de> References: <1277994718-14443-1-git-send-email-kwolf@redhat.com> <1277994718-14443-3-git-send-email-kwolf@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1277994718-14443-3-git-send-email-kwolf@redhat.com> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: qemu-devel@nongnu.org On Thu, Jul 01, 2010 at 04:31:58PM +0200, Kevin Wolf wrote: > Don't try to be clever by freeing all temporary data and calling all callbacks > when the return value (an error) is certain. Doing so has at least two > important problems: > > * The temporary data that is freed (qiov, possibly zero buffer) is still used > by the requests that have not yet completed. > * Calling the callbacks for all requests in the multiwrite means for the caller > that it may free buffers etc. which are still in use. > > Just remember the error value and do the cleanup when all requests have > completed. Looks good.