]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cls/rgw_gc: Clearing off urgent data in bufferlist, before
authorPritha Srivastava <prsrivas@redhat.com>
Wed, 27 May 2020 08:40:20 +0000 (14:10 +0530)
committerNathan Cutler <ncutler@suse.com>
Sat, 6 Jun 2020 08:19:47 +0000 (10:19 +0200)
encoding the updated one.

If this is not done, urgent data keeps getting appended
to the head, finally overwriting queue data that results
in invalid entries.

Signed-off-by: Pritha Srivastava <prsrivas@redhat.com>
(cherry picked from commit 182382cf6368eaa6f9d1efbb883ae7813a9bf6d0)

src/cls/queue/cls_queue_src.cc
src/cls/rgw_gc/cls_rgw_gc.cc

index b48dcd19f8517188d6fda54c39b1ef8ed5682143..ae8eb8edd9bd2a44d35db5e5abeeba237b3630c5 100644 (file)
@@ -25,6 +25,11 @@ int queue_write_head(cls_method_context_t hctx, cls_queue_head& head)
 
   bl.claim_append(bl_head);
 
+  if (bl.length() > head.max_head_size) {
+    CLS_LOG(0, "ERROR: queue_write_head: invalid head size = %u and urgent data size = %u \n", bl.length(), head.bl_urgent_data.length());
+    return -EINVAL;
+  }
+
   int ret = cls_cxx_write2(hctx, 0, bl.length(), &bl, CEPH_OSD_OP_FLAG_FADVISE_WILLNEED);
   if (ret < 0) {
     CLS_LOG(5, "ERROR: queue_write_head: failed to write head\n");
index 976e49ea52e114d5050ccb048b09a0c2535ea0ad..77e1e643389c395449ba9f3f3ec5d99c85253254 100644 (file)
@@ -361,7 +361,9 @@ static int cls_rgw_gc_queue_remove_entries(cls_method_context_t hctx, bufferlist
   }
 
   //Update urgent data map
+  head.bl_urgent_data.clear();
   encode(urgent_data, head.bl_urgent_data);
+  CLS_LOG(5, "INFO: cls_rgw_gc_queue_remove_entries(): Urgent data size is %u\n", head.bl_urgent_data.length());
 
   return queue_write_head(hctx, head);
 }