b38b0f
From eb8c3d2ca7a67da197d2b33e0b3a83efb9abe589 Mon Sep 17 00:00:00 2001
b38b0f
From: Max Reitz <mreitz@redhat.com>
b38b0f
Date: Wed, 3 Apr 2019 17:13:13 +0100
b38b0f
Subject: [PATCH 06/11] file-posix: Fix shared locks on reopen commit
b38b0f
b38b0f
RH-Author: Max Reitz <mreitz@redhat.com>
b38b0f
Message-id: <20190403171315.20841-7-mreitz@redhat.com>
b38b0f
Patchwork-id: 85404
b38b0f
O-Subject: [RHEL-8.1 qemu-kvm PATCH 6/8] file-posix: Fix shared locks on reopen commit
b38b0f
Bugzilla: 1694148
b38b0f
RH-Acked-by: John Snow <jsnow@redhat.com>
b38b0f
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
b38b0f
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
b38b0f
b38b0f
s->locked_shared_perm is the set of bits locked in the file, which is
b38b0f
the inverse of the permissions actually shared.  So we need to pass them
b38b0f
as they are to raw_apply_lock_bytes() instead of inverting them again.
b38b0f
b38b0f
Reported-by: Alberto Garcia <berto@igalia.com>
b38b0f
Signed-off-by: Max Reitz <mreitz@redhat.com>
b38b0f
Reviewed-by: Alberto Garcia <berto@igalia.com>
b38b0f
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
b38b0f
(cherry picked from commit 577a133988c76e4ebf01d050d0d758d207a1baf7)
b38b0f
Signed-off-by: Max Reitz <mreitz@redhat.com>
b38b0f
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
b38b0f
---
b38b0f
 block/file-posix.c | 2 +-
b38b0f
 1 file changed, 1 insertion(+), 1 deletion(-)
b38b0f
b38b0f
diff --git a/block/file-posix.c b/block/file-posix.c
b38b0f
index 97e7ff2..deecf58 100644
b38b0f
--- a/block/file-posix.c
b38b0f
+++ b/block/file-posix.c
b38b0f
@@ -929,7 +929,7 @@ static void raw_reopen_commit(BDRVReopenState *state)
b38b0f
 
b38b0f
     /* Copy locks to the new fd before closing the old one. */
b38b0f
     raw_apply_lock_bytes(NULL, rs->fd, s->locked_perm,
b38b0f
-                         ~s->locked_shared_perm, false, &local_err);
b38b0f
+                         s->locked_shared_perm, false, &local_err);
b38b0f
     if (local_err) {
b38b0f
         /* shouldn't fail in a sane host, but report it just in case. */
b38b0f
         error_report_err(local_err);
b38b0f
-- 
b38b0f
1.8.3.1
b38b0f