.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"),
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;
}
* (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) {
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);
}