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}.