From nobody Wed May 8 21:55:43 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1597140848; cv=none; d=zohomail.com; s=zohoarc; b=NW79h67s7ZRrDzUDSaUgjmEsyQlopUHURhAG2u2Dc0Zuzj0i2tqBSbF5c46M5uoOG/kNfaBKDtQu2wvxizJf58CzVxt7Hn8YwJYCkwumBydsgZ0mnD7LFNYSEiJmyTFHOAWhKYJot6gxtUasgwqYnc04fYXO5FijP/pkZYhdvac= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1597140848; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=wS+A+xDyMdgGYriKwMXnFfEW40uxvUnxnoeVHP1nv+I=; b=gXfdqznvgwK1AFO+If+PAeE82KuD2+uol/fJA/8xwo9nkxeQ+S1vK6AadYgvwe0aK2Hxrds5r+gqNrMRL463IBv+Xcc/9IPBThcXeZBmky+YlX0j5Lki43T7JIO17AyiRCQr+WRp8Jci3tylcJdcpAcuJ2/7/q0VbVwMy85+6Go= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1597140848754180.3664706211356; Tue, 11 Aug 2020 03:14:08 -0700 (PDT) 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-125--AhOMPViOF2_cAz5dzGmiQ-1; Tue, 11 Aug 2020 06:14:05 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B860357; Tue, 11 Aug 2020 10:13:58 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A756710013C4; Tue, 11 Aug 2020 10:13:57 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id C9E72A5535; Tue, 11 Aug 2020 10:13:53 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 07BADq4J017553 for ; Tue, 11 Aug 2020 06:13:52 -0400 Received: by smtp.corp.redhat.com (Postfix) id 606C25F1EA; Tue, 11 Aug 2020 10:13:52 +0000 (UTC) Received: from antique-work.redhat.com (unknown [10.40.195.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id CF83487D60 for ; Tue, 11 Aug 2020 10:13:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597140848; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=wS+A+xDyMdgGYriKwMXnFfEW40uxvUnxnoeVHP1nv+I=; b=B5QIGg5jFmV4aHrRgbVwwbxoPK2IHDzTkdspzrZMhVzu12WgLf4kiaWqCrh9pUAYMrloAm 4RszmqKbqmfbhBBiAxzAQiioCwIahx6yccIj32/C+84S2FFpH5L6+RCaOb8P3Bq8sQx8pz 3DxBBtzXs/5t0f3u5/USZM8sJP6CJCU= X-MC-Unique: -AhOMPViOF2_cAz5dzGmiQ-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH] vircgroupv2devices: fix counting entries in BPF map Date: Tue, 11 Aug 2020 12:13:47 +0200 Message-Id: <0b0e49844a24582f899eb5d666af4d1096d667b3.1597140817.git.phrdina@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" BPF syscall BPF_MAP_GET_NEXT_KEY returns -1 if something fails but it will also return -1 if trying to get next key using the last key in the map with errno set to ENOENT. If there are VMs running and libvirtd is restarted and user tries to call some cgroup devices operation on a VM we need to get the count of entries in BPF map and it fails which will result in error when trying to attach/detech devices. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D1833321 Signed-off-by: Pavel Hrdina Reviewed-by: Erik Skultety --- src/util/vircgroupv2devices.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/vircgroupv2devices.c b/src/util/vircgroupv2devices.c index d62ee12a05..234e0f2278 100644 --- a/src/util/vircgroupv2devices.c +++ b/src/util/vircgroupv2devices.c @@ -342,7 +342,7 @@ virCgroupV2DevicesCountMapEntries(int mapfd) prevKey =3D key; } =20 - if (rc < 0) + if (rc < 0 && errno !=3D ENOENT) return -1; =20 return ret; --=20 2.26.2