print better errors when creating mempools from secondary process
Multiprocess is only supported by a few libraries (e.g. NVMe driver). Other libraries that don't support it will often fail on mempool initialization when running as a secondary process, as the mempools are already created by the primary process. But the error messages are vague and don't indicate why this happened. So, this patch adds a check to see if a mempool exists after spdk_mempool_create() fails and prints an error message informing users that multiprocess is unsupported. Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com> Change-Id: I6f915a94266e64dda380e3b269424cc579372a10 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14234 Community-CI: Mellanox Build Bot Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Dong Yi <dongx.yi@intel.com>
This commit is contained in:
parent
4a6f858872
commit
475b86aa8d
@ -257,8 +257,14 @@ __start_cache_pool_mgmt(void *ctx)
|
||||
SPDK_MEMPOOL_DEFAULT_CACHE_SIZE,
|
||||
SPDK_ENV_SOCKET_ID_ANY);
|
||||
if (!g_cache_pool) {
|
||||
SPDK_ERRLOG("Create mempool failed, you may "
|
||||
"increase the memory and try again\n");
|
||||
if (spdk_mempool_lookup("spdk_fs_cache") != NULL) {
|
||||
SPDK_ERRLOG("Unable to allocate mempool: already exists\n");
|
||||
SPDK_ERRLOG("Probably running in multiprocess environment, which is "
|
||||
"unsupported by the blobfs library\n");
|
||||
} else {
|
||||
SPDK_ERRLOG("Create mempool failed, you may "
|
||||
"increase the memory and try again\n");
|
||||
}
|
||||
assert(false);
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,13 @@ iscsi_initialize_pdu_pool(void)
|
||||
sizeof(struct spdk_iscsi_pdu),
|
||||
256, SPDK_ENV_SOCKET_ID_ANY);
|
||||
if (!iscsi->pdu_pool) {
|
||||
SPDK_ERRLOG("create PDU pool failed\n");
|
||||
if (spdk_mempool_lookup("PDU_Pool") != NULL) {
|
||||
SPDK_ERRLOG("Cannot create PDU pool: already exists\n");
|
||||
SPDK_ERRLOG("Probably running in multiprocess environment, which is "
|
||||
"unsupported by the iSCSI library\n");
|
||||
} else {
|
||||
SPDK_ERRLOG("create PDU pool failed\n");
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -2506,7 +2506,13 @@ nvmf_rdma_create(struct spdk_nvmf_transport_opts *opts)
|
||||
SPDK_MEMPOOL_DEFAULT_CACHE_SIZE,
|
||||
SPDK_ENV_SOCKET_ID_ANY);
|
||||
if (!rtransport->data_wr_pool) {
|
||||
SPDK_ERRLOG("Unable to allocate work request pool for poll group\n");
|
||||
if (spdk_mempool_lookup("spdk_nvmf_rdma_wr_data") != NULL) {
|
||||
SPDK_ERRLOG("Unable to allocate work request pool for poll group: already exists\n");
|
||||
SPDK_ERRLOG("Probably running in multiprocess environment, which is "
|
||||
"unsupported by the nvmf library\n");
|
||||
} else {
|
||||
SPDK_ERRLOG("Unable to allocate work request pool for poll group\n");
|
||||
}
|
||||
nvmf_rdma_destroy(&rtransport->transport, NULL, NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -233,7 +233,13 @@ spdk_nvmf_transport_create(const char *transport_name, struct spdk_nvmf_transpor
|
||||
SPDK_ENV_SOCKET_ID_ANY);
|
||||
|
||||
if (!transport->data_buf_pool) {
|
||||
SPDK_ERRLOG("Unable to allocate buffer pool for poll group\n");
|
||||
if (spdk_mempool_lookup(spdk_mempool_name) != NULL) {
|
||||
SPDK_ERRLOG("Unable to allocate poll group buffer pull: already exists\n");
|
||||
SPDK_ERRLOG("Probably running in multiprocess environment, which is "
|
||||
"unsupported by the nvmf library\n");
|
||||
} else {
|
||||
SPDK_ERRLOG("Unable to allocate buffer pool for poll group\n");
|
||||
}
|
||||
ops->destroy(transport, NULL, NULL);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ int g_fserrno;
|
||||
DEFINE_STUB(spdk_memory_domain_memzero, int, (struct spdk_memory_domain *src_domain,
|
||||
void *src_domain_ctx, struct iovec *iov, uint32_t iovcnt, void (*cpl_cb)(void *, int),
|
||||
void *cpl_cb_arg), 0);
|
||||
DEFINE_STUB(spdk_mempool_lookup, struct spdk_mempool *, (const char *name), NULL);
|
||||
|
||||
static void
|
||||
fs_op_complete(void *ctx, int fserrno)
|
||||
|
@ -31,6 +31,7 @@ struct ut_request {
|
||||
DEFINE_STUB(spdk_memory_domain_memzero, int, (struct spdk_memory_domain *src_domain,
|
||||
void *src_domain_ctx, struct iovec *iov, uint32_t iovcnt, void (*cpl_cb)(void *, int),
|
||||
void *cpl_cb_arg), 0);
|
||||
DEFINE_STUB(spdk_mempool_lookup, struct spdk_mempool *, (const char *name), NULL);
|
||||
|
||||
static void
|
||||
send_request(fs_request_fn fn, void *arg)
|
||||
|
@ -51,6 +51,7 @@ DEFINE_STUB(nvmf_ctrlr_abort_request, int, (struct spdk_nvmf_request *req), 0);
|
||||
DEFINE_STUB(spdk_nvme_transport_id_adrfam_str, const char *, (enum spdk_nvmf_adrfam adrfam), NULL);
|
||||
DEFINE_STUB(ibv_dereg_mr, int, (struct ibv_mr *mr), 0);
|
||||
DEFINE_STUB(ibv_resize_cq, int, (struct ibv_cq *cq, int cqe), 0);
|
||||
DEFINE_STUB(spdk_mempool_lookup, struct spdk_mempool *, (const char *name), NULL);
|
||||
|
||||
/* ibv_reg_mr can be a macro, need to undefine it */
|
||||
#ifdef ibv_reg_mr
|
||||
|
@ -89,6 +89,7 @@ DEFINE_STUB(ut_transport_listen, int, (struct spdk_nvmf_transport *transport,
|
||||
const struct spdk_nvme_transport_id *trid, struct spdk_nvmf_listen_opts *opts), 0);
|
||||
DEFINE_STUB_V(ut_transport_stop_listen, (struct spdk_nvmf_transport *transport,
|
||||
const struct spdk_nvme_transport_id *trid));
|
||||
DEFINE_STUB(spdk_mempool_lookup, struct spdk_mempool *, (const char *name), NULL);
|
||||
|
||||
/* ibv_reg_mr can be a macro, need to undefine it */
|
||||
#ifdef ibv_reg_mr
|
||||
|
Loading…
Reference in New Issue
Block a user