From nobody Mon Feb 9 13:22:23 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; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1680678279; cv=none; d=zohomail.com; s=zohoarc; b=ameIv+mnRr30z+7V9fEcQbibdNZVfpFlC+9pggS5uUBrsGMBPhbsGHzZXIs/FepDhfcw8zgPlkv4nB+zGz+MWFu7Emx3qQSO/p25bv9EhEmd1OOxKBxqHOyYvW5GMFT/BhQZkMIl+phoI1ytSMKSGU3rh+BcJ2aLhcrhSDMpsnM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1680678279; 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=zpWITZM/jycFaeqzkIbP5IXI6C0MvtvZCqGsXHa9q9E=; b=X2Z9qQEIveSv47Lma6NCm9T+C3UDmYAGxw9phtpsyXKYrcfCZr2hS03XhL0KIsrn9auJXH+OE9oOHNMgKpuUQoCkhf2Ct28ret/1fY1dpNItG7pJ5MEllaLg3PpJ/lXEvHhAVmNuv+h7lEmrtK59A8P5kL70VXmXTy21PrC7IAo= 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; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1680678279410849.3729422592102; Wed, 5 Apr 2023 00:04:39 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.518237.804578 (Exim 4.92) (envelope-from ) id 1pjxBt-0004Ar-HX; Wed, 05 Apr 2023 07:04:21 +0000 Received: by outflank-mailman (output) from mailman id 518237.804578; Wed, 05 Apr 2023 07:04:21 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pjxBt-0004Ak-Em; Wed, 05 Apr 2023 07:04:21 +0000 Received: by outflank-mailman (input) for mailman id 518237; Wed, 05 Apr 2023 07:04:20 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pjxBs-0002UC-Dn for xen-devel@lists.xenproject.org; Wed, 05 Apr 2023 07:04:20 +0000 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 15fee7ff-d380-11ed-85db-49a42c6b2330; Wed, 05 Apr 2023 09:04:19 +0200 (CEST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 943DD229D0; Wed, 5 Apr 2023 07:04:19 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 6637513A31; Wed, 5 Apr 2023 07:04:19 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id qRGQF3MdLWSuEwAAMHmgww (envelope-from ); Wed, 05 Apr 2023 07:04:19 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 15fee7ff-d380-11ed-85db-49a42c6b2330 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1680678259; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=zpWITZM/jycFaeqzkIbP5IXI6C0MvtvZCqGsXHa9q9E=; b=kTpVk4DwUfgPK7n3BwU0oPzleMoDtWJ447NcVfWzVjgXB+gyyHKQnZFa0k/Vr2vrOq9/LD HF4LHvHcGRpZHl9AJDKHA0UZmHI75Hu6Rn8600M4F1KRoyM3hM4yAivBTD1QMT3z8+BXXv 8+7tdsP+1izd8Xl53RPN1wneBPWYAXY= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Wei Liu , Julien Grall , Anthony PERARD Subject: [PATCH v4 05/13] tools/xenstore: use accounting buffering for node accounting Date: Wed, 5 Apr 2023 09:03:41 +0200 Message-Id: <20230405070349.25293-6-jgross@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230405070349.25293-1-jgross@suse.com> References: <20230405070349.25293-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1680678280121100003 Content-Type: text/plain; charset="utf-8" Add the node accounting to the accounting information buffering in order to avoid having to undo it in case of failure. Signed-off-by: Juergen Gross --- tools/xenstore/xenstored_core.c | 21 ++------------------- tools/xenstore/xenstored_domain.h | 4 ++-- 2 files changed, 4 insertions(+), 21 deletions(-) diff --git a/tools/xenstore/xenstored_core.c b/tools/xenstore/xenstored_cor= e.c index 84335f5f3d..92a40ccf3f 100644 --- a/tools/xenstore/xenstored_core.c +++ b/tools/xenstore/xenstored_core.c @@ -1452,7 +1452,6 @@ static void destroy_node_rm(struct connection *conn, = struct node *node) static int destroy_node(struct connection *conn, struct node *node) { destroy_node_rm(conn, node); - domain_nbentry_dec(conn, get_node_owner(node)); =20 /* * It is not possible to easily revert the changes in a transaction. @@ -1797,27 +1796,11 @@ static int do_set_perms(const void *ctx, struct con= nection *conn, old_perms =3D node->perms; domain_nbentry_dec(conn, get_node_owner(node)); node->perms =3D perms; - if (domain_nbentry_inc(conn, get_node_owner(node))) { - node->perms =3D old_perms; - /* - * This should never fail because we had a reference on the - * domain before and Xenstored is single-threaded. - */ - domain_nbentry_inc(conn, get_node_owner(node)); + if (domain_nbentry_inc(conn, get_node_owner(node))) return ENOMEM; - } =20 - if (write_node(conn, node, false)) { - int saved_errno =3D errno; - - domain_nbentry_dec(conn, get_node_owner(node)); - node->perms =3D old_perms; - /* No failure possible as above. */ - domain_nbentry_inc(conn, get_node_owner(node)); - - errno =3D saved_errno; + if (write_node(conn, node, false)) return errno; - } =20 fire_watches(conn, ctx, name, node, false, &old_perms); send_ack(conn, XS_SET_PERMS); diff --git a/tools/xenstore/xenstored_domain.h b/tools/xenstore/xenstored_d= omain.h index 6355ad4f37..e669f57b80 100644 --- a/tools/xenstore/xenstored_domain.h +++ b/tools/xenstore/xenstored_domain.h @@ -25,9 +25,9 @@ * a per transaction array. */ enum accitem { + ACC_NODES, ACC_REQ_N, /* Number of elements per request. */ - ACC_NODES =3D ACC_REQ_N, - ACC_TR_N, /* Number of elements per transaction. */ + ACC_TR_N =3D ACC_REQ_N, /* Number of elements per transaction. */ ACC_N =3D ACC_TR_N, /* Number of elements per domain. */ }; =20 --=20 2.35.3