]> 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)
committerPritha Srivastava <prsrivas@redhat.com>
Wed, 27 May 2020 10:45:02 +0000 (16:15 +0530)
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>
src/cls/queue/cls_queue_src.cc
src/cls/rgw_gc/cls_rgw_gc.cc

index de23db73c891ae8b06c8ccec625698dea90cc51d..8806b5804971ae7476b31953410a5c6d9f7b30dc 100644 (file)
@@ -27,6 +27,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");
index 58369a2970ab57363d55545bd68cf0929d40378b..cbed0a26e5c24fe7205205f478f8d053566da80d 100644 (file)
@@ -369,7 +369,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);
 }