From: Emin Sunacoglu Date: Mon, 8 Dec 2025 09:46:57 +0000 (+0100) Subject: RGW: Change prerequest hook to run after authorization process X-Git-Tag: testing/wip-vshankar-testing-20260213.071255~9^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d6bc0c5be8625bd7c5abfcd66700019616423583;p=ceph-ci.git RGW: Change prerequest hook to run after authorization process Fixes: https://tracker.ceph.com/issues/73979 Signed-off-by: Emin Sunacoglu --- diff --git a/src/rgw/rgw_process.cc b/src/rgw/rgw_process.cc index bc1db1cafd9..bed3ff03d3c 100644 --- a/src/rgw/rgw_process.cc +++ b/src/rgw/rgw_process.cc @@ -339,30 +339,6 @@ int process_request(const RGWProcessEnv& penv, abort_early(s, NULL, -ERR_METHOD_NOT_ALLOWED, handler, yield); goto done; } - is_health_request = (op->get_type() == RGW_OP_GET_HEALTH_CHECK); - { - s->trace_enabled = tracing::rgw::tracer.is_enabled(); - if (!is_health_request) { - std::string script; - auto rc = rgw::lua::read_script(s, penv.lua.manager.get(), - s->bucket_tenant, s->yield, - rgw::lua::context::preRequest, script); - if (rc == -ENOENT) { - // no script, nothing to do - } else if (rc < 0) { - ldpp_dout(op, 5) << - "WARNING: failed to execute pre request script. " - "error: " << rc << dendl; - } else { - rc = rgw::lua::request::execute(rest, penv.olog.get(), s, op, script); - if (rc < 0) { - ldpp_dout(op, 5) << - "WARNING: failed to execute pre request script. " - "error: " << rc << dendl; - } - } - } - } std::tie(ret,c) = schedule_request(scheduler, s, op); if (ret < 0) { if (ret == -EAGAIN) { @@ -411,6 +387,30 @@ int process_request(const RGWProcessEnv& penv, goto done; } + is_health_request = (op->get_type() == RGW_OP_GET_HEALTH_CHECK); + { + s->trace_enabled = tracing::rgw::tracer.is_enabled(); + if (!is_health_request) { + std::string script; + auto rc = rgw::lua::read_script(s, penv.lua.manager.get(), + s->bucket_tenant, s->yield, + rgw::lua::context::preRequest, script); + if (rc == -ENOENT) { + // no script, nothing to do + } else if (rc < 0) { + ldpp_dout(op, 5) << + "WARNING: failed to execute pre request script. " + "error: " << rc << dendl; + } else { + rc = rgw::lua::request::execute(rest, penv.olog.get(), s, op, script); + if (rc < 0) { + ldpp_dout(op, 5) << + "WARNING: failed to execute pre request script. " + "error: " << rc << dendl; + } + } + } + } s->trace = tracing::rgw::tracer.start_trace(op->name(), s->trace_enabled); s->trace->SetAttribute(tracing::rgw::TRANS_ID, s->trans_id);