]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cls/user: cls_user_remove_bucket writes modified header 24910/head
authorCasey Bodley <cbodley@redhat.com>
Wed, 17 Oct 2018 18:50:18 +0000 (14:50 -0400)
committerNathan Cutler <ncutler@suse.com>
Sat, 3 Nov 2018 14:19:15 +0000 (15:19 +0100)
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>
(cherry picked from commit dac26de1fa7b56ce0ec2fd43d26ab9a9b6a32e3d)

src/cls/user/cls_user.cc

index d350a7a1292bb170f0280b125cfce77e827280f7..0880e785006e8684230aced9fafb38d2314b6079 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)