From 52a4e4bcc7335196cb1389ef549b4b6d86824932 Mon Sep 17 00:00:00 2001 From: Dan Mick Date: Tue, 18 Dec 2012 12:27:36 -0800 Subject: Fix bug exposed by sparse-read from OSD: must zero-fill assembled result if not at end of result bl --- src/osdc/Striper.cc | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/osdc/Striper.cc b/src/osdc/Striper.cc index 40da177f254..53996445c03 100644 --- a/src/osdc/Striper.cc +++ b/src/osdc/Striper.cc @@ -313,11 +313,19 @@ void Striper::StripedReadResult::assemble_result(CephContext *cct, bufferlist& b bl.claim_prepend(p->second.first); } } else { - // if we have all the data, or there is none at all, grab a full - // or empty buffer and stick it on the front here - ldout(cct, 20) << "assemble_result(" << this << ") adding entire " - << "buffer len " << p->second.first.length() << dendl; - bl.claim_prepend(p->second.first); + // if there is no data, but we're still at the end, continue; + // if not at end we're forced to zero-pad + if (!bl.length()) { + ldout(cct, 20) << "assemble_result(" << this << ") skipping null " + << "buffer " << p->second.first.length() << dendl; + } else { + ldout(cct, 20) << "assemble_result(" << this << ") zero-padding with " + << p->second.second << dendl; + bufferptr bp(p->second.second); + bp.zero(); + bl.push_front(bp); + bl.claim_prepend(p->second.first); + } } p++; } -- cgit v1.2.1