From: Yehuda Sadeh Date: Wed, 3 Aug 2016 19:53:09 +0000 (-0700) Subject: rgw: non-rgw tier is not writeable X-Git-Tag: v11.1.0~681^2~27 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f84bd9d223ae679f165e58fd9d22489c7748487e;p=ceph.git rgw: non-rgw tier is not writeable Signed-off-by: Yehuda Sadeh --- diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index 08e3f33d8839..a935981657ad 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -552,7 +552,7 @@ int RGWOp::verify_op_mask() return -EPERM; } - if (!s->system_request && (required_mask & RGW_OP_TYPE_MODIFY) && store->get_zone().is_read_only()) { + if (!s->system_request && (required_mask & RGW_OP_TYPE_MODIFY) && !store->zone_is_writeable()) { ldout(s->cct, 5) << "NOTICE: modify request to a read-only zone by a non-system user, permission denied" << dendl; return -EPERM; } diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 58d7edbc0801..7c7998a8720c 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -3798,6 +3798,8 @@ int RGWRados::init_complete() return ret; } + writeable_zone = (zone_public_config.tier_type.empty() || zone_public_config.tier_type == "rgw"); + init_unique_trans_id_deps(); finisher = new Finisher(cct); diff --git a/src/rgw/rgw_rados.h b/src/rgw/rgw_rados.h index 5c42ca02ca37..e3e8e25ade9d 100644 --- a/src/rgw/rgw_rados.h +++ b/src/rgw/rgw_rados.h @@ -1903,6 +1903,7 @@ protected: RGWSyncModulesManager *sync_modules_manager{nullptr}; RGWSyncModuleInstanceRef sync_module; + bool writeable_zone{false}; RGWZoneGroup zonegroup; RGWZone zone_public_config; /* external zone params, e.g., entrypoints, log flags, etc. */ @@ -2013,6 +2014,10 @@ public: return zone_public_config; } + bool zone_is_writeable() { + return writeable_zone && !get_zone().is_read_only(); + } + uint32_t get_zone_short_id() const { return zone_short_id; }