]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
blk/kernel: retry forever if bdev_flock_retry is 0 37153/head
authorKefu Chai <kchai@redhat.com>
Wed, 16 Sep 2020 01:28:04 +0000 (09:28 +0800)
committerKefu Chai <kchai@redhat.com>
Mon, 21 Sep 2020 12:32:32 +0000 (20:32 +0800)
commit743b5bda6559c9be0e64617aa43ef5e06a5a6e60
treeb0d92b89d63da73e7a253a1afea6bc6c67713d9e
parentec7fa396247ecf20e58eeb3c6caa1e5f5f05ae98
blk/kernel: retry forever if bdev_flock_retry is 0

retry forever if cct->_conf->bdev_flock_retry is 0.
systemd-udevd is most likely the reason why ceph-osd fails to
acquire the flock when "mkfs", because systemd-udevd probes
all block devices when the device changes in the system using
libblkid, and when systemd-udevd starts looking at the device
it takes a `LOCK_SH|LOCK_NB` lock. and it releases the lock
right after done with it. so normally, it only takes a jiffy,
see
https://github.com/systemd/systemd/blob/ee0b9e721a368742ac6fa9c3d9a33e45dc3203a2/src/shared/lockfile-util.c#L18
so, we just need to retry couple times before acquiring the
lock.

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