]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librados: fix locking on get_required_monitor_features
authorJohn Spray <john.spray@redhat.com>
Mon, 30 Apr 2018 15:35:18 +0000 (11:35 -0400)
committerKefu Chai <kchai@redhat.com>
Sat, 5 May 2018 11:04:20 +0000 (19:04 +0800)
This wasn't taking the MonClient lock: should use
with_monmap to protect access to MonClient::monmap.

Signed-off-by: John Spray <john.spray@redhat.com>
(cherry picked from commit ef517d0ea0dd4754fe725ae8d6f01209b58130be)

src/librados/RadosClient.cc

index a62da35f70ff324c2baab7b1638c6e41e0468a0b..a9d429a4320c94af2550eac423bdedc899c3d989 100644 (file)
@@ -1098,5 +1098,6 @@ int librados::RadosClient::service_daemon_update_status(
 
 mon_feature_t librados::RadosClient::get_required_monitor_features() const
 {
-  return monclient.monmap.get_required_features();
+  return monclient.with_monmap([](const MonMap &monmap) {
+      return monmap.get_required_features(); } );
 }