]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cls_rgw: change scoping of suggested changes vars
authorYehuda Sadeh <yehuda@inktank.com>
Wed, 12 Sep 2012 23:41:17 +0000 (16:41 -0700)
committerYehuda Sadeh <yehuda@inktank.com>
Tue, 18 Sep 2012 20:30:40 +0000 (13:30 -0700)
Fixes: #3127
Bad variable scoping made it so that specific variables
weren't initialized between suggested changes iterations.
This specifically affected a case where in a specific
change we had an updated followed by a remove, and the
remove was on a non-existent key (e.g., was already
removed earlier). We ended up re-substracting the
object stats, as the entry wasn't reset between
the iterations (and we didn't read it because the
key didn't exist).

backport:argonaut
Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
src/cls_rgw.cc

index c46be4ad8c46c0357fbaa2b977c28d89b987da8c..8523317d9670afe3418713c86a96ff1b0f52c9a2 100644 (file)
@@ -337,12 +337,11 @@ int rgw_dir_suggest_changes(cls_method_context_t hctx, bufferlist *in, bufferlis
   }
 
   bufferlist::iterator in_iter = in->begin();
-  __u8 op;
-  rgw_bucket_dir_entry cur_change;
-  rgw_bucket_dir_entry cur_disk;
-  bufferlist op_bl;
 
   while (!in_iter.end()) {
+    __u8 op;
+    rgw_bucket_dir_entry cur_change;
+    rgw_bucket_dir_entry cur_disk;
     try {
       ::decode(op, in_iter);
       ::decode(cur_change, in_iter);