From nobody Thu Apr 25 07:31:54 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1565191717; cv=none; d=zoho.com; s=zohoarc; b=dp2k/5rnXtIlkPJOEIg4FJV11NKKmqKs/Aj4rv7OKmkLinGr3xUDMuXx9Ylckp36RKTZF9z8Dn2m0O8aHbJbmVPPxSBKekaWYyvmpAmBMsW2idCAZgOsKfSFkZoSOkRLbQ4prqg09oSy0wbBbU69+H4iD9++bK7sNvXJio0vgt0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565191717; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=lGOy4DIAmlxNbYaeNf6OhgWw4FnDmrMnrzyBBpcN4Ww=; b=hN2UemMBZ30ugsejlwEgoRyjJyGp44xJQRl8CvUO0rT9b7HZO0M/kVFLwkSTL7IpouOmNA1HXu5bnPw87xAI/oOra0k9EikWwrplopFhzmgEcMTObTtDQwFAFKE2ouwLKrDYcLc9uVa1Ae72Wic9Diiucp/JW3IjT9bf2UE5fbk= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) 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 156519171725195.56642825565427; Wed, 7 Aug 2019 08:28:37 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hvNqb-0005zE-VO; Wed, 07 Aug 2019 15:27:29 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hvNqa-0005z5-MK for xen-devel@lists.xenproject.org; Wed, 07 Aug 2019 15:27:28 +0000 Received: from merlin.infradead.org (unknown [2001:8b0:10b:1231::1]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id dc7ecb8d-b927-11e9-8980-bc764e045a96; Wed, 07 Aug 2019 15:27:27 +0000 (UTC) Received: from [2001:8b0:10b:1:4a2a:e3ff:fe14:8625] (helo=u3832b3a9db3152.ant.amazon.com) by merlin.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1hvNqS-0008VR-9y; Wed, 07 Aug 2019 15:27:20 +0000 X-Inumbo-ID: dc7ecb8d-b927-11e9-8980-bc764e045a96 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Mime-Version:Content-Type:References: In-Reply-To:Date:Cc:To:From:Subject:Message-ID:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=2ah2KARrPPPNEfzrTcPYCV3VOOSWaU/rtZHeL6KFuYI=; b=cITsgGiT56wMMUsIkf6DGAvzp AsCU80SWwJw/2MXs4uM/Bdj55cvj4J1QlVCZ6fUNaRZYJKOVwzGiSBBqQmemiiUvQNCBzC9jIvEvo DFSX5w1zIaytOKozBTD+Vc9onYQzAwtvYw0ah+hWDjr2xo3XwXVIxBz2vnA4uQ7y3auFbBwHKHQPO VV1p8H3tRYb+9a4PyZJDhUfp9oqh6Flfb4bZpmROynLoFRytZmxLEte7twidh03LDlEKZCcAJnnwI yhOD9THvR/AaweOS0Jgba9LlR5QPqcv9vj/1Cl7nhdQCLWBa0mxxhylBqtb8fjjDqGFu+mZTwenrH G4uLLkZaA==; Message-ID: <5aa0116479240e5c2751fbaa745a6071a98f9480.camel@infradead.org> From: David Woodhouse To: Ian Jackson , Wei Liu Date: Wed, 07 Aug 2019 16:27:18 +0100 In-Reply-To: <936c39728ca0c96d0666551046cf08ebc8774dd8.camel@infradead.org> References: <936c39728ca0c96d0666551046cf08ebc8774dd8.camel@infradead.org> X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.1 Mime-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by merlin.infradead.org. See http://www.infradead.org/rpr.html Subject: [Xen-devel] [PATCH v2] tools/xenstore: Do not abort xenstore-ls if a node disappears while iterating 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: xen-devel@lists.xenproject.org Content-Type: multipart/mixed; boundary="===============7330992219562736064==" Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Zoho-Virus-Status: 1 X-ZohoMail-DKIM: fail (Header signature does not verify) --===============7330992219562736064== Content-Type: multipart/signed; micalg="sha-256"; protocol="application/x-pkcs7-signature"; boundary="=-VbSea165TepHZwaq+zHj" --=-VbSea165TepHZwaq+zHj Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable From: David Woodhouse When recursing, a node sometimes disappears. Deal with it and move on instead of aborting and failing to print the rest of what was requested. Either EACCES or ENOENT may occur as the result of race conditions with updates; any other error should abort as before. Signed-off-by: David Woodhouse --- And thus did an extremely sporadic "not going to delete that device because it already doesn't exist" failure mode become painfully obvious in retrospect... tools/xenstore/xenstore_client.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tools/xenstore/xenstore_client.c b/tools/xenstore/xenstore_cli= ent.c index 3afc630ab8..9fcd3d2f9e 100644 --- a/tools/xenstore/xenstore_client.c +++ b/tools/xenstore/xenstore_client.c @@ -148,14 +148,20 @@ static void do_ls(struct xs_handle *h, char *path, in= t cur_depth, int show_perms int i; unsigned int num, len; =20 + e =3D xs_directory(h, XBT_NULL, path, &num); + if (e =3D=3D NULL) { + if (cur_depth && (errno =3D=3D ENOENT || errno =3D=3D EACCES)) { + /* If a node disappears while recursing, silently move on. */ + return; + } + + err(1, "xs_directory (%s)", path); + } + newpath =3D malloc(STRING_MAX); if (!newpath) err(1, "malloc in do_ls"); =20 - e =3D xs_directory(h, XBT_NULL, path, &num); - if (e =3D=3D NULL) - err(1, "xs_directory (%s)", path); - for (i =3D 0; i