From nobody Mon Feb 9 17:05:15 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=1680164256; cv=none; d=zohomail.com; s=zohoarc; b=neAUzFnOQ1U2RPkr99QNB9pPM/maBkkgpHJfrboN4w58WmT0qexhhsFCi2XH6IGz6xQqTuGml7BcE2M+QWKZVrYM82ReaRQXq7gfrz1VAECdL26XKC1mc4bvJnWWWKzhTp7IWUw/LUlIfVuEn9E7klDTJrjAzO/KZlRKShpOuKM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1680164256; 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=CNm/bxuQPoJ9Ne3UkeQM5FWF59CbDuWvwqzSyTb8L1CJ69co2X9fOYbdrkop0d6325g6P4pawWutB81o/eZBQnSPqXrgvkdAaIQpSPulP8aqLB4paO/9PUyLH/uA/eSQdQp/stmdqjwHqEP04zSQvdwJqGbz6q7a7GvMInrqg+k= 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 1680164256044752.7920295855134; Thu, 30 Mar 2023 01:17:36 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.516457.800583 (Exim 4.92) (envelope-from ) id 1phnTC-0003Xh-4c; Thu, 30 Mar 2023 08:17:18 +0000 Received: by outflank-mailman (output) from mailman id 516457.800583; Thu, 30 Mar 2023 08:17:18 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1phnTC-0003XY-1Z; Thu, 30 Mar 2023 08:17:18 +0000 Received: by outflank-mailman (input) for mailman id 516457; Thu, 30 Mar 2023 08:17:16 +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 1phnTA-0001oz-2c for xen-devel@lists.xenproject.org; Thu, 30 Mar 2023 08:17:16 +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 47a9b8b5-ced3-11ed-85db-49a42c6b2330; Thu, 30 Mar 2023 10:17:15 +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 5548421B24; Thu, 30 Mar 2023 08:17:15 +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 2A32D138FF; Thu, 30 Mar 2023 08:17:15 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id t8UECYtFJWQEEgAAMHmgww (envelope-from ); Thu, 30 Mar 2023 08:17:15 +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: 47a9b8b5-ced3-11ed-85db-49a42c6b2330 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1680164235; 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=VH/haiIOd8XRqrRpX9crp/FKzgzCob1pWzHhnNmDhJ32WW7TZOMEV29dgRm70lm32m+tWi UfSuM3GqnbhjopOJaNb28vUi2MbNAilRyfWdqD1893Q41p4zA1QMfE9F3FB1G9IsW54e8r dEpNwBMD5qlc7BE5klr6mWFwF7ljvJI= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Wei Liu , Julien Grall , Anthony PERARD Subject: [PATCH v3 05/13] tools/xenstore: use accounting buffering for node accounting Date: Thu, 30 Mar 2023 10:16:36 +0200 Message-Id: <20230330081644.11480-6-jgross@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230330081644.11480-1-jgross@suse.com> References: <20230330081644.11480-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1680164257565100003 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