Repository navigation
osd: full-object read CRC mismatch due to 'truncate' modifying oi.size w/o clearing 'data_digest' #55008
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
osd: full-object read CRC mismatch due to 'truncate' modifying oi.size w/o clearing 'data_digest' #55008
Changes from all commits
aeafd2e
83d3523
afd4266
6662e6b
06e4c6f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -495,6 +495,18 @@ TEST_F(LibRadosIoPP, XattrListPP) { | |
| } | ||
| } | ||
|
|
||
| TEST_F(LibRadosIoPP, CrcZeroWrite) { | ||
| char buf[128]; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. crimson lacks the fix, so I expect this test to fail there. Might we worth adding at a comment at least.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's a simple fix -- can we just go ahead and fix it in crimson rather than letting the test fail?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. actually, i tested it on crimson and it pass
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test fails sporadically with ENOTSUP:
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm thinking about skipping it on Windows for the time being: ceph/ceph-win32-tests#19 |
||
| bufferlist bl; | ||
|
|
||
| ASSERT_EQ(0, ioctx.write("foo", bl, 0, 0)); | ||
| ASSERT_EQ(0, ioctx.write("foo", bl, 0, sizeof(buf))); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, the only usage of the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @rzarzynski yes, i had in mind to check that we didn't had any override above zero, but i didn't added it. i can remove the memset.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @rzarzynski please review |
||
|
|
||
| ObjectReadOperation read; | ||
| read.read(0, bl.length(), NULL, NULL); | ||
| ASSERT_EQ(0, ioctx.operate("foo", &read, &bl)); | ||
| } | ||
|
|
||
| TEST_F(LibRadosIoECPP, SimpleWritePP) { | ||
| SKIP_IF_CRIMSON(); | ||
| char buf[128]; | ||
|
|
@@ -865,6 +877,22 @@ TEST_F(LibRadosIoECPP, RmXattrPP) { | |
| ASSERT_EQ(-ENOENT, ioctx.rmxattr("foo_rmxattr", attr2)); | ||
| } | ||
|
|
||
| TEST_F(LibRadosIoECPP, CrcZeroWrite) { | ||
| SKIP_IF_CRIMSON(); | ||
| set_allow_ec_overwrites(pool_name, true); | ||
| char buf[128]; | ||
| memset(buf, 0xcc, sizeof(buf)); | ||
| bufferlist bl; | ||
|
|
||
| ASSERT_EQ(0, ioctx.write("foo", bl, 0, 0)); | ||
| ASSERT_EQ(0, ioctx.write("foo", bl, 0, sizeof(buf))); | ||
|
|
||
| ObjectReadOperation read; | ||
| read.read(0, bl.length(), NULL, NULL); | ||
| ASSERT_EQ(0, ioctx.operate("foo", &read, &bl)); | ||
| recreate_pool(); | ||
| } | ||
|
|
||
| TEST_F(LibRadosIoECPP, XattrListPP) { | ||
| SKIP_IF_CRIMSON(); | ||
| char buf[128]; | ||
|
|
||
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.
In this case the logic is a little bit different than in
CEPH_OSD_OP_TRUNCATE:The difference is what happens in the
op.extent.truncate_size == oi.sizecase:CEPH_OSD_OP_TRUNCATEclears the digest;CEPH_OSD_OP_WRITE– does not.I think the reason is that the trunc-like write differs from regular trunc. The former puts
truncateinto the transaction when expanding the object; for shrinking (or keeping same) onlynop+ update ofobject_infohappens – the data is untouched. Therefore preserving the digest forop.extent.truncate_size == oi.sizeshould be fine.