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)