From nobody Sun Feb 8 13:33:10 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.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 205.139.110.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=1594287716; cv=none; d=zohomail.com; s=zohoarc; b=XYwxifnDRs0qkEeMg3uw34ukGer9hOIe2p1+9szy2oGil2tOJQ22kOE6qRJ+x5Z3GV8dZvc/J8Z4cmNBnlWp1jGZ4e1aZcmhJAXs+u1vm5cQD6nWWMqZuYMYL8UcypxL+cjghOkTliEDHWzROXDzcBP0NxV+s9tEFNPMgmWn1q4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594287716; 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=DVlyM/xATzRCdI314z/9xL5JCN+fxUmKYcyZU/h6OLg=; b=mVaJItsXTaxi69PlEVZDIKft0f4BDZQA0IC2aUuUP2+qrecl72dHRn8jaKVdvNT9X0x87gX6AsRMZk7+eV9W9SkLZtX8q245B63oewAsafaCi9gJxWsXPrNQlG1T18jGFsYm61RCqy8gRPA1cYa/2hYMH5xI6bwDvV+zZ0P8cMo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.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 [205.139.110.120]) by mx.zohomail.com with SMTPS id 1594287716367137.86748101587523; Thu, 9 Jul 2020 02:41:56 -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-364-jNnbAGyZMcqXD6jiq2caHA-1; Thu, 09 Jul 2020 05:41:52 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5D05D95B40; Thu, 9 Jul 2020 09:41:40 +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 7F23460F8D; Thu, 9 Jul 2020 09:41:39 +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 4BE4293F7D; Thu, 9 Jul 2020 09:41:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0699fYmj025526 for ; Thu, 9 Jul 2020 05:41:34 -0400 Received: by smtp.corp.redhat.com (Postfix) id 22A2E6FEE1; Thu, 9 Jul 2020 09:41:34 +0000 (UTC) Received: from carol.localdomain (unknown [10.40.195.78]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E4349724A4 for ; Thu, 9 Jul 2020 09:41:29 +0000 (UTC) Received: from carol.redhat.com (carol.k8r.cz [127.0.0.1]) by carol.localdomain (Postfix) with ESMTP id DD915C22A83 for ; Thu, 9 Jul 2020 11:41:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594287715; 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=DVlyM/xATzRCdI314z/9xL5JCN+fxUmKYcyZU/h6OLg=; b=A+xbMcOmmKbYKmDIKFH6FshFEn2XKVfCNHhTSSUt/eCiEci1i6daIr1TZtXLYTbw9TeR6m kOKWD/fazlltjkA4EgLUeh942kK55A2cFFto+b+bb6SzP94lUhnRQuAXMbgB80yNXMkEQI Jbqh/cySzqHD+ihatkfVMl3+G0r3TAM= X-MC-Unique: jNnbAGyZMcqXD6jiq2caHA-1 From: Martin Kletzander To: libvir-list@redhat.com Subject: [PATCH] resctrl: Do not open directory for writing Date: Thu, 9 Jul 2020 11:40:32 +0200 Message-Id: <619f6459bf82703993dbbfdb9a42edeb108cc6ff.1594287632.git.mkletzan@redhat.com> MIME-Version: 1.0 X-Clacks-Overhead: GNU Terry Pratchett X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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.79 on 10.5.11.12 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" When preparing for the removal of GNULIB commit 18dca21a32e9 removed the unneeded O_DIRECTORY, but unfortunately started opening the directory for writing which fails every time for a directory. There is also no need for = that as flock() works on O_RDONLY file descriptor as well, even for LOCK_EX. https://bugzilla.redhat.com/1852741 Signed-off-by: Martin Kletzander Reviewed-by: J=C3=A1n Tomko --- src/util/virresctrl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/virresctrl.c b/src/util/virresctrl.c index 33044da3a1ef..f6da13645ae3 100644 --- a/src/util/virresctrl.c +++ b/src/util/virresctrl.c @@ -456,7 +456,7 @@ VIR_ONCE_GLOBAL_INIT(virResctrl); static int virResctrlLockWrite(void) { - int fd =3D open(SYSFS_RESCTRL_PATH, O_RDWR | O_CLOEXEC); + int fd =3D open(SYSFS_RESCTRL_PATH, O_RDONLY | O_CLOEXEC); =20 if (fd < 0) { virReportSystemError(errno, "%s", _("Cannot open resctrl")); --=20 2.27.0