Blame SOURCES/kvm-file-posix-Fix-creation-locking.patch

1bdc94
From 19452491c1ec03ce4eef24388ec24076eb306377 Mon Sep 17 00:00:00 2001
1bdc94
From: Max Reitz <mreitz@redhat.com>
1bdc94
Date: Mon, 9 Jul 2018 15:11:21 +0200
1bdc94
Subject: [PATCH 29/89] file-posix: Fix creation locking
1bdc94
1bdc94
RH-Author: Max Reitz <mreitz@redhat.com>
1bdc94
Message-id: <20180709151122.27541-2-mreitz@redhat.com>
1bdc94
Patchwork-id: 81271
1bdc94
O-Subject: [RHV-7.6 qemu-kvm-rhev PATCH 1/2] file-posix: Fix creation locking
1bdc94
Bugzilla: 1599335
1bdc94
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
1bdc94
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
1bdc94
RH-Acked-by: John Snow <jsnow@redhat.com>
1bdc94
1bdc94
raw_apply_lock_bytes() takes a bit mask of "permissions that are NOT
1bdc94
shared".
1bdc94
1bdc94
Also, make the "perm" and "shared" variables uint64_t, because I do not
1bdc94
particularly like using ~ on signed integers (and other permission masks
1bdc94
are usually uint64_t, too).
1bdc94
1bdc94
Reported-by: Kevin Wolf <kwolf@redhat.com>
1bdc94
Signed-off-by: Max Reitz <mreitz@redhat.com>
1bdc94
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
1bdc94
(cherry picked from commit d815efcaf01b1698e2fdf0f3e125201025c53191)
1bdc94
Signed-off-by: Max Reitz <mreitz@redhat.com>
1bdc94
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
1bdc94
---
1bdc94
 block/file-posix.c | 4 ++--
1bdc94
 1 file changed, 2 insertions(+), 2 deletions(-)
1bdc94
1bdc94
diff --git a/block/file-posix.c b/block/file-posix.c
1bdc94
index 0a9df5b..e876770 100644
1bdc94
--- a/block/file-posix.c
1bdc94
+++ b/block/file-posix.c
1bdc94
@@ -2052,7 +2052,7 @@ static int raw_co_create(BlockdevCreateOptions *options, Error **errp)
1bdc94
 {
1bdc94
     BlockdevCreateOptionsFile *file_opts;
1bdc94
     int fd;
1bdc94
-    int perm, shared;
1bdc94
+    uint64_t perm, shared;
1bdc94
     int result = 0;
1bdc94
 
1bdc94
     /* Validate options and set default values */
1bdc94
@@ -2088,7 +2088,7 @@ static int raw_co_create(BlockdevCreateOptions *options, Error **errp)
1bdc94
     shared = BLK_PERM_ALL & ~BLK_PERM_RESIZE;
1bdc94
 
1bdc94
     /* Step one: Take locks */
1bdc94
-    result = raw_apply_lock_bytes(fd, perm, shared, false, errp);
1bdc94
+    result = raw_apply_lock_bytes(fd, perm, ~shared, false, errp);
1bdc94
     if (result < 0) {
1bdc94
         goto out_close;
1bdc94
     }
1bdc94
-- 
1bdc94
1.8.3.1
1bdc94