From 8fc66a4ab29d4abfd0fd838a24cfb6279b0d557f Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 23 Dec 2013 12:52:34 -0800 Subject: [PATCH] osd/ReplicatedPG: fix copy-get iteration of omap keys We need to call upper_bound() before checking if the iterator is valid! Signed-off-by: Sage Weil --- src/osd/ReplicatedPG.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 0eb16ba2131..93258209df0 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -4682,8 +4682,8 @@ int ReplicatedPG::fill_in_copy_get(bufferlist::iterator& bp, OSDOp& osd_op, ObjectMap::ObjectMapIterator iter = osd->store->get_omap_iterator(coll, oi.soid); assert(iter); + iter->upper_bound(cursor.omap_offset); if (iter->valid()) { - iter->upper_bound(cursor.omap_offset); for (; left > 0 && iter->valid(); iter->next()) { out_omap.insert(make_pair(iter->key(), iter->value())); left -= iter->key().length() + 4 + iter->value().length() + 4; @@ -4698,10 +4698,11 @@ int ReplicatedPG::fill_in_copy_get(bufferlist::iterator& bp, OSDOp& osd_op, } dout(20) << " cursor.is_complete=" << cursor.is_complete() - << " " << out_attrs.size() << " attrs" - << " " << bl.length() << " bytes" - << " " << out_omap.size() << " keys" - << dendl; + << " " << out_attrs.size() << " attrs" + << " " << bl.length() << " bytes" + << " " << reply_obj.omap_header.length() << " omap header bytes" + << " " << out_omap.size() << " keys" + << dendl; reply_obj.cursor = cursor; if (classic) { if (reply_obj.omap_header.length() > 0) {