osd/PrimaryLogPG: trigger auto-repair on full-object-size CRC error

There are still FileStore users and the full-object CRC might be able
to catch silently returned data errors. Since we support auto-repair now,
let's trigger an auto-repair process instead.

Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
This commit is contained in:
xie xingguo 2017-10-17 20:23:05 +08:00
parent 3455a38f73
commit 4667280f8a

View File

@ -4744,6 +4744,17 @@ int PrimaryLogPG::do_read(OpContext *ctx, OSDOp& osd_op) {
} else {
int r = pgbackend->objects_read_sync(
soid, op.extent.offset, op.extent.length, op.flags, &osd_op.outdata);
// whole object? can we verify the checksum?
if (r >= 0 && op.extent.length == oi.size && oi.is_data_digest()) {
uint32_t crc = osd_op.outdata.crc32c(-1);
if (oi.data_digest != crc) {
osd->clog->error() << info.pgid << std::hex
<< " full-object read crc 0x" << crc
<< " != expected 0x" << oi.data_digest
<< std::dec << " on " << soid;
r = -EIO; // try repair later
}
}
if (r == -EIO) {
r = rep_repair_primary_object(soid, ctx->op);
}
@ -4755,19 +4766,6 @@ int PrimaryLogPG::do_read(OpContext *ctx, OSDOp& osd_op) {
}
dout(10) << " read got " << r << " / " << op.extent.length
<< " bytes from obj " << soid << dendl;
// whole object? can we verify the checksum?
if (op.extent.length == oi.size && oi.is_data_digest()) {
uint32_t crc = osd_op.outdata.crc32c(-1);
if (oi.data_digest != crc) {
osd->clog->error() << info.pgid << std::hex
<< " full-object read crc 0x" << crc
<< " != expected 0x" << oi.data_digest
<< std::dec << " on " << soid;
// FIXME fall back to replica or something?
result = -EIO;
}
}
}
// XXX the op.extent.length is the requested length for async read