]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
cls/user: cls_user_remove_bucket writes modified header
authorCasey Bodley <cbodley@redhat.com>
Wed, 17 Oct 2018 18:50:18 +0000 (14:50 -0400)
committerCasey Bodley <cbodley@redhat.com>
Wed, 17 Oct 2018 18:50:19 +0000 (14:50 -0400)
if cls_user_remove_bucket() modifies the header with dec_header_stats(),
it should write the updated header back

Fixes: http://tracker.ceph.com/issues/36496
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/cls/user/cls_user.cc

index 2f02219fffdb126c1f7d19cac0e53c9ae56c299f..4b8b88eeaf696c0d4c74b857526d695a25c3b2c9 100644 (file)
@@ -254,17 +254,23 @@ static int cls_user_remove_bucket(cls_method_context_t hctx, bufferlist *in, buf
     return ret;
   }
 
-  if (entry.user_stats_sync) {
-    dec_header_stats(&header.stats, entry);
-  }
-
   CLS_LOG(20, "removing entry at %s", key.c_str());
 
   ret = remove_entry(hctx, key);
   if (ret < 0)
     return ret;
-  
-  return 0;
+
+  if (!entry.user_stats_sync) {
+    return 0;
+  }
+
+  dec_header_stats(&header.stats, entry);
+
+  CLS_LOG(20, "header: total bytes=%lld entries=%lld", (long long)header.stats.total_bytes, (long long)header.stats.total_entries);
+
+  bufferlist bl;
+  encode(header, bl);
+  return cls_cxx_map_write_header(hctx, &bl);
 }
 
 static int cls_user_list_buckets(cls_method_context_t hctx, bufferlist *in, bufferlist *out)