diff --git a/lib/blobfs/blobfs.c b/lib/blobfs/blobfs.c index ab221f726..65c02fc02 100644 --- a/lib/blobfs/blobfs.c +++ b/lib/blobfs/blobfs.c @@ -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); } diff --git a/lib/iscsi/iscsi_subsystem.c b/lib/iscsi/iscsi_subsystem.c index d5d7e217b..70bb4aace 100644 --- a/lib/iscsi/iscsi_subsystem.c +++ b/lib/iscsi/iscsi_subsystem.c @@ -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; } diff --git a/lib/nvmf/rdma.c b/lib/nvmf/rdma.c index b7a614b41..012903ee8 100644 --- a/lib/nvmf/rdma.c +++ b/lib/nvmf/rdma.c @@ -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; } diff --git a/lib/nvmf/transport.c b/lib/nvmf/transport.c index 247476e6f..50e4c84b9 100644 --- a/lib/nvmf/transport.c +++ b/lib/nvmf/transport.c @@ -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; } diff --git a/test/unit/lib/blobfs/blobfs_async_ut/blobfs_async_ut.c b/test/unit/lib/blobfs/blobfs_async_ut/blobfs_async_ut.c index b3509a234..0709c1063 100644 --- a/test/unit/lib/blobfs/blobfs_async_ut/blobfs_async_ut.c +++ b/test/unit/lib/blobfs/blobfs_async_ut/blobfs_async_ut.c @@ -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) diff --git a/test/unit/lib/blobfs/blobfs_sync_ut/blobfs_sync_ut.c b/test/unit/lib/blobfs/blobfs_sync_ut/blobfs_sync_ut.c index 2e97ea16e..8ed7e2f6b 100644 --- a/test/unit/lib/blobfs/blobfs_sync_ut/blobfs_sync_ut.c +++ b/test/unit/lib/blobfs/blobfs_sync_ut/blobfs_sync_ut.c @@ -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) diff --git a/test/unit/lib/nvmf/rdma.c/rdma_ut.c b/test/unit/lib/nvmf/rdma.c/rdma_ut.c index ee16f8267..7ec495819 100644 --- a/test/unit/lib/nvmf/rdma.c/rdma_ut.c +++ b/test/unit/lib/nvmf/rdma.c/rdma_ut.c @@ -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 diff --git a/test/unit/lib/nvmf/transport.c/transport_ut.c b/test/unit/lib/nvmf/transport.c/transport_ut.c index 6b9c4b944..428be0dbe 100644 --- a/test/unit/lib/nvmf/transport.c/transport_ut.c +++ b/test/unit/lib/nvmf/transport.c/transport_ut.c @@ -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