From nobody Mon Feb 9 12:42:44 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=1608050222; cv=none; d=zohomail.com; s=zohoarc; b=mpaGpRW/Zum9g/tbpZ/YhT01ooSmkj5VTrucZO5i3GGuMX6YFRRsWs2a6cAL4S/520uTYLp1VsdYUlF2gxUcyScFQ5m6KMhRNoAQHqu16rcMr+/uNJ/e8USvEFjDV1SaIa9JHLTuiy0lxke9rxTTRMHVMOYZ7u+Z8mY/ZRC4e1o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608050222; 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=3OGXhmDpavRgcLL+iSFnJ3xYl7jjDOEuqGoMRL/Y0AQ=; b=FfQWT4wg5+h9DPSYa0Jx2W2QcmUnc+Xi4UUnNyga1nRqn2lZsl24g83FXa1Q4X349hv82K5jHebn+mFou2WdG7wg0yeRFwKed/Sr5N7diyhZ2xxx0X8/a3PwQ6NPcepUy3g7wT8D9T4g27Li/UC7KKVmkNTDWxsy2R6CMpDNZRo= 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) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1608050222967876.2364966174094; Tue, 15 Dec 2020 08:37:02 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.54562.95004 (Exim 4.92) (envelope-from ) id 1kpDJf-0007En-SP; Tue, 15 Dec 2020 16:36:47 +0000 Received: by outflank-mailman (output) from mailman id 54562.95004; Tue, 15 Dec 2020 16:36:47 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kpDJf-0007E7-Fl; Tue, 15 Dec 2020 16:36:47 +0000 Received: by outflank-mailman (input) for mailman id 54562; Tue, 15 Dec 2020 16:36:46 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kpDJe-00066M-Hz for xen-devel@lists.xenproject.org; Tue, 15 Dec 2020 16:36:46 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 98f00c5d-0b3c-4ea8-a28f-445388c7de8c; Tue, 15 Dec 2020 16:36:12 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 315FBB271; Tue, 15 Dec 2020 16:36:10 +0000 (UTC) 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: 98f00c5d-0b3c-4ea8-a28f-445388c7de8c X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1608050170; 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=3OGXhmDpavRgcLL+iSFnJ3xYl7jjDOEuqGoMRL/Y0AQ=; b=gFVrZOXtO3pkUFa6HLadEJ50eh//1ChSYICzygJvi8f2Sw4H5IAMxKGZXR9Tv4oRCsaxLl Y6RuHXQOcRob14xQBSWUzgBD3Ur9qvr+57mV19fUEhP4ey1flqIGrHwpvF4WLJVxTIHEt4 zX/HYtNgraWlUi0roWnKFvcm1uSFdcw= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Ian Jackson , Wei Liu , Paul Durrant , Julien Grall Subject: [PATCH v10 12/25] tools/xenstore: allow live update only with no transaction active Date: Tue, 15 Dec 2020 17:35:50 +0100 Message-Id: <20201215163603.21700-13-jgross@suse.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201215163603.21700-1-jgross@suse.com> References: <20201215163603.21700-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" In order to simplify live update state dumping only allow live update to happen when no transaction is active. A timeout is used to detect guests which have a transaction active for longer periods of time. In case such a guest is detected when trying to do a live update it will be reported and the update will fail. The admin can then either use a longer timeout, or use the force flag to just ignore the transactions of such a guest, or kill the guest before retrying. Transactions that have been active for a shorter time than the timeout will end in the live update starting to respond "BUSY" without aborting the complete live update process. The xenstore-control program will then just repeat the live update starting until a different result is returned. Signed-off-by: Juergen Gross Reviewed-by: Paul Durrant Acked-by: Julien Grall --- tools/xenstore/xenstored_control.c | 20 +++++++++++++++++++- tools/xenstore/xenstored_core.h | 1 + tools/xenstore/xenstored_transaction.c | 5 +++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/tools/xenstore/xenstored_control.c b/tools/xenstore/xenstored_= control.c index 940b717741..af64a9a2d4 100644 --- a/tools/xenstore/xenstored_control.c +++ b/tools/xenstore/xenstored_control.c @@ -22,6 +22,7 @@ Interactive commands for Xen Store Daemon. #include #include #include +#include #include #include #include @@ -307,7 +308,24 @@ static const char *lu_arch(const void *ctx, struct con= nection *conn, static const char *lu_check_lu_allowed(const void *ctx, bool force, unsigned int to) { - return NULL; + char *ret =3D NULL; + struct connection *conn; + time_t now =3D time(NULL); + bool busy =3D false; + + list_for_each_entry(conn, &connections, list) { + if (conn->ta_start_time - now >=3D to && !force) { + ret =3D talloc_asprintf(ctx, "%s\nDomain %u: %ld s", + ret ? : "Domains with long running transactions:", + conn->id, + conn->ta_start_time - now); + if (!ret) + busy =3D true; + } else if (conn->ta_start_time) + busy =3D true; + } + + return ret ? (const char *)ret : (busy ? "BUSY" : NULL); } =20 static const char *lu_dump_state(const void *ctx, struct connection *conn) diff --git a/tools/xenstore/xenstored_core.h b/tools/xenstore/xenstored_cor= e.h index 27826c125c..a009b182fd 100644 --- a/tools/xenstore/xenstored_core.h +++ b/tools/xenstore/xenstored_core.h @@ -93,6 +93,7 @@ struct connection struct list_head transaction_list; uint32_t next_transaction_id; unsigned int transaction_started; + time_t ta_start_time; =20 /* The domain I'm associated with, if any. */ struct domain *domain; diff --git a/tools/xenstore/xenstored_transaction.c b/tools/xenstore/xensto= red_transaction.c index 52355f4ed8..cd07fb0f21 100644 --- a/tools/xenstore/xenstored_transaction.c +++ b/tools/xenstore/xenstored_transaction.c @@ -473,6 +473,8 @@ int do_transaction_start(struct connection *conn, struc= t buffered_data *in) list_add_tail(&trans->list, &conn->transaction_list); talloc_steal(conn, trans); talloc_set_destructor(trans, destroy_transaction); + if (!conn->transaction_started) + conn->ta_start_time =3D time(NULL); conn->transaction_started++; wrl_ntransactions++; =20 @@ -511,6 +513,8 @@ int do_transaction_end(struct connection *conn, struct = buffered_data *in) conn->transaction =3D NULL; list_del(&trans->list); conn->transaction_started--; + if (!conn->transaction_started) + conn->ta_start_time =3D 0; =20 /* Attach transaction to in for auto-cleanup */ talloc_steal(in, trans); @@ -589,6 +593,7 @@ void conn_delete_all_transactions(struct connection *co= nn) assert(conn->transaction =3D=3D NULL); =20 conn->transaction_started =3D 0; + conn->ta_start_time =3D 0; } =20 int check_transactions(struct hashtable *hash) --=20 2.26.2