From nobody Thu Nov 6 18:22:14 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.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 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1542383752228237.2658145707478; Fri, 16 Nov 2018 07:55:52 -0800 (PST) Received: from localhost ([::1]:45431 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNgTE-0003Xh-8Y for importer@patchew.org; Fri, 16 Nov 2018 10:55:48 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54157) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNgRC-0002E7-Rw for qemu-devel@nongnu.org; Fri, 16 Nov 2018 10:53:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gNgR3-0000Yq-Ow for qemu-devel@nongnu.org; Fri, 16 Nov 2018 10:53:34 -0500 Received: from mx1.redhat.com ([209.132.183.28]:5853) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gNgQq-0000MK-SZ; Fri, 16 Nov 2018 10:53:21 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A4A68C04959F; Fri, 16 Nov 2018 15:53:18 +0000 (UTC) Received: from localhost (unknown [10.40.206.2]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5C22D5D787; Fri, 16 Nov 2018 15:53:14 +0000 (UTC) From: Max Reitz To: qemu-block@nongnu.org Date: Fri, 16 Nov 2018 16:53:01 +0100 Message-Id: <20181116155302.22472-3-mreitz@redhat.com> In-Reply-To: <20181116155302.22472-1-mreitz@redhat.com> References: <20181116155302.22472-1-mreitz@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Fri, 16 Nov 2018 15:53:18 +0000 (UTC) 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 for-3.1? 2/3] file-posix: Fix shared locks on reopen commit 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 , Fam Zheng , Alberto Garcia , qemu-devel@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" s->locked_shared_perm is the set of bits locked in the file, which is the inverse of the permissions actually shared. So we need to pass them as they are to raw_apply_lock_bytes() instead of inverting them again. Reported-by: Alberto Garcia Signed-off-by: Max Reitz --- block/file-posix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/file-posix.c b/block/file-posix.c index df3a8d7cdf..8460d003f0 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -963,7 +963,7 @@ static void raw_reopen_commit(BDRVReopenState *state) =20 /* Copy locks to the new fd before closing the old one. */ raw_apply_lock_bytes(NULL, rs->fd, s->locked_perm, - ~s->locked_shared_perm, false, &local_err); + s->locked_shared_perm, false, &local_err); if (local_err) { /* shouldn't fail in a sane host, but report it just in case. */ error_report_err(local_err); --=20 2.17.2