From nobody Tue Feb 10 00:21:39 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=1667318721; cv=none; d=zohomail.com; s=zohoarc; b=nIbyj+j9YLpHlzLjeXaevaxA5b1eIrSpBkP1BMVCe0Mic0xmz/75xI6W95ejCG/gG2KSkmwf3f1H97B2sB2jT0KIQvCdpVxbG5FAob2yJrgyJ4ODw7SzRC+D5zq1omdJ3hQbB6u5pPFNbPikc9/pNqJIv5NWS0JwBKnyd2wC06Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1667318721; 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=6FDt15mfZEArmZvoJOo527N0gTwrSVu9AiSo1IvcHbc=; b=SJ44nGMil6uj3qjWfpPUhFj2jKklcOD8xzZozeufgTJ1SkVJj7oni5Prz//tLL6UV2vDVkEo8ckH8xU/I7SldGVZC9Q6Mf0Dgr3wCAmC2lBDpX+2QrSCSB1qgImXHEYJ92vHd6D/vant1PENrqe2z54HI2ySYutu4Q89taoKdcw= 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 1667318721448824.3881935570748; Tue, 1 Nov 2022 09:05:21 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.435040.688052 (Exim 4.92) (envelope-from ) id 1optkv-0004bL-QR; Tue, 01 Nov 2022 16:04:49 +0000 Received: by outflank-mailman (output) from mailman id 435040.688052; Tue, 01 Nov 2022 16:04:49 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1optkv-0004bC-N6; Tue, 01 Nov 2022 16:04:49 +0000 Received: by outflank-mailman (input) for mailman id 435040; Tue, 01 Nov 2022 16:04:48 +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 1optku-0003Iv-Co for xen-devel@lists.xenproject.org; Tue, 01 Nov 2022 16:04:48 +0000 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id e8823555-59fe-11ed-91b5-6bf2151ebd3b; Tue, 01 Nov 2022 17:04:47 +0100 (CET) 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-out2.suse.de (Postfix) with ESMTPS id 7F0B61F8CA; Tue, 1 Nov 2022 16:04:47 +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 522971346F; Tue, 1 Nov 2022 16:04:47 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id ivTHEp9DYWNLcgAAMHmgww (envelope-from ); Tue, 01 Nov 2022 16:04:47 +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: e8823555-59fe-11ed-91b5-6bf2151ebd3b DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1667318687; 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=6FDt15mfZEArmZvoJOo527N0gTwrSVu9AiSo1IvcHbc=; b=OBcPfXbw3m0lmkiUREpm5sJR19ZG/eacbsBhCZcnY8iexXdGYYqawa9dUTtz+/8rbhWov1 jF5bHeVmyybe+d6pQEHVYFf4zJlygeMK/dl22cEIpWFBOcRQqEsyd7BPs5zrKIYvlzwEI9 UX7+V6eyWAg6OajcKpEZkAuh/SwNk8k= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Wei Liu , Julien Grall , Anthony PERARD Subject: [PATCH 04/12] tools/xenstore: use accounting buffering for node accounting Date: Tue, 1 Nov 2022 17:04:14 +0100 Message-Id: <20221101160422.7212-5-jgross@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20221101160422.7212-1-jgross@suse.com> References: <20221101160422.7212-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1667318722278100001 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 d437149622..7bf56b4d38 100644 --- a/tools/xenstore/xenstored_core.c +++ b/tools/xenstore/xenstored_core.c @@ -1442,7 +1442,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, node->perms.p[0].id); =20 /* * It is not possible to easily revert the changes in a transaction. @@ -1788,27 +1787,11 @@ static int do_set_perms(const void *ctx, struct con= nection *conn, old_perms =3D node->perms; domain_nbentry_dec(conn, node->perms.p[0].id); node->perms =3D perms; - if (domain_nbentry_inc(conn, node->perms.p[0].id)) { - 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, node->perms.p[0].id); + if (domain_nbentry_inc(conn, node->perms.p[0].id)) return ENOMEM; - } =20 - if (write_node(conn, node, false)) { - int saved_errno =3D errno; - - domain_nbentry_dec(conn, node->perms.p[0].id); - node->perms =3D old_perms; - /* No failure possible as above. */ - domain_nbentry_inc(conn, node->perms.p[0].id); - - 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 9959b2f2e4..ead3893fc1 100644 --- a/tools/xenstore/xenstored_domain.h +++ b/tools/xenstore/xenstored_domain.h @@ -20,9 +20,9 @@ #define _XENSTORED_DOMAIN_H =20 enum { + ACC_NODES, ACC_REQ_N, /* Number of elements per request and domain. */ - ACC_NODES =3D ACC_REQ_N, - ACC_TR_N, /* Number of elements per transaction and domain. */ + ACC_TR_N =3D ACC_REQ_N, /* Number of elements per transaction and domain.= */ ACC_N =3D ACC_TR_N /* Number of elements per domain. */ }; =20 --=20 2.35.3