From fbcde04a386749dea1f1443724fc76446a0538ce Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Tue, 3 Feb 2015 04:15:43 -0500 Subject: [PATCH] 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 --- src/cls/rbd/cls_rbd.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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; } } -- 2.47.3