Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rgw/file: missing brackets around if statement #37537

Merged
merged 1 commit into from
Oct 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
76 changes: 40 additions & 36 deletions src/rgw/rgw_file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,7 @@ namespace rgw {
if (! rc) {
/* conflict! */
rc = rgw_fh_rele(get_fs(), lfh, RGW_FH_RELE_FLAG_NONE);
// ignore return code
return MkObjResult{nullptr, -EEXIST};
}

Expand Down Expand Up @@ -688,6 +689,7 @@ namespace rgw {
if (! rc) {
/* conflict! */
rc = rgw_fh_rele(get_fs(), lfh, RGW_FH_RELE_FLAG_NONE);
// ignore return code
return MkObjResult{nullptr, -EEXIST};
}

Expand Down Expand Up @@ -758,6 +760,7 @@ namespace rgw {
if (! rc) {
/* conflict! */
rc = rgw_fh_rele(get_fs(), lfh, RGW_FH_RELE_FLAG_NONE);
// ignore return code
return MkObjResult{nullptr, -EEXIST};
}

Expand Down Expand Up @@ -973,7 +976,7 @@ namespace rgw {
explicit ObjUnref(RGWLibFS* _fs) : fs(_fs) {}
void operator()(RGWFileHandle* fh) const {
lsubdout(fs->get_context(), rgw, 5)
<< __func__
<< __PRETTY_FUNCTION__
<< fh->name
<< " before ObjUnref refs=" << fh->get_refcnt()
<< dendl;
Expand Down Expand Up @@ -1520,11 +1523,11 @@ namespace rgw {
}

int RGWWriteRequest::exec_start() {
struct req_state* s = get_state();
struct req_state* state = get_state();

auto compression_type =
get_store()->svc()->zone->get_zone_params().get_compression_type(
s->bucket->get_placement_rule());
state->bucket->get_placement_rule());

/* not obviously supportable */
ceph_assert(! dlo_manifest);
Expand All @@ -1533,16 +1536,16 @@ namespace rgw {
perfcounter->inc(l_rgw_put);
op_ret = -EINVAL;

if (s->object->empty()) {
ldout(s->cct, 0) << __func__ << " called on empty object" << dendl;
if (state->object->empty()) {
ldout(state->cct, 0) << __func__ << " called on empty object" << dendl;
goto done;
}

op_ret = get_params();
if (op_ret < 0)
goto done;

op_ret = get_system_versioning_params(s, &olh_epoch, &version_id);
op_ret = get_system_versioning_params(state, &olh_epoch, &version_id);
if (op_ret < 0) {
goto done;
}
Expand All @@ -1552,36 +1555,36 @@ namespace rgw {
/* skipping user-supplied etag--we might have one in future, but
* like data it and other attrs would arrive after open */

aio.emplace(s->cct->_conf->rgw_put_obj_min_window_size);
aio.emplace(state->cct->_conf->rgw_put_obj_min_window_size);

if (s->bucket->versioning_enabled()) {
if (state->bucket->versioning_enabled()) {
if (!version_id.empty()) {
s->object->set_instance(version_id);
state->object->set_instance(version_id);
} else {
s->object->gen_rand_obj_instance_name();
version_id = s->object->get_instance();
state->object->gen_rand_obj_instance_name();
version_id = state->object->get_instance();
}
}
processor.emplace(&*aio, get_store(), s->bucket.get(),
&s->dest_placement,
s->bucket_owner.get_id(),
*static_cast<RGWObjectCtx *>(s->obj_ctx),
s->object->get_obj(), olh_epoch, s->req_id, this, s->yield);
processor.emplace(&*aio, get_store(), state->bucket.get(),
&state->dest_placement,
state->bucket_owner.get_id(),
*static_cast<RGWObjectCtx *>(state->obj_ctx),
state->object->get_obj(), olh_epoch, state->req_id, this, state->yield);

op_ret = processor->prepare(s->yield);
op_ret = processor->prepare(state->yield);
if (op_ret < 0) {
ldout(s->cct, 20) << "processor->prepare() returned ret=" << op_ret
ldout(state->cct, 20) << "processor->prepare() returned ret=" << op_ret
<< dendl;
goto done;
}
filter = &*processor;
if (compression_type != "none") {
plugin = Compressor::create(s->cct, compression_type);
plugin = Compressor::create(state->cct, compression_type);
if (! plugin) {
ldout(s->cct, 1) << "Cannot load plugin for rgw_compression_type "
ldout(state->cct, 1) << "Cannot load plugin for rgw_compression_type "
<< compression_type << dendl;
} else {
compressor.emplace(s->cct, plugin, filter);
compressor.emplace(state->cct, plugin, filter);
filter = &*compressor;
}
}
Expand All @@ -1592,19 +1595,19 @@ namespace rgw {

int RGWWriteRequest::exec_continue()
{
struct req_state* s = get_state();
struct req_state* state = get_state();
op_ret = 0;

/* check guards (e.g., contig write) */
if (eio) {
ldout(s->cct, 5)
ldout(state->cct, 5)
<< " chunks arrived in wrong order"
<< " (mounting with -o sync required)"
<< dendl;
return -EIO;
}

op_ret = s->bucket->check_quota(user_quota, bucket_quota, real_ofs, true);
op_ret = state->bucket->check_quota(user_quota, bucket_quota, real_ofs, true);
/* max_size exceed */
if (op_ret < 0)
return -EIO;
Expand All @@ -1630,23 +1633,23 @@ namespace rgw {
map<string, string>::iterator iter;
char calc_md5[CEPH_CRYPTO_MD5_DIGESTSIZE * 2 + 1];
unsigned char m[CEPH_CRYPTO_MD5_DIGESTSIZE];
struct req_state* s = get_state();
struct req_state* state = get_state();

size_t osize = rgw_fh->get_size();
struct timespec octime = rgw_fh->get_ctime();
struct timespec omtime = rgw_fh->get_mtime();
real_time appx_t = real_clock::now();

s->obj_size = bytes_written;
perfcounter->inc(l_rgw_put_b, s->obj_size);
state->obj_size = bytes_written;
perfcounter->inc(l_rgw_put_b, state->obj_size);

// flush data in filters
op_ret = filter->process({}, s->obj_size);
op_ret = filter->process({}, state->obj_size);
if (op_ret < 0) {
goto done;
}

op_ret = s->bucket->check_quota(user_quota, bucket_quota, s->obj_size, true);
op_ret = state->bucket->check_quota(user_quota, bucket_quota, state->obj_size, true);
/* max_size exceed */
if (op_ret < 0) {
goto done;
Expand All @@ -1658,11 +1661,11 @@ namespace rgw {
bufferlist tmp;
RGWCompressionInfo cs_info;
cs_info.compression_type = plugin->get_type_name();
cs_info.orig_size = s->obj_size;
cs_info.orig_size = state->obj_size;
cs_info.blocks = std::move(compressor->get_compression_blocks());
encode(cs_info, tmp);
attrs[RGW_ATTR_COMPRESSION] = tmp;
ldout(s->cct, 20) << "storing " << RGW_ATTR_COMPRESSION
ldout(state->cct, 20) << "storing " << RGW_ATTR_COMPRESSION
<< " with type=" << cs_info.compression_type
<< ", orig_size=" << cs_info.orig_size
<< ", blocks=" << cs_info.blocks.size() << dendl;
Expand All @@ -1686,14 +1689,14 @@ namespace rgw {
emplace_attr(RGW_ATTR_UNIX_KEY1, std::move(ux_key));
emplace_attr(RGW_ATTR_UNIX1, std::move(ux_attrs));

for (iter = s->generic_attrs.begin(); iter != s->generic_attrs.end();
for (iter = state->generic_attrs.begin(); iter != state->generic_attrs.end();
++iter) {
buffer::list& attrbl = attrs[iter->first];
const string& val = iter->second;
attrbl.append(val.c_str(), val.size() + 1);
}

op_ret = rgw_get_request_metadata(s->cct, s->info, attrs);
op_ret = rgw_get_request_metadata(state->cct, state->info, attrs);
if (op_ret < 0) {
goto done;
}
Expand All @@ -1709,10 +1712,10 @@ namespace rgw {
emplace_attr(RGW_ATTR_SLO_UINDICATOR, std::move(slo_userindicator_bl));
}

op_ret = processor->complete(s->obj_size, etag, &mtime, real_time(), attrs,
op_ret = processor->complete(state->obj_size, etag, &mtime, real_time(), attrs,
(delete_at ? *delete_at : real_time()),
if_match, if_nomatch, nullptr, nullptr, nullptr,
s->yield);
state->yield);
if (op_ret != 0) {
/* revert attr updates */
rgw_fh->set_mtime(omtime);
Expand All @@ -1721,7 +1724,7 @@ namespace rgw {
}

done:
perfcounter->tinc(l_rgw_put_lat, s->time_elapsed());
perfcounter->tinc(l_rgw_put_lat, state->time_elapsed());
return op_ret;
} /* exec_finish */

Expand Down Expand Up @@ -2383,6 +2386,7 @@ int rgw_writev(struct rgw_fs *rgw_fs, struct rgw_file_handle *fh,
rgw_uio *uio, uint32_t flags)
{

// not supported - rest of function is ignored
return -ENOTSUP;

CephContext* cct = static_cast<CephContext*>(rgw_fs->rgw);
Expand Down