From: Abhishek Lekshmanan Date: Mon, 19 Nov 2018 16:47:51 +0000 (+0100) Subject: rgw: period update: check for dangling master zone references X-Git-Tag: v12.2.11~122^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=70a6fb7723db668cd24d26bc2bb375a9436d5930;p=ceph.git rgw: period update: check for dangling master zone references 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 (cherry picked from commit 3bea89096857230ecd6137ec6fe551c4ae20ae37) src/rgw/rgw_zone.cc Changes made to corresponding function rgw_rados --- diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 864518c4d34..d56bc7540d0 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -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;