From patchwork Wed May 22 14:51:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony PERARD X-Patchwork-Id: 10956065 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 12218912 for ; Wed, 22 May 2019 14:54:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0360128BB7 for ; Wed, 22 May 2019 14:54:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EBAB428B7D; Wed, 22 May 2019 14:54:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 78E2D28BB7 for ; Wed, 22 May 2019 14:54:29 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hTSbH-0006tv-S7; Wed, 22 May 2019 14:52:15 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hTSbG-0006tq-3z for xen-devel@lists.xenproject.org; Wed, 22 May 2019 14:52:14 +0000 X-Inumbo-ID: 2d8e82f4-7ca1-11e9-bc90-f35a84c7d611 Received: from esa3.hc3370-68.iphmx.com (unknown [216.71.145.155]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 2d8e82f4-7ca1-11e9-bc90-f35a84c7d611; Wed, 22 May 2019 14:52:11 +0000 (UTC) Authentication-Results: esa3.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=anthony.perard@citrix.com; spf=Pass smtp.mailfrom=anthony.perard@citrix.com; spf=None smtp.helo=postmaster@MIAPEX02MSOL02.citrite.net Received-SPF: None (esa3.hc3370-68.iphmx.com: no sender authenticity information available from domain of anthony.perard@citrix.com) identity=pra; client-ip=23.29.105.83; receiver=esa3.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa3.hc3370-68.iphmx.com: domain of anthony.perard@citrix.com designates 23.29.105.83 as permitted sender) identity=mailfrom; client-ip=23.29.105.83; receiver=esa3.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:23.29.105.83 ip4:162.221.156.83 ~all" Received-SPF: None (esa3.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@MIAPEX02MSOL02.citrite.net) identity=helo; client-ip=23.29.105.83; receiver=esa3.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@MIAPEX02MSOL02.citrite.net"; x-conformance=sidf_compatible IronPort-SDR: 8KztN3V2gd9am0NFC/sQeoBbMmR5PGYKQE9WfY1uevOmaVqXgOQ+9mPg60yQhgnCdPXkPtMmRp N6Eq6CGKlUfoBjBwt1+xptHw+iI0F0GXFSEpMKbRH77j1kqOAv10Ui4DDhD0yHAejmZbPxF/DL V6mGVINyuw/tsGzkT5z0X7dq7xNcQkSfJKRAa6iPIJXR1WzDXL0/R0ypqV2uRtI9HvvnDzEEZ6 z+aRVPuKin/GfWESO6cglWgB6yFBEPEYGEz0ecgjCCGXU/aedFGI6dCKgTIo1bIwlcmfOEhD/5 NoE= X-SBRS: 2.7 X-MesageID: 783595 X-Ironport-Server: esa3.hc3370-68.iphmx.com X-Remote-IP: 23.29.105.83 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.60,499,1549947600"; d="scan'208";a="783595" From: Anthony PERARD To: Date: Wed, 22 May 2019 15:51:40 +0100 Message-ID: <20190522145140.12943-1-anthony.perard@citrix.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Subject: [Xen-devel] [PATCH qemu-xen 4.10 & 4.11] xen_disk: Disable file locking for the PV disk backend X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Anthony PERARD , Olaf Hering , Wei Liu , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Since QEMU 2.10 (or qemu-xen-4.10), qemu locks disk images to avoid them been re-opened in a different qemu process. With Xen, there are two issues: - For HVM guests, a disk image can be open twice! One by the emulation driver, and one by the PV backend. - During migration, the qemu process of the newly spawned domain may attempt to access the disk image before the domain been migrated and the qemu process are been completely destroyed. Migration of HVM guest as been taken care of in libxl, but migration of PV guest with qdisk and HVM guest attempting to access the PV disk before unplugging the emulated disk are still an issue. For these reasons, we don't want to have QEMU use a locking mechanism with the PV backend. This is already done by db9ff46eeb in QEMU upstream, or QEMU 4.0. Affected version of QEMU are: - qemu-xen of Xen 4.10 and 4.11 - QEMU 2.10, 2.11, 2.12, 3.0 and 3.1 Signed-off-by: Anthony PERARD --- Hi Olaf, Roger, Wei, Instead of a fix in libxl (with the reverted patch "libxl: fix migration of PV and PVH domUs with and without qemu"), what do you think of this QEMU patch? It is much simpler that trying to work around the issue in libxl, and it fix one more problem that still exist. This patch is only for stable branches as Xen unstable already have a qemu with a similar patch. Can you give it a try with one of the affected qemu? (qemu-xen-4.10 or qemu-xen-4.11) Thanks, --- hw/block/xen_disk.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/hw/block/xen_disk.c b/hw/block/xen_disk.c index e431bd89e8..cbff174a98 100644 --- a/hw/block/xen_disk.c +++ b/hw/block/xen_disk.c @@ -1084,11 +1084,18 @@ static int blk_connect(struct XenDevice *xendev) Error *local_err = NULL; QDict *options = NULL; + options = qdict_new(); + if (strcmp(blkdev->fileproto, "")) { - options = qdict_new(); qdict_put_str(options, "driver", blkdev->fileproto); } + /* + * It is necessary to turn file locking off as an emulated device + * may have already opened the same image file. + */ + qdict_put_str(options, "file.locking", "off"); + /* setup via xenbus -> create new block driver instance */ xen_pv_printf(&blkdev->xendev, 2, "create new bdrv (xenbus setup)\n"); blkdev->blk = blk_new_open(blkdev->filename, NULL, options,