]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: lc: check for valid placement target before processing transitions 29955/head
authorAbhishek Lekshmanan <abhishek@suse.com>
Mon, 27 May 2019 13:14:18 +0000 (15:14 +0200)
committerNathan Cutler <ncutler@suse.com>
Wed, 2 Oct 2019 08:17:24 +0000 (10:17 +0200)
Check that we transition to another placement target only if such a placement
target is valid in the zone. Also log the bucket and rule id in this case to
identify the LCRule causing the issue.

This still doesn't error the API at a put bucket lifecycle call

Fixes: https://tracker.ceph.com/issues/39632
Signed-off-by: Abhishek Lekshmanan <abhishek@suse.com>
(cherry picked from commit 2912bbf591ae1624007b3efabfa1dbfd5a137ca6)

Conflicts:
     src/rgw/rgw_lc.cc
- ldout(oc.cct, ...) instead of ldpp_dout(oc.dpp, ...)

src/rgw/rgw_lc.cc

index 6fc0af0ec59c7396945106c7d7e5a6207c5a4caf..bd0775de88035d0140fc0a9618e5dad0cdc5f0cd 100644 (file)
@@ -16,6 +16,7 @@
 #include "rgw_common.h"
 #include "rgw_bucket.h"
 #include "rgw_lc.h"
+#include "rgw_zone.h"
 #include "rgw_string.h"
 
 #include "services/svc_sys_obj.h"
@@ -815,6 +816,13 @@ public:
     target_placement.inherit_from(oc.bucket_info.placement_rule);
     target_placement.storage_class = transition.storage_class;
 
+    if (!oc.store->svc.zone->get_zone_params().valid_placement(target_placement)) {
+      ldout(oc.cct, 0) << "ERROR: non existent dest placement: " << target_placement
+                       << " bucket="<< oc.bucket_info.bucket
+                       << " rule_id=" << oc.op.id << dendl;
+      return -EINVAL;
+    }
+
     int r = oc.store->transition_obj(oc.rctx, oc.bucket_info, oc.obj,
                                      target_placement, o.meta.mtime, o.versioned_epoch);
     if (r < 0) {