From c750c6a441f67367addb238bf1f43c459c7ebad1 Mon Sep 17 00:00:00 2001 From: Leonid Chernin Date: Tue, 19 Dec 2023 11:35:12 +0000 Subject: [PATCH] Adding nonce to rbd_bdev cluster , responce to rpc with nonce Signed-off-by: Leonid Chernin (cherry picked from commit f72303759cf9034330cb6f571eb4c57b95acc545) --- module/bdev/rbd/bdev_rbd.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/module/bdev/rbd/bdev_rbd.c b/module/bdev/rbd/bdev_rbd.c index 42a608d4812..dbed2fc4af4 100644 --- a/module/bdev/rbd/bdev_rbd.c +++ b/module/bdev/rbd/bdev_rbd.c @@ -82,6 +82,7 @@ struct bdev_rbd_cluster { char *key_file; char *core_mask; rados_t cluster; + char *nonce; uint32_t ref; STAILQ_ENTRY(bdev_rbd_cluster) link; }; @@ -128,6 +129,8 @@ bdev_rbd_cluster_free(struct bdev_rbd_cluster *entry) free(entry->user_id); free(entry->name); free(entry->core_mask); + if (entry->nonce) + free(entry->nonce); free(entry); } @@ -529,6 +532,7 @@ bdev_rbd_finish_aiocb(rbd_completion_t cb, void *arg) bdev_rbd_io_complete(bdev_io, bio_status); } + static void _bdev_rbd_start_aio(struct bdev_rbd *disk, struct spdk_bdev_io *bdev_io, struct iovec *iov, int iovcnt, uint64_t offset, size_t len) @@ -870,7 +874,9 @@ bdev_rbd_cluster_dump_entry(const char *cluster_name, struct spdk_json_write_ctx if (entry->key_file) { spdk_json_write_named_string(w, "key_file", entry->key_file); } - + if(entry->nonce){ + spdk_json_write_named_string(w, "nonce", entry->nonce); + } pthread_mutex_unlock(&g_map_bdev_rbd_cluster_mutex); return; } @@ -983,6 +989,9 @@ dump_single_cluster_entry(struct bdev_rbd_cluster *entry, struct spdk_json_write if (entry->core_mask) { spdk_json_write_named_string(w, "core_mask", entry->core_mask); } + if (entry->nonce){ + spdk_json_write_named_string(w, "nonce", entry->nonce); + } spdk_json_write_object_end(w); } @@ -1197,6 +1206,8 @@ rbd_register_cluster(const char *name, const char *user_id, const char *const *c rados_shutdown(entry->cluster); goto err_handle; } + rc = rados_getaddrs(entry->cluster , &entry->nonce); + SPDK_NOTICELOG("rbd_register_cluster %s, nonce %s, rc %d \n", entry->name, entry->nonce, rc); STAILQ_INSERT_TAIL(&g_map_bdev_rbd_cluster, entry, link); pthread_mutex_unlock(&g_map_bdev_rbd_cluster_mutex);