]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
blk/kernel: use open file description lock if available
authorKefu Chai <kchai@redhat.com>
Tue, 15 Sep 2020 07:38:36 +0000 (15:38 +0800)
committerKefu Chai <kchai@redhat.com>
Mon, 21 Sep 2020 12:17:36 +0000 (20:17 +0800)
commitec7fa396247ecf20e58eeb3c6caa1e5f5f05ae98
treee99c940c23b8198cf9493a13aeea7d66c2cb321c
parent8fb80db9ff32a85fcdf91e38075c42165805e37f
blk/kernel: use open file description lock if available

* use OFD lock if available. OFD is Linux specific, and only available
  on 3.15 kernels. OFD is able to synchronize both threads and
  processes. and has simpler semantics. this is just a cleanup.
  as we don't create threads for acquiring the flock.
* use BSD flock(2) as a fallback
* return the errno right away, without printing logging messages.
  for two reasons:
  - writing logging messages would reset the errno.
  - the caller of _lock() also prints the logging messages along
    with strerror(errno)

Fixes: https://tracker.ceph.com/issues/46124
Signed-off-by: Kefu Chai <kchai@redhat.com>
src/blk/kernel/KernelDevice.cc