From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46613) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1asech-0005LD-Bm for qemu-devel@nongnu.org; Tue, 19 Apr 2016 19:00:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1asecg-0007js-5a for qemu-devel@nongnu.org; Tue, 19 Apr 2016 18:59:59 -0400 From: Max Reitz Date: Wed, 20 Apr 2016 00:59:46 +0200 Message-Id: <1461106788-14285-1-git-send-email-mreitz@redhat.com> Subject: [Qemu-devel] [PATCH for-2.6 0/2] block/mirror: Fix mirroring with guest I/O load List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-block@nongnu.org Cc: qemu-devel@nongnu.org, Max Reitz , Kevin Wolf , Jeff Cody , Fam Zheng Bug report: https://bugs.launchpad.net/qemu/+bug/1570134 If you are doing a mirror operation (I just tested with block-commit on the active layer, but I guess any mirroring will do) while the guest has rather heavy I/O load (or light I/O also, you just need to be more unlucky) will lead to the cache of mirror's bitmap iterator becoming stale and not reflect all dirty bits which are set in the drive's dirty bitmap. Generally, this isn't bad because we just restart over once we are through, and this will refresh the iterator's cache. But it is bad for the code which tries to find a contiguous range of dirty chunks. This code needs to clear the bits in the iterator, so it invokes hbitmap_iter_next() for every contiguous dirty chunk found. But then it has to make sure that this actually cleared that chunk's dirty bit: And if the iterator's cache is stale, this may not be the case. Then, we run into a failed assertion. But detecting this discrepancy is easy and refreshing the iterator's cache is too; and then, the assertion holds. Besides this (patch 2), the code which is supposed to wait for overlapping in-flight requests on the first chunk of a dirty range is dead. I didn't produce any problems regarding that, but I'm sure it's not good. Patch 1 fixes that. Max Reitz (2): block/mirror: Revive dead yielding code block/mirror: Refresh stale bitmap iterator cache block/mirror.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) -- 2.8.0