Commit aeafd2e
osd: full-object read crc is mismatch, because truncate modify oi.size 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 <[email protected]>1 parent 4a592ad commit aeafd2e
1 file changed
+12
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6746 | 6746 | | |
6747 | 6747 | | |
6748 | 6748 | | |
| 6749 | + | |
| 6750 | + | |
6749 | 6751 | | |
6750 | 6752 | | |
6751 | 6753 | | |
| |||
6764 | 6766 | | |
6765 | 6767 | | |
6766 | 6768 | | |
6767 | | - | |
6768 | | - | |
6769 | | - | |
6770 | | - | |
| 6769 | + | |
| 6770 | + | |
| 6771 | + | |
| 6772 | + | |
| 6773 | + | |
| 6774 | + | |
| 6775 | + | |
| 6776 | + | |
| 6777 | + | |
| 6778 | + | |
6771 | 6779 | | |
6772 | 6780 | | |
6773 | 6781 | | |
| |||
0 commit comments