]> 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 19:57:05 +0000 (12:57 -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/cls_rgw.cc

index 2535cb0b2cceb001f41ecadafaab072a52515742..efc6073502d2e9916febbea1b31bcda6ff87ed6b 100644 (file)
@@ -378,12 +378,11 @@ int rgw_dir_suggest_changes(cls_method_context_t hctx, bufferlist *in, bufferlis
   tag_timeout = (header.tag_timeout ? header.tag_timeout : CEPH_RGW_TAG_TIMEOUT);
 
   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);