From: Jason Dillaman Date: Tue, 3 Feb 2015 09:15:43 +0000 (-0500) Subject: cls_rbd: fixed object_map_resize boundary issue X-Git-Tag: v0.93~102^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=fbcde04a386749dea1f1443724fc76446a0538ce;p=ceph.git cls_rbd: fixed object_map_resize boundary issue The object_map_resize sanity check ensures that a resize will not erase state for an in-use object. The check was incorrectly including a block within the new object map range. Signed-off-by: Jason Dillaman --- diff --git a/src/cls/rbd/cls_rbd.cc b/src/cls/rbd/cls_rbd.cc index 481ca31be231..bfde2b847db7 100644 --- a/src/cls/rbd/cls_rbd.cc +++ b/src/cls/rbd/cls_rbd.cc @@ -1973,8 +1973,9 @@ int object_map_resize(cls_method_context_t hctx, bufferlist *in, bufferlist *out size_t orig_object_map_size = object_map.size(); if (object_count < orig_object_map_size) { - for (uint64_t i = object_count; i < orig_object_map_size; ++i) { + for (uint64_t i = object_count + 1; i < orig_object_map_size; ++i) { if (object_map[i] != default_state) { + CLS_ERR("object map indicates object still exists: %" PRIu64, i); return -ESTALE; } }