]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: rename the configurables for metadata limits to start with rgw_. 15369/head
authorRadoslaw Zarzynski <rzarzyns@redhat.com>
Tue, 19 Sep 2017 12:46:53 +0000 (14:46 +0200)
committerRadoslaw Zarzynski <rzarzyns@redhat.com>
Tue, 19 Sep 2017 12:47:16 +0000 (14:47 +0200)
Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
src/common/options.cc
src/rgw/rgw_op.h
src/rgw/rgw_rest_swift.cc

index 318597e4432a84634eeb6f3fcab20fb7cae83210..eb72facd181d70d3a7609431b68b642e48e802cb 100644 (file)
@@ -4163,6 +4163,14 @@ std::vector<Option> get_rgw_options() {
     .set_default(1 * 1024 * 1024)
     .set_description(""),
 
+    Option("rgw_max_attr_size", Option::TYPE_UINT, Option::LEVEL_ADVANCED)
+    .set_default(0)
+    .set_description("The maximum length of metadata value. 0 skips the check"),
+
+    Option("rgw_max_attr_name_len", Option::TYPE_UINT, Option::LEVEL_ADVANCED)
+    .set_default(0)
+    .set_description("The maximum length of metadata name. 0 skips the check"),
+
     Option("rgw_max_attrs_num_in_req", Option::TYPE_UINT, Option::LEVEL_ADVANCED)
     .set_default(0)
     .set_description("The maximum number of metadata items that can be put via single request"),
index 38990bbce2c030f067a82c1d981e7d68ceb9aa34..8b2056906bb478dda5acfe89faf3e8f840945d42 100644 (file)
@@ -1914,19 +1914,21 @@ static inline int rgw_get_request_metadata(CephContext* const cct,
       std::string attr_name(RGW_ATTR_PREFIX);
       attr_name.append(name);
 
-      /* Check early whether we aren't going behind the limit on attribute
+      /* Check roughly whether we aren't going behind the limit on attribute
        * name. Passing here doesn't guarantee that an OSD will accept that
        * as ObjectStore::get_max_attr_name_length() can set the limit even
-       * lower. However, we're claiming "max_meta_name_length" in /info as
-       * being dependent on the "osd_max_attr_name_len".  */
-      if (attr_name.length() > cct->_conf->osd_max_attr_name_len) {
+       * lower than the "osd_max_attr_name_len" configurable.  */
+      const size_t max_attr_name_len = \
+        cct->_conf->get_val<size_t>("rgw_max_attr_name_len");
+      if (max_attr_name_len && attr_name.length() > max_attr_name_len) {
         return -ENAMETOOLONG;
       }
 
       /* Similar remarks apply to the check for value size. We're veryfing
        * it early at the RGW's side as it's being claimed in /info. */
-      if (cct->_conf->osd_max_attr_size &&
-          xattr.length() > cct->_conf->osd_max_attr_size) {
+      const size_t max_attr_size = \
+        cct->_conf->get_val<size_t>("rgw_max_attr_size");
+      if (max_attr_size && xattr.length() > max_attr_size) {
         return -EFBIG;
       }
 
index 5b1b1a8cfaefe464e637149db7de2c8988cf2a69..73847c24cd0147e936ba2210be0116101691fac2 100644 (file)
@@ -654,7 +654,7 @@ static inline int handle_metadata_errors(req_state* const s, const int op_ret)
      * (stored as xattr) size. */
     const auto error_message = boost::str(
       boost::format("Metadata value longer than %lld")
-        % int(s->cct->_conf->osd_max_attr_size));
+        % s->cct->_conf->get_val<size_t>("rgw_max_attr_size"));
     set_req_state_err(s, EINVAL, error_message);
     return -EINVAL;
   } else if (op_ret == -E2BIG) {
@@ -1715,11 +1715,15 @@ void RGWInfo_ObjStore_SWIFT::list_swift_data(Formatter& formatter,
   string ceph_version(CEPH_GIT_NICE_VER);
   formatter.dump_string("version", ceph_version);
 
-  const size_t meta_name_limit = g_conf->osd_max_attr_name_len
-    - strlen(RGW_ATTR_PREFIX RGW_AMZ_META_PREFIX);
-  formatter.dump_int("max_meta_name_length", meta_name_limit);
+  const size_t max_attr_name_len = \
+    g_conf->get_val<size_t>("rgw_max_attr_name_len");
+  if (max_attr_name_len) {
+    const size_t meta_name_limit = \
+      max_attr_name_len - strlen(RGW_ATTR_PREFIX RGW_AMZ_META_PREFIX);
+    formatter.dump_int("max_meta_name_length", meta_name_limit);
+  }
 
-  const size_t meta_value_limit = g_conf->osd_max_attr_size;
+  const size_t meta_value_limit = g_conf->get_val<size_t>("rgw_max_attr_size");
   if (meta_value_limit) {
     formatter.dump_int("max_meta_value_length", meta_value_limit);
   }