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

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