Skip to content

Commit 38bd9e7

Browse files
authored
Merge pull request ceph#61944 from kchheda3/wip-fix-opslog-crash
rgw/log: Fix crash during shutdown with ops-log enable. Reviewed-By: Oguzhan Ozmen <[email protected]>
2 parents 4052c51 + 374ddbc commit 38bd9e7

File tree

5 files changed

+8
-10
lines changed

5 files changed

+8
-10
lines changed

src/rgw/rgw_appmain.cc

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ void rgw::AppMain::init_opslog()
407407
olog_manifold->add_sink(ops_log_file);
408408
}
409409
olog_manifold->add_sink(new OpsLogRados(env.driver));
410-
olog = olog_manifold;
410+
env.olog.reset(olog_manifold);
411411
} /* init_opslog */
412412

413413
int rgw::AppMain::init_frontends2(RGWLib* rgwlib)
@@ -449,7 +449,6 @@ int rgw::AppMain::init_frontends2(RGWLib* rgwlib)
449449

450450
// initialize RGWProcessEnv
451451
env.rest = &rest;
452-
env.olog = olog;
453452
env.auth_registry = rgw::auth::StrategyRegistry::create(
454453
dpp->get_cct(), *implicit_tenant_context, env.driver);
455454
env.ratelimiting = ratelimiter.get();
@@ -597,8 +596,6 @@ void rgw::AppMain::shutdown(std::function<void(void)> finalize_async_signals)
597596
ldh.reset(nullptr); // deletes ldap helper if it was created
598597
rgw_log_usage_finalize();
599598

600-
delete olog;
601-
602599
if (lua_background) {
603600
lua_background->shutdown();
604601
}

src/rgw/rgw_lib.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ namespace rgw {
316316
<< e.what() << dendl;
317317
}
318318
if (should_log) {
319-
rgw_log_op(nullptr /* !rest */, s, op, env.olog);
319+
rgw_log_op(nullptr /* !rest */, s, op, env.olog.get());
320320
}
321321

322322
int http_ret = s->err.http_ret;

src/rgw/rgw_main.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ class AppMain {
6767
std::vector<RGWFrontendConfig*> fe_configs;
6868
std::multimap<string, RGWFrontendConfig*> fe_map;
6969
std::unique_ptr<rgw::LDAPHelper> ldh;
70-
OpsLogSink* olog = nullptr;
7170
RGWREST rest;
7271
std::unique_ptr<rgw::lua::Background> lua_background;
7372
std::unique_ptr<rgw::auth::ImplicitTenants> implicit_tenant_context;

src/rgw/rgw_process.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,8 @@ int process_request(const RGWProcessEnv& penv,
342342
"WARNING: failed to execute pre request script. "
343343
"error: " << rc << dendl;
344344
} else {
345-
rc = rgw::lua::request::execute(driver, rest, penv.olog, s, op, script);
345+
rc = rgw::lua::request::execute(driver, rest, penv.olog.get(), s, op,
346+
script);
346347
if (rc < 0) {
347348
ldpp_dout(op, 5) <<
348349
"WARNING: failed to execute pre request script. "
@@ -440,7 +441,8 @@ int process_request(const RGWProcessEnv& penv,
440441
"WARNING: failed to read post request script. "
441442
"error: " << rc << dendl;
442443
} else {
443-
rc = rgw::lua::request::execute(driver, rest, penv.olog, s, op, script);
444+
rc = rgw::lua::request::execute(driver, rest, penv.olog.get(), s, op,
445+
script);
444446
if (rc < 0) {
445447
ldpp_dout(op, 5) <<
446448
"WARNING: failed to execute post request script. "
@@ -459,7 +461,7 @@ int process_request(const RGWProcessEnv& penv,
459461
perfcounter->inc(l_rgw_qactive, -1);
460462
}
461463
if (should_log) {
462-
rgw_log_op(rest, s, op, penv.olog);
464+
rgw_log_op(rest, s, op, penv.olog.get());
463465
}
464466

465467
if (op) {

src/rgw/rgw_process_env.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ struct RGWProcessEnv {
4242
rgw::sal::Driver* driver = nullptr;
4343
rgw::SiteConfig* site = nullptr;
4444
RGWREST *rest = nullptr;
45-
OpsLogSink *olog = nullptr;
45+
std::unique_ptr<OpsLogSink> olog;
4646
std::unique_ptr<rgw::auth::StrategyRegistry> auth_registry;
4747
ActiveRateLimiter* ratelimiting = nullptr;
4848

0 commit comments

Comments
 (0)