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: fix copy object issue #30866
rgw: fix copy object issue #30866
Conversation
thanks @DHB-liuhong! this appears to resolve https://tracker.ceph.com/issues/40808. radosgw has been failing the test cases from ceph/s3-tests#96, so i'll use those tests to validate your changes |
src/rgw/rgw_rados.cc
Outdated
@@ -5637,7 +5637,7 @@ int RGWRados::Object::Read::prepare(optional_yield y) | |||
string if_nomatch_str = rgw_string_unquote(conds.if_nomatch); | |||
ldout(cct, 10) << "ETag: " << string(etag.c_str(), etag.length()) << " " << " If-NoMatch: " << if_nomatch_str << dendl; | |||
if (if_nomatch_str.compare(0, etag.length(), etag.c_str(), etag.length()) == 0) { | |||
return -ERR_NOT_MODIFIED; | |||
return -ERR_PRECONDITION_FAILED; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this change looks correct for the CopyObj case, but not for the general case of GetObj with If-None-Match according to https://tools.ietf.org/html/rfc7232#section-3.2:
An origin server MUST NOT perform the requested method if the
condition evaluates to false; instead, the origin server MUST respond
with either a) the 304 (Not Modified) status code if the request
method is GET or HEAD or b) the 412 (Precondition Failed) status code
for all other request methods.
i feel like it's appropriate for RGWRados::Object::Read::prepare()
to return -ERR_NOT_MODIFIED
here so the GetObj case continues to work, but RGWRados::copy_obj()
should map this -ERR_NOT_MODIFIED
error to -ERR_PRECONDITION_FAILED
what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, @cbodley you are right, i have changed it.
@cbodley Please review it for me. Thanks |
thanks, it looks great and the s3tests are passing 👍 could you please squash the changes into a single commit and add |
@cbodley i have done it. |
This pull request has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs for another 30 days. |
Not stale. |
@DHB-liuhong could you please rebase to resolve the merge conflict? |
This pull request has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs for another 30 days. |
ok .i will deal it |
…does not match its entity tag(ETag) or CopySourceIfNoneMatch match its entity tag Fixes: https://tracker.ceph.com/issues/40808 Signed-off-by: DHB-liuhong <liuhong@cmss.chinamobile.com>
i have done it. |
This pull request has been automatically marked as stale because it has not had any activity for 60 days. It will be closed if no further activity occurs for another 30 days. |
This pull request has been automatically closed because there has been no activity for 90 days. Please feel free to reopen this pull request (or open a new one) if the proposed change is still appropriate. Thank you for your contribution! |
should this be stale? |
rgw:fix copy object successfully when the value of CopySourceIfMatch does not match its entity tag(ETag)
rgw:fix error return code when the value of CopySourceIfNoneMatch match its entity tag(ETag).
Signed-off-by: DHB-liuhong liuhong@cmss.chinamobile.com