From: Jason Dillaman Date: Tue, 10 Mar 2015 05:11:38 +0000 (-0400) Subject: librbd: do not invalidate oversized object map X-Git-Tag: v0.94~47^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0212ae4651b9eb1b20bbddb59a48b5ba1e418357;p=ceph.git librbd: do not invalidate oversized object map If the object map is too large for the current image, it implies that a resize operation was interrupted. It should only be considered invalid if the object map is smaller than the image, which shouldn't be possible. Signed-off-by: Jason Dillaman --- diff --git a/src/librbd/ObjectMap.cc b/src/librbd/ObjectMap.cc index 27d1db7a23d..e13f62fc993 100644 --- a/src/librbd/ObjectMap.cc +++ b/src/librbd/ObjectMap.cc @@ -166,7 +166,7 @@ void ObjectMap::refresh(uint64_t snap_id) std::string oid(object_map_name(m_image_ctx.id, snap_id)); int r = cls_client::object_map_load(&m_image_ctx.md_ctx, oid, &m_object_map); - if (r < 0) { + if (r < 0) { lderr(cct) << "error refreshing object map: " << cpp_strerror(r) << dendl; invalidate(); @@ -179,11 +179,14 @@ void ObjectMap::refresh(uint64_t snap_id) uint64_t num_objs = Striper::get_num_objects( m_image_ctx.layout, m_image_ctx.get_image_size(snap_id)); - if (m_object_map.size() != num_objs) { - // resize op might have been interrupted - lderr(cct) << "incorrect object map size: " << m_object_map.size() - << " != " << num_objs << dendl; + if (m_object_map.size() < num_objs) { + lderr(cct) << "object map smaller than current object count: " + << m_object_map.size() << " != " << num_objs << dendl; invalidate(); + } else if (m_object_map.size() > num_objs) { + // resize op might have been interrupted + ldout(cct, 1) << "object map larger than current object count: " + << m_object_map.size() << " != " << num_objs << dendl; } }