]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
blk/kernel: Add O_EXCL for block devices 53566/head
authorAdam Kupczyk <akupczyk@redhat.com>
Tue, 29 Nov 2022 15:38:08 +0000 (15:38 +0000)
committerPrashant D <pdhange@redhat.com>
Wed, 20 Sep 2023 22:46:36 +0000 (18:46 -0400)
commit6a66ba8de362d82f46a12035640c6e27a546297f
tree2500333aab8fad23bbdb506c6a942b710b8ecd7c
parenta55a59c1f1c3d678d019b0adfd3170a13cbe997e
blk/kernel: Add O_EXCL for block devices

Change behaviour when target file is block device "mknod name b major minor".
Append O_EXCL flag for first open of the block device.

The problem is that if 2 different files for same block devices are created,
it is possible to ::flock each of them in 2 separate processes.
In some container cases when we recreate bluestore osd dir with
  ceph-bluestore-tool prime-osd
command, we can end up with completely different files.
Open with O_EXCL is immune to that.

Signed-off-by: Adam Kupczyk <akupczyk@redhat.com>
(cherry picked from commit 5dc01efd97109fcb7fc3ded5ffbe502c8e7439b2)
src/blk/kernel/KernelDevice.cc