Skip to content

osd: full-object read crc is mismatch, because truncate modify oi.siz…#43902

Closed
jiawd wants to merge 3 commits intoceph:masterfrom
jiawd:wip-53240
Closed

osd: full-object read crc is mismatch, because truncate modify oi.siz…#43902
jiawd wants to merge 3 commits intoceph:masterfrom
jiawd:wip-53240

Conversation

@jiawd
Copy link
Contributor

@jiawd jiawd commented Nov 12, 2021

…e and forget to clear data_digest

when write before truncate, need trim length, if truncate is to 0,
write is [0128k], write change to [00], do nothing, oi.size is 0, x1 = set_data_digest(crc32(-1)).
write is [128k128k], write change to [128k0], truncate oi.size to offset 128k, x2 = set_data_digest(crc32(x1)).
write is [256k128k], write change to [256k0], truncate oi.size to offset 256k, x3 = set_data_digest(crc32(x2)).
...
write is [4063232128k], write change to [40632320], truncate oi.size to offset 4063232, xn = set_data_digest(crs32(xn-1))
Now, we can see oi.size is 4063232, and data_digest is 0xffffffff, because thelength of in_data of crc is 0 every time.
when read verify crc will reply EIO. (EC pool).

so, when truncate in write, need clear data_digest and DIGEST flag,
when write before truncate, need to trim length, when offset over than oi.size, don't truncate oi.size to offset.

Fixes: https://tracker.ceph.com/issues/53240
Signed-off-by: jiawd jiawendong@xtaotech.com

…e and forget to clear data_digest

when write before truncate, need trim length, if truncate is to 0,
write is [0~128k], write change to [0~0], do nothing, oi.size is 0, x1 = set_data_digest(crc32(-1)).
write is [128k~128k], write change to [128k~0], truncate oi.size to offset 128k, x2 = set_data_digest(crc32(x1)).
write is [256k~128k], write change to [256k~0], truncate oi.size to offset 256k, x3 = set_data_digest(crc32(x2)).
...
write is [4063232~128k], write change to [4063232~0], truncate oi.size to offset 4063232, xn = set_data_digest(crs32(xn-1))
Now, we can see oi.size is 4063232, and data_digest is 0xffffffff, because thelength of in_data of crc is 0 every time.
when read verify crc will reply EIO. (EC pool).

so, when truncate in write, need clear data_digest and DIGEST flag,
when write before truncate, need to trim length, when offset over than oi.size, don't truncate oi.size to offset.

Fixes: https://tracker.ceph.com/issues/53240
Signed-off-by: jiawd <jiawendong@xtaotech.com>
Fixes: https://tracker.ceph.com/issues/53240
Signed-off-by: jiawd <jiawendong@xtaotech.com>
@github-actions github-actions bot added the core label Nov 12, 2021
Fixes: https://tracker.ceph.com/issues/53240
Signed-off-by: jiawd <jiawendong@xtaotech.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant