]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: period update: check for dangling master zone references
authorAbhishek Lekshmanan <abhishek@suse.com>
Mon, 19 Nov 2018 16:47:51 +0000 (17:47 +0100)
committerAbhishek Lekshmanan <abhishek@suse.com>
Thu, 22 Nov 2018 10:57:29 +0000 (11:57 +0100)
If we are deleting a master zone of a zonegroup fail on period update, if this
was intentional, either creating / modifying a zone as master or in case of
deletions, deletion of the zonegroup itself will correct the period update to
work correctly. Without the check, while period commit will be successful a
subsequent RGWRados::init_complete() will fail.

Signed-off-by: Abhishek Lekshmanan <abhishek@suse.com>
(cherry picked from commit 3bea89096857230ecd6137ec6fe551c4ae20ae37)

src/rgw/rgw_zone.cc
Changes made to corresponding function rgw_rados

src/rgw/rgw_rados.cc

index 864518c4d34d6b64bcb9a063f532f1424d775645..d56bc7540d0c40e50751d1d963337b2b230d1c56 100644 (file)
@@ -1388,6 +1388,12 @@ int RGWPeriod::update()
       return -EINVAL;
     }  
     
+    if (zg.zones.find(zg.master_zone) == zg.zones.end()) {
+      ldout(cct,0) << "ERROR: zonegroup " << zg.get_name()
+                   << " has a non existent master zone "<< dendl;
+      return -EINVAL;
+    }
+
     if (zg.is_master_zonegroup()) {
       master_zonegroup = zg.get_id();
       master_zone = zg.master_zone;