From 7a71e7ef01ec254edc1892ce1ea378f7e02cc75b Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Sat, 3 Dec 2022 17:20:33 +0300 Subject: [PATCH] Fix possible duplication of ping & op message IDs --- src/cluster_client.cpp | 6 +++--- src/cluster_client.h | 1 - src/cluster_client_list.cpp | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/cluster_client.cpp b/src/cluster_client.cpp index 45f19b58..7794cd59 100644 --- a/src/cluster_client.cpp +++ b/src/cluster_client.cpp @@ -941,7 +941,7 @@ bool cluster_client_t::try_send(cluster_op_t *op, int i) .req = { .rw = { .header = { .magic = SECONDARY_OSD_OP_MAGIC, - .id = op_id++, + .id = next_op_id(), .opcode = op->opcode == OSD_OP_READ_BITMAP ? OSD_OP_READ : op->opcode, }, .inode = op->cur_inode, @@ -1069,7 +1069,7 @@ void cluster_client_t::send_sync(cluster_op_t *op, cluster_op_part_t *part) .req = { .hdr = { .magic = SECONDARY_OSD_OP_MAGIC, - .id = op_id++, + .id = next_op_id(), .opcode = OSD_OP_SYNC, }, }, @@ -1181,5 +1181,5 @@ void cluster_client_t::copy_part_bitmap(cluster_op_t *op, cluster_op_part_t *par uint64_t cluster_client_t::next_op_id() { - return op_id++; + return msgr.next_subop_id++; } diff --git a/src/cluster_client.h b/src/cluster_client.h index e5befe87..b7e2a2da 100644 --- a/src/cluster_client.h +++ b/src/cluster_client.h @@ -85,7 +85,6 @@ class cluster_client_t int up_wait_retry_interval = 500; // ms int retry_timeout_id = 0; - uint64_t op_id = 1; std::vector offline_ops; cluster_op_t *op_queue_head = NULL, *op_queue_tail = NULL; std::map dirty_buffers; diff --git a/src/cluster_client_list.cpp b/src/cluster_client_list.cpp index 80b9625f..6946f5be 100644 --- a/src/cluster_client_list.cpp +++ b/src/cluster_client_list.cpp @@ -196,7 +196,7 @@ void cluster_client_t::send_list(inode_list_osd_t *cur_list) .sec_list = { .header = { .magic = SECONDARY_OSD_OP_MAGIC, - .id = op_id++, + .id = next_op_id(), .opcode = OSD_OP_SEC_LIST, }, .list_pg = cur_list->pg->pg_num,