X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=ceph%2Fsrc%2Frgw%2Frgw_op.cc;h=98a6db4703f2caa1471757c95ff06ec00a5dc096;hb=28e407b858acd3bddc89f68583571f771bb42e46;hp=0f8133089881c7086b257b10e60efc448aad38ed;hpb=3a9019d971a194e002b14eebff7e21327a178f29;p=ceph.git diff --git a/ceph/src/rgw/rgw_op.cc b/ceph/src/rgw/rgw_op.cc index 0f8133089..98a6db470 100644 --- a/ceph/src/rgw/rgw_op.cc +++ b/ceph/src/rgw/rgw_op.cc @@ -76,41 +76,42 @@ static int forward_request_to_master(struct req_state *s, obj_version *objv, RGW static MultipartMetaFilter mp_filter; -static int parse_range(const char *range, off_t& ofs, off_t& end, bool *partial_content) +int RGWGetObj::parse_range(void) { int r = -ERANGE; - string s(range); + string rs(range_str); string ofs_str; string end_str; - *partial_content = false; + ignore_invalid_range = s->cct->_conf->rgw_ignore_get_invalid_range; + partial_content = false; - size_t pos = s.find("bytes="); + size_t pos = rs.find("bytes="); if (pos == string::npos) { pos = 0; - while (isspace(s[pos])) + while (isspace(rs[pos])) pos++; int end = pos; - while (isalpha(s[end])) + while (isalpha(rs[end])) end++; - if (strncasecmp(s.c_str(), "bytes", end - pos) != 0) + if (strncasecmp(rs.c_str(), "bytes", end - pos) != 0) return 0; - while (isspace(s[end])) + while (isspace(rs[end])) end++; - if (s[end] != '=') + if (rs[end] != '=') return 0; - s = s.substr(end + 1); + rs = rs.substr(end + 1); } else { - s = s.substr(pos + 6); /* size of("bytes=") */ + rs = rs.substr(pos + 6); /* size of("bytes=") */ } - pos = s.find('-'); + pos = rs.find('-'); if (pos == string::npos) goto done; - *partial_content = true; + partial_content = true; - ofs_str = s.substr(0, pos); - end_str = s.substr(pos + 1); + ofs_str = rs.substr(0, pos); + end_str = rs.substr(pos + 1); if (end_str.length()) { end = atoll(end_str.c_str()); if (end < 0) @@ -127,8 +128,18 @@ static int parse_range(const char *range, off_t& ofs, off_t& end, bool *partial_ if (end >= 0 && end < ofs) goto done; - r = 0; + range_parsed = true; + return 0; + done: + if (ignore_invalid_range) { + partial_content = false; + ofs = 0; + end = -1; + range_parsed = false; // allow retry + r = 0; + } + return r; } @@ -1588,16 +1599,13 @@ bool RGWGetObj::prefetch_data() bool prefetch_first_chunk = true; range_str = s->info.env->get("HTTP_RANGE"); - if(range_str) { - int r = parse_range(range_str, ofs, end, &partial_content); - /* error on parsing the range, stop prefetch and will fail in execte() */ + if (range_str) { + int r = parse_range(); + /* error on parsing the range, stop prefetch and will fail in execute() */ if (r < 0) { - range_parsed = false; - return false; - } else { - range_parsed = true; + return false; /* range_parsed==false */ } - /* range get goes to shadown objects, stop prefetch */ + /* range get goes to shadow objects, stop prefetch */ if (ofs >= s->cct->_conf->rgw_max_chunk_size) { prefetch_first_chunk = false; } @@ -1605,6 +1613,7 @@ bool RGWGetObj::prefetch_data() return get_data && prefetch_first_chunk; } + void RGWGetObj::pre_exec() { rgw_bucket_object_pre_exec(s); @@ -1684,7 +1693,9 @@ void RGWGetObj::execute() { attr_iter = attrs.find(RGW_ATTR_CRYPT_MODE); if (attr_iter != attrs.end() && attr_iter->second.to_str() == "SSE-C-AES256") { - op_ret = -ERR_INVALID_REQUEST; + ldout(s->cct, 0) << "ERROR: torrents are not supported for objects " + "encrypted with SSE-C" << dendl; + op_ret = -EINVAL; goto done_err; } torrent.init(s, store); @@ -1810,9 +1821,9 @@ done_err: int RGWGetObj::init_common() { if (range_str) { - /* range parsed error when prefetch*/ + /* range parsed error when prefetch */ if (!range_parsed) { - int r = parse_range(range_str, ofs, end, &partial_content); + int r = parse_range(); if (r < 0) return r; } @@ -2274,6 +2285,7 @@ int RGWListBucket::parse_max_keys() char *endptr; max = strtol(max_keys.c_str(), &endptr, 10); if (endptr) { + if (endptr == max_keys.c_str()) return -EINVAL; while (*endptr && isspace(*endptr)) // ignore white space endptr++; if (*endptr) { @@ -3421,7 +3433,7 @@ void RGWPutObj::execute() op_ret = -ENOENT; goto done; } - lst = astate->size - 1; + lst = astate->accounted_size - 1; } else { lst = copy_source_range_lst; } @@ -4328,6 +4340,9 @@ void RGWDeleteObj::execute() } } + if (op_ret == -ECANCELED) { + op_ret = 0; + } if (op_ret == -ERR_PRECONDITION_FAILED && no_precondition_error) { op_ret = 0; } @@ -4990,7 +5005,7 @@ void RGWDeleteLC::execute() } } op_ret = rgw_bucket_set_attrs(store, s->bucket_info, attrs, &s->bucket_info.objv_tracker); - string shard_id = s->bucket.name + ':' +s->bucket.bucket_id; + string shard_id = s->bucket.tenant + ':' + s->bucket.name + ':' + s->bucket.bucket_id; pair entry(shard_id, lc_uninitial); string oid; get_lc_oid(s, oid); @@ -5729,7 +5744,7 @@ void RGWListMultipart::execute() int RGWListBucketMultiparts::verify_permission() { if (!verify_bucket_permission(s, - rgw::IAM::s3ListBucketMultiPartUploads)) + rgw::IAM::s3ListBucketMultipartUploads)) return -EACCES; return 0; @@ -7000,3 +7015,10 @@ void RGWDeleteBucketPolicy::execute() return op_ret; }); } + +void RGWGetClusterStat::execute() +{ + op_ret = this->store->get_rados_handle()->cluster_stat(stats_op); +} + +