@@ -43,7 +43,7 @@ NVMeofGwMonitorClient::NVMeofGwMonitorClient(int argc, const char **argv) :
4343 client_messenger (Messenger::create(g_ceph_context, " async" , entity_name_t ::CLIENT(-1 ), "client", getpid())),
4444 objecter{g_ceph_context, client_messenger.get (), &monc, poolctx},
4545 client{client_messenger.get (), &monc, &objecter},
46- timer (g_ceph_context, lock ),
46+ timer (g_ceph_context, beacon_lock ),
4747 orig_argc(argc),
4848 orig_argv(argv)
4949{
@@ -193,7 +193,10 @@ int NVMeofGwMonitorClient::init()
193193 client.init ();
194194 timer.init ();
195195
196- tick ();
196+ {
197+ std::lock_guard bl (beacon_lock);
198+ tick ();
199+ }
197200
198201 dout (10 ) << " Complete." << dendl;
199202 return 0 ;
@@ -217,7 +220,7 @@ static bool get_gw_state(const char* desc, const std::map<NvmeGroupKey, NvmeGwMo
217220
218221void NVMeofGwMonitorClient::send_beacon ()
219222{
220- ceph_assert (ceph_mutex_is_locked_by_me (lock ));
223+ ceph_assert (ceph_mutex_is_locked_by_me (beacon_lock ));
221224 gw_availability_t gw_availability = gw_availability_t ::GW_CREATED;
222225 BeaconSubsystems subs;
223226 NVMeofGwClient gw_client (
@@ -295,7 +298,10 @@ void NVMeofGwMonitorClient::shutdown()
295298
296299
297300 // stop sending beacon first, I use monc to talk with monitors
298- timer.shutdown ();
301+ {
302+ std::lock_guard bl (beacon_lock);
303+ timer.shutdown ();
304+ }
299305 // client uses monc and objecter
300306 client.shutdown ();
301307 // Stop asio threads, so leftover events won't call into shut down
0 commit comments