From nobody Tue Feb 10 02:54:47 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1599127570; cv=none; d=zohomail.com; s=zohoarc; b=O6ODLA50V4N5g0pcH0va6d570PoVu2S43Z0D4Ve3OBpKA5QL8NS9L8uap1zKN40GKv1T5kfgbg/izrEeVaCURHzQWaOkKxvBlUq8hyAqvfb68NXsnvvecctGztNCHAiRWkiAr9dv7JopxN0jqT+Rykfp6/g94TvZwzG15aYX4ak= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599127570; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=DPBUlM35jhYlf960TGWbjpD76dUBghbgq1ala0F7pCc=; b=mdNEPVmOS3gfHJD4nBr6GX8pyXmknxTSzahoqVTxo+kM4SvfMms4t2PrZA6Y5yOhKhSfebM9bQWtWryW82BDze5OxAMglRMD9/ksnallvf2NU4aPmXa7JemOaOv3giB5d496055o41RxNaSUcyQYBhCRCMYg12U+DMpESzLMjKQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1599127570765574.5467453766289; Thu, 3 Sep 2020 03:06:10 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kDm7n-0000yH-3X; Thu, 03 Sep 2020 10:05:47 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kDm7l-0000xt-Cm for xen-devel@lists.xenproject.org; Thu, 03 Sep 2020 10:05:45 +0000 Received: from mail.xenproject.org (unknown [104.130.215.37]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 60b0fc1e-eacb-467d-b6a8-20b92b3dc9c3; Thu, 03 Sep 2020 10:05:42 +0000 (UTC) Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kDm7h-0005b0-1b; Thu, 03 Sep 2020 10:05:41 +0000 Received: from host86-176-94-160.range86-176.btcentralplus.com ([86.176.94.160] helo=u2f063a87eabd5f.home) by xenbits.xenproject.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kDm7g-0007WE-P7; Thu, 03 Sep 2020 10:05:40 +0000 X-Inumbo-ID: 60b0fc1e-eacb-467d-b6a8-20b92b3dc9c3 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=DPBUlM35jhYlf960TGWbjpD76dUBghbgq1ala0F7pCc=; b=IncWCt6ubITXyNjv8DHCyDfKkO g1W68Sk12Cro7FDApSiiXjkSw63RYultcM1dLis3fPtG/Fdh8PDktWoIo6L4zPmN9JSZq4RvFXQQM piHw1KFlQ0BQkDAULS8neNFxVrxvrwBx5iD2SPRvRmFr9ypnUuQldLl3ZlQeCcVySU9k=; From: Paul Durrant To: xen-devel@lists.xenproject.org Cc: Paul Durrant , Ian Jackson , Wei Liu , Anthony PERARD Subject: [PATCH 2/2] libxl: do not automatically force detach of block devices Date: Thu, 3 Sep 2020 11:05:37 +0100 Message-Id: <20200903100537.1337-3-paul@xen.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200903100537.1337-1-paul@xen.org> References: <20200903100537.1337-1-paul@xen.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: pass (identity @xen.org) Content-Type: text/plain; charset="utf-8" From: Paul Durrant The manpage for 'xl' documents that guest co-operation is required for a (n= on- forced) block-detach operation and that it may consequently fail. Currently, however, the implementation of generic device removal means that a time-out of a block-detach is being automatically re-tried with the force flag set rather than failing. This patch stops such behaviour. Signed-off-by: Paul Durrant --- Cc: Ian Jackson Cc: Wei Liu Cc: Anthony PERARD --- tools/libxl/libxl_device.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tools/libxl/libxl_device.c b/tools/libxl/libxl_device.c index 0381c5d509..d17ca78848 100644 --- a/tools/libxl/libxl_device.c +++ b/tools/libxl/libxl_device.c @@ -1092,7 +1092,8 @@ static void device_backend_callback(libxl__egc *egc, = libxl__ev_devstate *ds, =20 if (rc =3D=3D ERROR_TIMEDOUT && aodev->action =3D=3D LIBXL__DEVICE_ACTION_REMOVE && - !aodev->force) { + !aodev->force && + aodev->dev->kind !=3D LIBXL__DEVICE_KIND_VBD) { LOGD(DEBUG, aodev->dev->domid, "Timeout reached, initiating forced= remove"); aodev->force =3D 1; libxl__initiate_device_generic_remove(egc, aodev); @@ -1103,7 +1104,8 @@ static void device_backend_callback(libxl__egc *egc, = libxl__ev_devstate *ds, LOGD(ERROR, aodev->dev->domid, "unable to %s device with path %s", libxl__device_action_to_string(aodev->action), libxl__device_backend_path(gc, aodev->dev)); - goto out; + if (!aodev->force) + goto out; } =20 device_hotplug(egc, aodev); @@ -1319,7 +1321,8 @@ static void device_hotplug_done(libxl__egc *egc, libx= l__ao_device *aodev) device_hotplug_clean(gc, aodev); =20 /* Clean xenstore if it's a disconnection */ - if (aodev->action =3D=3D LIBXL__DEVICE_ACTION_REMOVE) { + if (aodev->action =3D=3D LIBXL__DEVICE_ACTION_REMOVE && + (aodev->force || !aodev->rc)) { rc =3D libxl__device_destroy(gc, aodev->dev); if (!aodev->rc) aodev->rc =3D rc; --=20 2.20.1