Skip to content

Commit

Permalink
Adding nonce to rbd_bdev cluster , responce to rpc with nonce
Browse files Browse the repository at this point in the history
Signed-off-by: Leonid Chernin <[email protected]>
(cherry picked from commit f723037)
  • Loading branch information
Leonid Chernin authored and Alexander Indenbaum committed Apr 11, 2024
1 parent bcb9dfd commit c750c6a
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion module/bdev/rbd/bdev_rbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit c750c6a

Please sign in to comment.