]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
config: drop config_proxy::lock when invoking config observer
authorVenky Shankar <vshankar@redhat.com>
Wed, 18 Jul 2018 12:50:49 +0000 (08:50 -0400)
committerVenky Shankar <vshankar@redhat.com>
Tue, 8 Jan 2019 08:45:04 +0000 (03:45 -0500)
commit0943f882f5c17ae2d776a419736ba1e96a89217f
tree0b862bfa0f9c0ae511752c9f16662c5a009a23df
parentca2fea21ed50e592ac44c8761a392f9c3b417665
config: drop config_proxy::lock when invoking config observer

To prevent deadlocking when observer acquires its own locks
(lock order: config_proxy::lock -> foo::lock) and another
thread (say IO path) attempts to fetch an config value (lock
order: foo:lock -> config_proxy::lock).

Side effect of dropping locks when invoking config observer is
that remove_observer() can sneak in when the observer is still
in execution resulting in use-after-free. To mitigate this, any
in-progress observer call need to be completed before removing
the obserer. Also, remove_observer() needs to be invoked without
holding any observer locks so as to not run into deadlocks.

Signed-off-by: Venky Shankar <vshankar@redhat.com>
(cherry picked from commit 909c792457f9e8efaf2e53c968afbcf96cbd03e3)

 Conflicts:
src/common/config_obs_mgr.h
src/common/config_proxy.h
crimson/common/config_proxy.h

sources config_obs_mgr.h, config_proxy.h and crimson bits are not in
luminous, therfore the appropriate logic is moved to config.{h,cc}.
src/common/Cond.h
src/common/CondVar.h [new file with mode: 0644]
src/common/config.cc
src/common/config.h