yeahuh / rpms / qemu-kvm

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