From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58051) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dMyZJ-0002tH-D8 for qemu-devel@nongnu.org; Mon, 19 Jun 2017 11:26:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dMyZE-0001rr-N5 for qemu-devel@nongnu.org; Mon, 19 Jun 2017 11:26:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41230) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dMyZE-0001rV-Gc for qemu-devel@nongnu.org; Mon, 19 Jun 2017 11:26:16 -0400 From: Juan Quintela In-Reply-To: <20170616160658.32290-1-famz@redhat.com> (Fam Zheng's message of "Sat, 17 Jun 2017 00:06:58 +0800") References: <20170616160658.32290-1-famz@redhat.com> Reply-To: quintela@redhat.com Date: Mon, 19 Jun 2017 17:26:03 +0200 Message-ID: <8760fsatis.fsf@secure.mitica> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH] migration: Fix race of image locking between src and dst List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng Cc: qemu-devel@nongnu.org, kwolf@redhat.com, zhanghailiang , peterx@redhat.com, mreitz@redhat.com, stefanha@redhat.com, Peter Maydell , "Dr. David Alan Gilbert" , jsnow@redhat.com Fam Zheng wrote: > Previously, dst side will immediately try to lock the write byte upon > receiving QEMU_VM_EOF, but at src side, bdrv_inactivate_all() is only > done after sending it. If the src host is under load, dst may fail to > acquire the lock due to racing with the src unlocking it. > > Fix this by hoisting the bdrv_inactivate_all() operation before > QEMU_VM_EOF. > > N.B. A further improvement could possibly be done to cleanly handover > locks between src and dst, so that there is no window where a third QEMU > could steal the locks and prevent src and dst from running. > > Reported-by: Peter Maydell > Signed-off-by: Fam Zheng Reviewed-by: Juan Quintela