Commit 475b86aa authored by Konrad Sztyber's avatar Konrad Sztyber Committed by Tomasz Zawadzki
Browse files

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: default avatarKonrad 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: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarDong Yi <dongx.yi@intel.com>
parent 4a6f8588
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -257,8 +257,14 @@ __start_cache_pool_mgmt(void *ctx)
					   SPDK_MEMPOOL_DEFAULT_CACHE_SIZE,
					   SPDK_ENV_SOCKET_ID_ANY);
	if (!g_cache_pool) {
		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);
	}

+7 −1
Original line number Diff line number Diff line
@@ -55,7 +55,13 @@ iscsi_initialize_pdu_pool(void)
					      sizeof(struct spdk_iscsi_pdu),
					      256, SPDK_ENV_SOCKET_ID_ANY);
	if (!iscsi->pdu_pool) {
		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;
	}

+7 −1
Original line number Diff line number Diff line
@@ -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) {
		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;
	}
+7 −1
Original line number Diff line number Diff line
@@ -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) {
			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;
		}
+1 −0
Original line number Diff line number Diff line
@@ -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)
Loading