From nobody Mon Feb 9 10:30:06 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1557172364; cv=none; d=zoho.com; s=zohoarc; b=K9U97oHt3nhu7yzJQS8chFyj7jm+wlTRtPgcCu2S8vrnuTYXtPl5phSDas4ou2X4U/5rHbXtQdJ4e0eTNJE+HgVGNHnKK9TXXV4rup4Z6l78pLpNDclUU0yOmjGbp04VLnJTxv2HMiYI8zwWWWWBBBUfFWi2O3xuBboHYV8In7w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557172364; h=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:ARC-Authentication-Results; bh=dGNtIvqglsxPElgbWodWKGn+WZ6e8DJs3Wl4lWYPkuE=; b=Ta6z/kSirCyHvnqhBXhrlx58NyVk0tvyFOV/eBQaQg8fsRCuMyI1eEpdF/TQJjVMm3+cuUoAL2jDRoLvR0qWTmskpv+gYZ/eMU2MiB0stohRaiaRY/n/B7/xFSnH229CeahotsVgx/dZ1KrQT4b2v59GKtXY5/GmpawWcHYmVxg= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1557172364745126.97381252063155; Mon, 6 May 2019 12:52:44 -0700 (PDT) Received: from localhost ([127.0.0.1]:33243 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hNjfF-000815-Pb for importer@patchew.org; Mon, 06 May 2019 15:52:41 -0400 Received: from eggs.gnu.org ([209.51.188.92]:43596) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hNjaq-0004Ox-4V for qemu-devel@nongnu.org; Mon, 06 May 2019 15:48:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hNjap-0001t1-7k for qemu-devel@nongnu.org; Mon, 06 May 2019 15:48:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53276) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hNjan-0001r5-4T; Mon, 06 May 2019 15:48:05 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5C14E81E09; Mon, 6 May 2019 19:48:04 +0000 (UTC) Received: from localhost (ovpn-204-185.brq.redhat.com [10.40.204.185]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AD0F4611D6; Mon, 6 May 2019 19:48:01 +0000 (UTC) From: Max Reitz To: qemu-block@nongnu.org Date: Mon, 6 May 2019 21:47:47 +0200 Message-Id: <20190506194753.12464-2-mreitz@redhat.com> In-Reply-To: <20190506194753.12464-1-mreitz@redhat.com> References: <20190506194753.12464-1-mreitz@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 06 May 2019 19:48:04 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 1/7] file-posix: Update open_flags in raw_set_perm() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , John Snow , qemu-devel@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" raw_check_perm() + raw_set_perm() can change the flags associated with the current FD. If so, we have to update BDRVRawState.open_flags accordingly. Otherwise, we may keep reopening the FD even though the current one already has the correct flags. Signed-off-by: Max Reitz --- block/file-posix.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/block/file-posix.c b/block/file-posix.c index 1cf4ee49eb..66b46ec0eb 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -145,6 +145,7 @@ typedef struct BDRVRawState { uint64_t locked_shared_perm; =20 int perm_change_fd; + int perm_change_flags; BDRVReopenState *reopen_state; =20 #ifdef CONFIG_XFS @@ -2762,6 +2763,7 @@ static int raw_check_perm(BlockDriverState *bs, uint6= 4_t perm, uint64_t shared, return ret; } else if (ret !=3D s->fd) { s->perm_change_fd =3D ret; + s->perm_change_flags =3D open_flags; } } =20 @@ -2800,6 +2802,7 @@ static void raw_set_perm(BlockDriverState *bs, uint64= _t perm, uint64_t shared) if (s->perm_change_fd && s->fd !=3D s->perm_change_fd) { qemu_close(s->fd); s->fd =3D s->perm_change_fd; + s->open_flags =3D s->perm_change_flags; } s->perm_change_fd =3D 0; =20 --=20 2.20.1