Skip to content
This repository has been archived by the owner on Feb 8, 2024. It is now read-only.

Commit

Permalink
rgw_sal_motr:[CORTX-33799] Handle progress_cb response in case of cop…
Browse files Browse the repository at this point in the history
…y-object operation failure. (#386)

Problem: If copy operation failed after copying some data, then it was throwing an invalid XML error due to partial progress response. i.e rgw was not closing 'CopyObjectResult' tag in case of failure.

Solution: Remove progress_cb call from rgw_sal_motr layer, and send 'dump_continue' signal to avoid client timeout during copy operation.

Signed-off-by: Shriya Deshmukh <shriya.deshmukh@seagate.com>
  • Loading branch information
shriya-deshmukh authored and jjxsg committed Aug 22, 2022
1 parent e0f7d3d commit f39063a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
13 changes: 4 additions & 9 deletions src/rgw/rgw_sal_motr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ extern "C" {
#include "rgw_bucket.h"
#include "rgw_quota.h"
#include "motr/addb/rgw_addb.h"
#include "rgw_rest.h"

#define dout_subsys ceph_subsys_rgw

Expand Down Expand Up @@ -2295,12 +2296,10 @@ int MotrObject::delete_obj_aio(const DoutPrefixProvider* dpp, RGWObjState* astat

int MotrCopyObj_CB::handle_data(bufferlist& bl, off_t bl_ofs, off_t bl_len)
{
progress_cb progress_CB = this->get_progress_cb();
int rc = 0;
ldpp_dout(m_dpp, 20) << "Offset=" << bl_ofs << " Length = "
<< " Write Offset=" << write_offset << bl_len << dendl;


//offset is zero and bufferlength is equal to bl_len
if (!bl_ofs && bl_len == bl.length()) {
bufferptr bptr(bl.c_str(), bl_len);
Expand All @@ -2313,9 +2312,7 @@ int MotrCopyObj_CB::handle_data(bufferlist& bl, off_t bl_ofs, off_t bl_len)
write_offset << "failed rc=" << rc << dendl;
}
write_offset += bl_len;
if(progress_CB){
progress_CB(write_offset, this->get_progress_data());
}
dump_continue(s);
return rc;
}

Expand All @@ -2329,6 +2326,7 @@ int MotrCopyObj_CB::handle_data(bufferlist& bl, off_t bl_ofs, off_t bl_len)
<< " Write Offset=" << write_offset << dendl;
return rc;
}
dump_continue(s);
write_offset += bl_len;

ldpp_dout(m_dpp, 20) << "MotrCopyObj_CB handle_data called rc=" << rc << dendl;
Expand Down Expand Up @@ -2411,7 +2409,7 @@ int MotrObject::copy_object_same_zone(RGWObjectCtx& obj_ctx,
}

// Create filter object.
MotrCopyObj_CB cb(dpp, dst_writer);
MotrCopyObj_CB cb(dpp, dst_writer, obj_ctx);
MotrCopyObj_Filter* filter = &cb;

// Get offsets.
Expand All @@ -2422,9 +2420,6 @@ int MotrObject::copy_object_same_zone(RGWObjectCtx& obj_ctx,
return rc;
}

//setting the values of progress_cb and progress_data in MotrCopyObj_Filter class
filter->set_progress_callback(progress_cb, progress_data);

// read::iterate -> handle_data() -> write::process
rc = read_op->iterate(dpp, cur_ofs, cur_end, filter, y);
if (rc < 0){
Expand Down
8 changes: 5 additions & 3 deletions src/rgw/rgw_sal_motr.h
Original file line number Diff line number Diff line change
Expand Up @@ -531,13 +531,15 @@ class MotrCopyObj_CB : public MotrCopyObj_Filter
const DoutPrefixProvider* m_dpp;
std::shared_ptr<rgw::sal::Writer> m_dst_writer;
off_t write_offset;

struct req_state *s;
public:
explicit MotrCopyObj_CB(const DoutPrefixProvider* dpp,
std::shared_ptr<rgw::sal::Writer> dst_writer) :
std::shared_ptr<rgw::sal::Writer> dst_writer, RGWObjectCtx& obj_ctx) :
m_dpp(dpp),
m_dst_writer(dst_writer),
write_offset(0) {}
write_offset(0) {
s = static_cast<req_state*>(obj_ctx.get_private());
}
virtual ~MotrCopyObj_CB() override {}
int handle_data(bufferlist& bl, off_t bl_ofs, off_t bl_len) override;
};
Expand Down

0 comments on commit f39063a

Please sign in to comment.