From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34490) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zyi59-0006xK-Rn for qemu-devel@nongnu.org; Tue, 17 Nov 2015 10:22:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zyi51-0007ux-LA for qemu-devel@nongnu.org; Tue, 17 Nov 2015 10:22:04 -0500 References: <1447755611-11117-1-git-send-email-famz@redhat.com> <20151117103428.GA27541@stefanha-x1.localdomain> From: Laurent Vivier Message-ID: <564B4607.4060807@redhat.com> Date: Tue, 17 Nov 2015 16:21:43 +0100 MIME-Version: 1.0 In-Reply-To: <20151117103428.GA27541@stefanha-x1.localdomain> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v3] virtio-blk: Fix double completion for werror=stop List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi , Fam Zheng Cc: Kevin Wolf , qemu-block@nongnu.org, pl@kamp.de, qemu-devel@nongnu.org, qemu-stable@nongnu.org, pbonzini@redhat.com, dgibson@redhat.com On 17/11/2015 11:34, Stefan Hajnoczi wrote: > On Tue, Nov 17, 2015 at 06:20:11PM +0800, Fam Zheng wrote: >> When a request R is absorbed by request M, it is appended to the >> "mr_next" queue led by M, and is completed together with the completion >> of M, in virtio_blk_rw_complete. >> >> During DMA restart in virtio_blk_dma_restart_bh, requests in s->rq are >> parsed and submitted again, possibly with a stale req->mr_next. It could >> be a problem if the request merging in virtio_blk_handle_request hasn't >> refreshed every mr_next pointer, in which case, virtio_blk_rw_complete >> could walk through unexpected requests following the stale pointers. >> >> Fix this by unsetting the pointer in virtio_blk_rw_complete. It is safe >> because this req is either completed and freed right away, or it will be >> restarted and parsed from scratch out of the vq later. >> >> Signed-off-by: Fam Zheng >> >> --- >> >> v3: Fix as Stefan suggested. >> --- >> hw/block/virtio-blk.c | 4 ++++ >> 1 file changed, 4 insertions(+) > > Thanks, applied to my block tree: > https://github.com/stefanha/qemu/commits/block I have also tested this one and it works fine. Tested-by: Laurent Vivier Laurent