From: Greg Farnum Date: Mon, 23 May 2016 22:14:21 +0000 (-0700) Subject: hammer: ObjectCacher: fix bh_read_finish offset logic X-Git-Tag: v0.94.10~40^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=ece0ec60154d22bca7002cc308f3a0f4e36a053e;p=ceph.git hammer: ObjectCacher: fix bh_read_finish offset logic If we have an incoming read split across multiple BufferHeads, we want to line up the BufferHead's bl with the incoming OSDOp's bl at the right offset. We were erroneously using this nonsense calculation (always equal to zero!) when a much simpler comparison of the BufferHead's logical object offset to the incoming OSDOp's logical offset will do the trick nicely. Fixes: http://tracker.ceph.com/issues/16002 Signed-off-by: Greg Farnum (cherry picked from commit 9ec6e7f608608088d51e449c9d375844631dcdde) --- diff --git a/src/osdc/ObjectCacher.cc b/src/osdc/ObjectCacher.cc index abac935d6020..d68db6fdb558 100644 --- a/src/osdc/ObjectCacher.cc +++ b/src/osdc/ObjectCacher.cc @@ -787,7 +787,6 @@ void ObjectCacher::bh_read_finish(int64_t poolid, sobject_t oid, ceph_tid_t tid, if (bh->error < 0) err = bh->error; - loff_t oldpos = opos; opos = bh->end(); if (r == -ENOENT) { @@ -807,7 +806,7 @@ void ObjectCacher::bh_read_finish(int64_t poolid, sobject_t oid, ceph_tid_t tid, mark_error(bh); } else { bh->bl.substr_of(bl, - oldpos-bh->start(), + bh->start() - start, bh->length()); mark_clean(bh); }