From nobody Thu Nov 6 18:20:58 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 1542387083768673.418210272628; Fri, 16 Nov 2018 08:51:23 -0800 (PST) Received: from localhost ([::1]:45773 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNhL0-0008Mu-HW for importer@patchew.org; Fri, 16 Nov 2018 11:51:22 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43638) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gNhFp-0004KB-FE for qemu-devel@nongnu.org; Fri, 16 Nov 2018 11:46:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gNhFo-0006Vf-Nq for qemu-devel@nongnu.org; Fri, 16 Nov 2018 11:46:01 -0500 Received: from mx1.redhat.com ([209.132.183.28]:37758) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gNhFl-0006Rd-TE; Fri, 16 Nov 2018 11:45:57 -0500 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 mx1.redhat.com (Postfix) with ESMTPS id 4465480508; Fri, 16 Nov 2018 16:45:54 +0000 (UTC) Received: from localhost (unknown [10.40.206.2]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C84C61019639; Fri, 16 Nov 2018 16:45:32 +0000 (UTC) From: Max Reitz To: qemu-block@nongnu.org Date: Fri, 16 Nov 2018 17:45:25 +0100 Message-Id: <20181116164526.31487-3-mreitz@redhat.com> In-Reply-To: <20181116164526.31487-1-mreitz@redhat.com> References: <20181116164526.31487-1-mreitz@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Fri, 16 Nov 2018 16:45:54 +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? v2 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 Reviewed-by: Alberto Garcia --- 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