[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v2 11/12] file-posix: Fix creation locking
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PULL v2 11/12] file-posix: Fix creation locking |
Date: |
Thu, 5 Jul 2018 12:26:03 +0200 |
From: Max Reitz <address@hidden>
raw_apply_lock_bytes() takes a bit mask of "permissions that are NOT
shared".
Also, make the "perm" and "shared" variables uint64_t, because I do not
particularly like using ~ on signed integers (and other permission masks
are usually uint64_t, too).
Reported-by: Kevin Wolf <address@hidden>
Signed-off-by: Max Reitz <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
block/file-posix.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/block/file-posix.c b/block/file-posix.c
index 829ee538d8..b57c58e80f 100644
--- a/block/file-posix.c
+++ b/block/file-posix.c
@@ -2112,7 +2112,7 @@ raw_co_create(BlockdevCreateOptions *options, Error
**errp)
{
BlockdevCreateOptionsFile *file_opts;
int fd;
- int perm, shared;
+ uint64_t perm, shared;
int result = 0;
/* Validate options and set default values */
@@ -2148,7 +2148,7 @@ raw_co_create(BlockdevCreateOptions *options, Error
**errp)
shared = BLK_PERM_ALL & ~BLK_PERM_RESIZE;
/* Step one: Take locks */
- result = raw_apply_lock_bytes(fd, perm, shared, false, errp);
+ result = raw_apply_lock_bytes(fd, perm, ~shared, false, errp);
if (result < 0) {
goto out_close;
}
--
2.13.6
- [Qemu-devel] [PULL v2 00/12] Block layer patches, Kevin Wolf, 2018/07/05
- [Qemu-devel] [PULL v2 01/12] qemu-img: allow compressed not-in-order writes, Kevin Wolf, 2018/07/05
- [Qemu-devel] [PULL v2 02/12] qcow2: refactor data compression, Kevin Wolf, 2018/07/05
- [Qemu-devel] [PULL v2 04/12] block: Move two block permission constants to the relevant enum, Kevin Wolf, 2018/07/05
- [Qemu-devel] [PULL v2 03/12] qcow2: add compress threads, Kevin Wolf, 2018/07/05
- [Qemu-devel] [PULL v2 08/12] block/blklogwrites: Change log_sector_size from int64_t to uint64_t, Kevin Wolf, 2018/07/05
- [Qemu-devel] [PULL v2 11/12] file-posix: Fix creation locking,
Kevin Wolf <=
- [Qemu-devel] [PULL v2 06/12] block: Don't silently truncate node names, Kevin Wolf, 2018/07/05
- [Qemu-devel] [PULL v2 05/12] block: Add blklogwrites, Kevin Wolf, 2018/07/05
- [Qemu-devel] [PULL v2 12/12] file-posix: Unlock FD after creation, Kevin Wolf, 2018/07/05
- [Qemu-devel] [PULL v2 07/12] block/crypto: Fix memory leak in create error path, Kevin Wolf, 2018/07/05
- [Qemu-devel] [PULL v2 10/12] block/blklogwrites: Add an option for the update interval of the log superblock, Kevin Wolf, 2018/07/05
- [Qemu-devel] [PULL v2 09/12] block/blklogwrites: Add an option for appending to an old log, Kevin Wolf, 2018/07/05
- Re: [Qemu-devel] [PULL v2 00/12] Block layer patches, Peter Maydell, 2018/07/05