From e9b095def446cf39f0b5466303bce7d3737bbba7 Mon Sep 17 00:00:00 2001 From: Matt Benjamin Date: Thu, 14 Mar 2019 17:25:20 -0400 Subject: [PATCH] rgw: nfs: svc-enable RGWLib Add minimal svc_sys_obj.h boilerplate to RGWLibRequest. Fix a trivial illegal access from RGWPutObjProcessor's RadosWriter when the request object is not stack allocated. Fixes: https://tracker.ceph.com/issues/38769 Signed-off-by: Matt Benjamin --- src/rgw/rgw_lib.h | 7 +++++++ src/rgw/rgw_putobj_processor.h | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/rgw/rgw_lib.h b/src/rgw/rgw_lib.h index ce5a27a00a3..357133b0a6a 100644 --- a/src/rgw/rgw_lib.h +++ b/src/rgw/rgw_lib.h @@ -129,6 +129,7 @@ namespace rgw { public: CephContext* cct; RGWUserInfo* user; + boost::optional sysobj_ctx; /* unambiguiously return req_state */ inline struct req_state* get_state() { return this->RGWRequest::s; } @@ -159,7 +160,10 @@ namespace rgw { RGWRequest::init_state(_s); RGWHandler::init(rados_ctx->get_store(), _s, io); + sysobj_ctx.emplace(store->svc.sysobj); + get_state()->obj_ctx = rados_ctx; + get_state()->sysobj_ctx = &(sysobj_ctx.get()); get_state()->req_id = store->svc.zone_utils->unique_id(id); get_state()->trans_id = store->svc.zone_utils->unique_trans_id(id); @@ -195,7 +199,10 @@ namespace rgw { RGWRequest::init_state(&rstate); RGWHandler::init(rados_ctx.get_store(), &rstate, &io_ctx); + sysobj_ctx.emplace(store->svc.sysobj); + get_state()->obj_ctx = &rados_ctx; + get_state()->sysobj_ctx = &(sysobj_ctx.get()); get_state()->req_id = store->svc.zone_utils->unique_id(id); get_state()->trans_id = store->svc.zone_utils->unique_trans_id(id); diff --git a/src/rgw/rgw_putobj_processor.h b/src/rgw/rgw_putobj_processor.h index 6fd36c009e4..8d265f172bc 100644 --- a/src/rgw/rgw_putobj_processor.h +++ b/src/rgw/rgw_putobj_processor.h @@ -80,7 +80,7 @@ class RadosWriter : public DataProcessor { RGWRados *const store; const RGWBucketInfo& bucket_info; RGWObjectCtx& obj_ctx; - const rgw_obj& head_obj; + const rgw_obj head_obj; RGWSI_RADOS::Obj stripe_obj; // current stripe object RawObjSet written; // set of written objects for deletion -- 2.39.5