From nobody Mon Feb 9 05:20:41 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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=1594410436; cv=none; d=zohomail.com; s=zohoarc; b=X8b27D3wZ2zUgGcOJuUhRW4ikqxNtrKBJlsywJ1Add46dTXySahXhPm+OMgkNbzaBwXk7kBEJMnNRgJLQuWWNkIOyAg2IgwIRKty+x4h7AAwjCzdr5loiG/s2j7JM7L1QXy6E4WVWrMssz3qgc1Ndr8lLjcgDoP3UXT7XcOVSKE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594410436; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=zuo4RzV3MpbPWKaXy1vyxZeOMslZyDFlnAFwmx8SLYo=; b=PWiAlqUYCPdd+X0S6IuAMnZPdJABohbx0psEQPjjaUElo03BPIRS7VfIoaSHECmVZYn93RYxKsF2biTQNxObx1ZPHr5Ii/yhr9Hl2jIHjvhyRM/51fDGAQSRB2lEELqIKTdSL4pmtbOWoANokUQjZk4x8nrsnv+qqVDfarlgOHk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1594410436338706.0120055125747; Fri, 10 Jul 2020 12:47:16 -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-144-SOBdhAN2PBiKC3f5ltvc7g-1; Fri, 10 Jul 2020 15:46:01 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8392F800EB6; Fri, 10 Jul 2020 19:45:55 +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 6409E78A52; Fri, 10 Jul 2020 19:45:55 +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 3538E84371; Fri, 10 Jul 2020 19:45:55 +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 06AJjbLn009073 for ; Fri, 10 Jul 2020 15:45:37 -0400 Received: by smtp.corp.redhat.com (Postfix) id 9DFFB6FEED; Fri, 10 Jul 2020 19:45:37 +0000 (UTC) Received: from carol.localdomain (unknown [10.40.195.78]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9B9F96FEEA; Fri, 10 Jul 2020 19:45:34 +0000 (UTC) Received: from carol.redhat.com (carol.k8r.cz [127.0.0.1]) by carol.localdomain (Postfix) with ESMTP id 31EC7C201DA; Fri, 10 Jul 2020 21:45:33 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594410435; h=from:from:sender:sender: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: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=zuo4RzV3MpbPWKaXy1vyxZeOMslZyDFlnAFwmx8SLYo=; b=bju7atfwXE2pFrbX83yn2GDTjtzL8GGNgwMZ+JRyHmowZuy1MZaxMDZHc//hWKtTG7FQkt VABkNlkDkcWBMD59OlijQyaNqgXmjEAYBqjpNmz8CR6cb4riQslcojXRRX1txkWylMWLQT /8lqXEM3FGj6i0J1LKnk7CwHsY8JNbA= X-MC-Unique: SOBdhAN2PBiKC3f5ltvc7g-1 From: Martin Kletzander To: libvir-list@redhat.com Subject: [PATCH v2 2/2] resctrl: Use exclusive lock for /sys/fs/resctrl Date: Fri, 10 Jul 2020 21:45:26 +0200 Message-Id: <65751362c59e34226723bd8fb481203916489824.1594410214.git.mkletzan@redhat.com> In-Reply-To: References: 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 Cc: Andrea Bolognani 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.14 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" That's the way it should've been all the time. It was originally the case,= but then the rework to virFileFlock() made the function ambiguous when it was created in commit 5a0a5f7fb5f5, and due to that it was misused in commit 657ddeff2313 and since then the lock being taken was shared rather than exclusive. Signed-off-by: Martin Kletzander Reviewed-by: Andrea Bolognani --- 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 b685b8bb6f7b..784a8d43bb2f 100644 --- a/src/util/virresctrl.c +++ b/src/util/virresctrl.c @@ -463,7 +463,7 @@ virResctrlLockWrite(void) return -1; } =20 - if (virFileFlock(fd, VIR_FILE_FLOCK_SHARED) < 0) { + if (virFileFlock(fd, VIR_FILE_FLOCK_EXCLUSIVE) < 0) { virReportSystemError(errno, "%s", _("Cannot lock resctrl")); VIR_FORCE_CLOSE(fd); return -1; --=20 2.27.0