]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
svc: roles: set objv_tracker to null for sysobj calls
authorAbhishek Lekshmanan <abhishek@suse.com>
Wed, 21 Oct 2020 10:45:44 +0000 (12:45 +0200)
committerPritha Srivastava <prsrivas@redhat.com>
Mon, 6 Jun 2022 10:49:42 +0000 (16:19 +0530)
Since these aren't tracked via MDLog and merely ancillary objects

Signed-off-by: Abhishek Lekshmanan <abhishek@suse.com>
src/rgw/services/svc_role_rados.cc

index fdadf8ca3c229449a4af49208ab7e50fb903505d..b7e4929d7e1d6f78a851d7e308b920ce6921d919 100644 (file)
@@ -136,12 +136,16 @@ public:
   }
 
   int complete() {
+    // This creates the ancillary objects for roles, role_names & path
+    // objv_tracker is set to null for sysobj calls as these aren't tracked via
+    // the mdlog. A failure in name/path creation means we delete all the
+    // created objects in the transaction
     int r = svc_role->store_name(ctx, info.get_id(), info.get_name(), info.get_tenant(),
-                                 objv_tracker, mtime, exclusive, y, dpp);
+                                 nullptr, mtime, exclusive, y, dpp);
 
     if (r == 0) {
       r = svc_role->store_path(ctx, info.get_id(), info.get_path(), info.get_tenant(),
-                               objv_tracker, mtime, exclusive, y, dpp);
+                               nullptr, mtime, exclusive, y, dpp);
     }
 
     if (r < 0) {
@@ -168,15 +172,21 @@ int RGWSI_Role_RADOS::create(RGWSI_MetaBackend::Context *ctx,
 
   int r = Op.prepare();
   if (r < 0) {
+    ldout(svc.meta_be->ctx(),0) << __func__ << "ERROR: prepare role failed" << dendl;
     return r;
   }
 
   r = Op.put();
   if (r < 0) {
+    ldout(svc.meta_be->ctx(),0) << __func__ << "ERROR: put role failed" << dendl;
     return r;
   }
 
-  return Op.complete();
+  r = Op.complete();
+  if (r < 0) {
+    ldout(svc.meta_be->ctx(),0) << __func__ << "ERROR: completing PutRole failed" << dendl;
+  }
+  return r;
 }
 
 int RGWSI_Role_RADOS::store_info(RGWSI_MetaBackend::Context *ctx,
@@ -212,7 +222,8 @@ int RGWSI_Role_RADOS::store_name(RGWSI_MetaBackend::Context *ctx,
   encode(nameToId, data_bl);
 
   RGWSI_MetaBackend_SObj::Context_SObj *sys_ctx = static_cast<RGWSI_MetaBackend_SObj::Context_SObj *>(ctx);
-  return rgw_put_system_obj(dpp, *sys_ctx->obj_ctx,
+  auto& obj_ctx = *sys_ctx->obj_ctx;
+  return rgw_put_system_obj(dpp, obj_ctx,
                             svc.zone->get_zone_params().roles_pool,
                             get_role_name_meta_key(name, tenant),
                             data_bl,
@@ -235,7 +246,8 @@ int RGWSI_Role_RADOS::store_path(RGWSI_MetaBackend::Context *ctx,
 {
   bufferlist bl;
   RGWSI_MetaBackend_SObj::Context_SObj *sys_ctx = static_cast<RGWSI_MetaBackend_SObj::Context_SObj *>(ctx);
-  return rgw_put_system_obj(dpp, *sys_ctx->obj_ctx,
+  auto& obj_ctx = *sys_ctx->obj_ctx;
+  return rgw_put_system_obj(dpp, obj_ctx,
                             svc.zone->get_zone_params().roles_pool,
                             get_role_path_meta_key(path, role_id, tenant),
                             bl,