Skip to content

Commit 3b7b7da

Browse files
committed
rgw/services: don't allocate RGWSI_Notify unless its used
avoid allocating, initializing, and shutting down RGWSI_Notify if we aren't going to start or use it calling RGWSI_Notify::shutdown() without first calling RGWSI_Notify::do_start() aborts in Finisher::stop() with: > ceph_abort_msg("join on thread that was never started") Signed-off-by: Casey Bodley <[email protected]>
1 parent 137d209 commit 3b7b7da

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

src/rgw/driver/rados/rgw_service.cc

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ int RGWServices_Def::init(CephContext *cct,
6464
config_key_rados = std::make_unique<RGWSI_ConfigKey_RADOS>(cct);
6565
datalog_rados = std::make_unique<RGWDataChangesLog>(driver);
6666
mdlog = std::make_unique<RGWSI_MDLog>(cct, run_sync, cfgstore);
67-
notify = std::make_unique<RGWSI_Notify>(cct);
67+
if (have_cache) {
68+
notify = std::make_unique<RGWSI_Notify>(cct);
69+
}
6870
zone = std::make_unique<RGWSI_Zone>(cct, cfgstore, site);
6971
zone_utils = std::make_unique<RGWSI_ZoneUtils>(cct);
7072
quota = std::make_unique<RGWSI_Quota>(cct);
@@ -94,7 +96,9 @@ int RGWServices_Def::init(CephContext *cct,
9496
config_key_rados->init(driver->getRados()->get_rados_handle());
9597
mdlog->init(driver->getRados()->get_rados_handle(), zone.get(), sysobj.get(),
9698
cls.get(), async_processor.get());
97-
notify->init(zone.get(), driver->getRados()->get_rados_handle());
99+
if (notify) {
100+
notify->init(zone.get(), driver->getRados()->get_rados_handle());
101+
}
98102
zone->init(sysobj.get(), driver->getRados()->get_rados_handle(),
99103
sync_modules.get(), bucket_sync_sobj.get());
100104
zone_utils->init(driver->getRados()->get_rados_handle(), zone.get());
@@ -113,13 +117,16 @@ int RGWServices_Def::init(CephContext *cct,
113117
can_shutdown = true;
114118

115119
int r = 0;
116-
if (!raw) {
120+
121+
if (notify) {
117122
r = notify->start(y, dpp);
118123
if (r < 0) {
119124
ldpp_dout(dpp, 0) << "ERROR: failed to start notify service (" << cpp_strerror(-r) << dendl;
120125
return r;
121126
}
127+
}
122128

129+
if (!raw) {
123130
r = zone->start(y, dpp);
124131
if (r < 0) {
125132
ldpp_dout(dpp, 0) << "ERROR: failed to start zone service (" << cpp_strerror(-r) << dendl;
@@ -229,7 +236,9 @@ void RGWServices_Def::shutdown()
229236
datalog_rados.reset();
230237
user_rados->shutdown();
231238
sync_modules->shutdown();
232-
notify->shutdown();
239+
if (notify) {
240+
notify->shutdown();
241+
}
233242
mdlog->shutdown();
234243
config_key_rados->shutdown();
235244
cls->shutdown();
@@ -240,7 +249,6 @@ void RGWServices_Def::shutdown()
240249

241250
sysobj->shutdown();
242251
sysobj_core->shutdown();
243-
notify->shutdown();
244252
if (sysobj_cache) {
245253
sysobj_cache->shutdown();
246254
}

0 commit comments

Comments
 (0)