From patchwork Thu Mar 30 08:16:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juergen Gross X-Patchwork-Id: 13193561 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2C36EC6FD1D for ; Thu, 30 Mar 2023 08:17:13 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.516450.800542 (Exim 4.92) (envelope-from ) id 1phnSp-0001pt-Qy; Thu, 30 Mar 2023 08:16:55 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 516450.800542; Thu, 30 Mar 2023 08:16:55 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1phnSp-0001pm-O7; Thu, 30 Mar 2023 08:16:55 +0000 Received: by outflank-mailman (input) for mailman id 516450; Thu, 30 Mar 2023 08:16:54 +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 1phnSo-0001oz-3z for xen-devel@lists.xenproject.org; Thu, 30 Mar 2023 08:16:54 +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 3a53ecec-ced3-11ed-85db-49a42c6b2330; Thu, 30 Mar 2023 10:16:53 +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 C328621B25; Thu, 30 Mar 2023 08:16:52 +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 8B9CF138FF; Thu, 30 Mar 2023 08:16:52 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 9+HBIHRFJWTUEQAAMHmgww (envelope-from ); Thu, 30 Mar 2023 08:16:52 +0000 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: 3a53ecec-ced3-11ed-85db-49a42c6b2330 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1680164212; 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=jR2CaVJDZ2qBizxTmbgLfYMIkR5bcQwiTfYf2yndaVw=; b=fyvDaDCAlz76MuB8S8vg+QrLtijo4rz9TPkqyza344tJHfHtXxZwjhouy9enJk6ktSaccJ SYSC5t9cLOzYqee6S7MdHfrAhk5u2qObnSfC3qSap4V+yUopmArUd3GbCLrwVLL9BUg0XJ exrBfdrmbqd2TnCjVW6P4iNfCHkOXAA= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Wei Liu , Julien Grall , Anthony PERARD , Julien Grall Subject: [PATCH v3 01/13] tools/xenstore: take transaction internal nodes into account for quota Date: Thu, 30 Mar 2023 10:16:32 +0200 Message-Id: <20230330081644.11480-2-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 The accounting for the number of nodes of a domain in an active transaction is not working correctly, as it is checking the node quota only against the number of nodes outside the transaction. This can result in the transaction finally failing, as node quota is checked at the end of the transaction again. On the other hand even in a transaction deleting many nodes, new nodes might not be creatable, in case the node quota was already reached at the start of the transaction. Signed-off-by: Juergen Gross Acked-by: Julien Grall --- V3: - rewrite of commit message (Julien Grall) --- tools/xenstore/xenstored_domain.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tools/xenstore/xenstored_domain.c b/tools/xenstore/xenstored_domain.c index f62be2245c..dbbf97accc 100644 --- a/tools/xenstore/xenstored_domain.c +++ b/tools/xenstore/xenstored_domain.c @@ -1116,9 +1116,8 @@ int domain_nbentry_fix(unsigned int domid, int num, bool update) int domain_nbentry(struct connection *conn) { - return (domain_is_unprivileged(conn)) - ? conn->domain->nbentry - : 0; + return domain_is_unprivileged(conn) + ? domain_nbentry_add(conn, conn->id, 0, true) : 0; } static bool domain_chk_quota(struct domain *domain, int mem)