From patchwork Thu Aug 19 00:43:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mohammad Heib X-Patchwork-Id: 1518277 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::138; helo=smtp1.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=S0NiwAIC; dkim-atps=neutral Received: from smtp1.osuosl.org (smtp1.osuosl.org [IPv6:2605:bc80:3010::138]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GqmHJ38pmz9sW8 for ; Thu, 19 Aug 2021 10:44:10 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 7D98F80CC6; Thu, 19 Aug 2021 00:44:04 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id dAZUI0abvVDc; Thu, 19 Aug 2021 00:44:00 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp1.osuosl.org (Postfix) with ESMTPS id C6C6880C97; Thu, 19 Aug 2021 00:43:59 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 9D2B9C0010; Thu, 19 Aug 2021 00:43:59 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) by lists.linuxfoundation.org (Postfix) with ESMTP id 2C95AC000E for ; Thu, 19 Aug 2021 00:43:58 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id 1BB2740200 for ; Thu, 19 Aug 2021 00:43:58 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp2.osuosl.org (amavisd-new); dkim=pass (1024-bit key) header.d=redhat.com Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id p6U9GxClO5td for ; Thu, 19 Aug 2021 00:43:57 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp2.osuosl.org (Postfix) with ESMTPS id D606D400BB for ; Thu, 19 Aug 2021 00:43:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1629333835; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Pk4YsJka+qaK/itGanjfwJTvk0nPpfNYUYhBxAo/Vg4=; b=S0NiwAIC16/F9DtieBKRV3DEFB44PFpm0ZS4ZMwDvNy1A54YLuOdielcX+2er8AHPw8NM/ ClQdEibuptAFr7EV7a9qgpyJ5kQ7Kk3/K+700pgsOyaP5H/KQCCRtQf2/NsCwaNWErC12r 73iLSA+/fJrHFqjSd8n8MZ+49a89T9s= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-228-8xPqXHXIN6aqrQWYf4jgdg-1; Wed, 18 Aug 2021 20:43:54 -0400 X-MC-Unique: 8xPqXHXIN6aqrQWYf4jgdg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C5DFA871807 for ; Thu, 19 Aug 2021 00:43:53 +0000 (UTC) Received: from mheib.bos.com (unknown [10.35.206.52]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8C3D960657; Thu, 19 Aug 2021 00:43:52 +0000 (UTC) From: mheib@redhat.com To: dev@openvswitch.org Date: Thu, 19 Aug 2021 03:43:47 +0300 Message-Id: <20210819004347.665893-1-mheib@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mheib@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Subject: [ovs-dev] [PATCH] [PATCH ovn] ovn-nbctl: Monitor nb_cfg to detect and handle potential overflows X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" From: Mohammad Heib ovn-nbctl sync command will increase nb_cfg value each time it is executed with a specific wait_type, this increment will be handled without testing the current nb_cfg value because it is not monitored and that could lead to an overflow issue if nb_cfg == LLONG_MAX. To avoid such potential overflow cases we must monitor the real value of nb_cfg each time sync is executed and if there is any overflow issue it will be handled by function nbctl_pre_execute later on the execution. Fixes: be3a60f8e6a3 ("ovn-nbctl: Deal with nb_cfg overflows.") Reported-at: https://bugzilla.redhat.com/show_bug.cgi?id=1979774 Signed-off-by: Mohammad Heib --- utilities/ovn-nbctl.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/utilities/ovn-nbctl.c b/utilities/ovn-nbctl.c index ada53b662d3c..69be775bc567 100644 --- a/utilities/ovn-nbctl.c +++ b/utilities/ovn-nbctl.c @@ -830,6 +830,8 @@ static void nbctl_pre_sync(struct ctl_context *base OVS_UNUSED) { force_wait = true; + /* Monitor nb_cfg to detect and handle potential overflows. */ + ovsdb_idl_add_column(base->idl, &nbrec_nb_global_col_nb_cfg); } static void