Re: [Qemu-devel] [PATCH v2 2/3] block/file-posix: File locking during creation

2018-05-09 Thread Fam Zheng
On Wed, 05/09 23:53, Max Reitz wrote: > 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 truncati

[Qemu-devel] [PATCH v2 2/3] block/file-posix: File locking during creation

2018-05-09 Thread Max Reitz
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 lo