summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Mick <dan.mick@inktank.com>2012-12-18 12:27:36 -0800
committerDan Mick <dan.mick@inktank.com>2012-12-18 12:27:36 -0800
commit52a4e4bcc7335196cb1389ef549b4b6d86824932 (patch)
tree9de843ffba74eb639626e249ff27c53b07578f73
parent76b102e1966d848285018f2b3789a20387843424 (diff)
downloadceph-wip-rbd-striping.tar.gz
Fix bug exposed by sparse-read from OSD: must zero-fill assembledwip-rbd-striping
result if not at end of result bl
-rw-r--r--src/osdc/Striper.cc18
1 files 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++;
}