]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commit
osd: full-object read crc is mismatch, because truncate modify oi.size and forget...
authorjiawd <jiawendong@xtaotech.com>
Fri, 12 Nov 2021 03:48:56 +0000 (03:48 +0000)
committerNitzan Mordechai <nmordech@redhat.com>
Tue, 21 May 2024 05:19:06 +0000 (05:19 +0000)
commit459b07ee1d0c5d1feb855f9e9f86985daa1d9c17
tree73beda471e63e48d8da4860a5c8051e965aa17ff
parentb9b067bc6d30ec00e391f0fa43f50affe981ba2f
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 <jiawendong@xtaotech.com>
(cherry picked from commit aeafd2e9a452d6a10b742c885dc44927b256c3bf)
src/osd/PrimaryLogPG.cc