]> 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)
committerNathan Cutler <ncutler@suse.com>
Tue, 27 Oct 2020 10:32:28 +0000 (11:32 +0100)
commiteb8c518b7a9464fcb0a0d448f0ea2e5896924af2
tree88bc96a89ad3dc96468b1ff1c9dfaa6bf315ecdc
parent31281dcf29596c7c363687ee2f20b48a8250e403
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>
(cherry picked from commit ec7fa396247ecf20e58eeb3c6caa1e5f5f05ae98)

Conflicts:
src/blk/kernel/KernelDevice.cc
- file does not exist in nautilus; made changes manually in
  src/os/bluestore/KernelDevice.cc
src/os/bluestore/KernelDevice.cc