]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cls_rbd: fixed object_map_resize boundary issue
authorJason Dillaman <dillaman@redhat.com>
Tue, 3 Feb 2015 09:15:43 +0000 (04:15 -0500)
committerJason Dillaman <dillaman@redhat.com>
Tue, 3 Feb 2015 10:28:29 +0000 (05:28 -0500)
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 <dillaman@redhat.com>
src/cls/rbd/cls_rbd.cc

index 481ca31be23177ab9daa24660749e6e1809c6144..bfde2b847db76df877b29d891d9feca5010fa8fc 100644 (file)
@@ -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;
       }
     }