From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 1762691441 for ; Tue, 27 Sep 2022 12:17:29 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id ED1741D26B for ; Tue, 27 Sep 2022 12:17:28 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Tue, 27 Sep 2022 12:17:28 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 28AE7445D3 for ; Tue, 27 Sep 2022 12:17:28 +0200 (CEST) Date: Tue, 27 Sep 2022 12:17:27 +0200 From: Wolfgang Bumiller To: Leo Nunner Cc: pve-devel@lists.proxmox.com Message-ID: <20220927101727.vtqgfwprybn6nfue@casey.proxmox.com> References: <20220926094507.46263-1-l.nunner@proxmox.com> <20220927084632.c5lz3xgtzkou5asi@casey.proxmox.com> <20220927095944.wsyvolsajbrajnhh@casey.proxmox.com> <315b33bc-d3cb-cdc8-ca6a-2cdb5678749d@proxmox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <315b33bc-d3cb-cdc8-ca6a-2cdb5678749d@proxmox.com> X-SPAM-LEVEL: Spam detection results: 0 AWL 0.258 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: Re: [pve-devel] [PATCH firewall] fix #4204: automatically update usages of group when it is renamed X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Sep 2022 10:17:29 -0000 On Tue, Sep 27, 2022 at 12:13:30PM +0200, Leo Nunner wrote: > On 9/27/22 11:59, Wolfgang Bumiller wrote: > > > On Tue, Sep 27, 2022 at 11:28:26AM +0200, Leo Nunner wrote: > > > On 9/27/22 10:46, Wolfgang Bumiller wrote: > > > > On Mon, Sep 26, 2022 at 11:45:07AM +0200, Leo Nunner wrote: > > > > > + $cluster_conf->{groups}->{$param->{group}} = $cluster_conf->{groups}->{$param->{rename}}; > > > > > + $cluster_conf->{group_comments}->{$param->{group}} = $cluster_conf->{group_comments}->{$param->{rename}}; > > > > > + > > > > > + # Update comment if provided > > > > > $cluster_conf->{group_comments}->{$param->{group}} = $param->{comment} if defined($param->{comment}); > > > > > + > > > > At this point you'd need to also store the cluster fw config, because > > > > *reading* the configs isn't necessarily done with a lock on the cluster > > > > config, and you don't want to race against readers seeing the new group > > > > being referred to without actually having the it in the config. > > > > > > > > You'll still be racing against clients having read the cluster config > > > > while you're *here* and then reading their host config *after* you've > > > > updated it... > > > Is there actually a way around this? Unless we use something like inotify, > > > there'll be no way for them to actually know about the new group if they've > > > read the cluster config before I updated it. > > Well, not yet, and we'd need to distinguish between the race and the > > group *actually* not existing. > > Currently it'll produce a warning in the log which we might consider to > > be "good enough". > > We *could* try to remember which groups were missing in the previous run > > and assume new missing groups are part of a race, but I'm not sure it's > > worth it. Though syncing up would be simple enough as we only need to > > lock/unlock the cluster fw config once. > > Would this still be in the scope of this patch or should we just > leave it like this for now? That would be a separate patch.