]> git.proxmox.com Git - mirror_qemu.git/commit
block/file-posix: File locking during creation
authorMax Reitz <mreitz@redhat.com>
Wed, 9 May 2018 21:53:35 +0000 (23:53 +0200)
committerMax Reitz <mreitz@redhat.com>
Mon, 11 Jun 2018 14:18:45 +0000 (16:18 +0200)
commitb8cf1913a989b9ea6f248aaa233330047a62962e
tree798ae2ce6cbc98ca6ef09c48699dce165cfdc2e5
parentd0a96155de099d388f5e1f46277a54bdcfbb0bb2
block/file-posix: File locking during creation

When creating a file, we should take the WRITE and RESIZE permissions.
We do not need either for the creation itself, but we do need them for
clearing and resizing it.  So we can take the proper permissions by
replacing O_TRUNC with an explicit truncation to 0, and by taking the
appropriate file locks between those two steps.

Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-id: 20180509215336.31304-3-mreitz@redhat.com
Reviewed-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
block/file-posix.c