Ejemplo n.º 1
0
/*---------------------------------------------------------------------------*/
void xio_context_destroy(struct xio_context *ctx)
{
	int i;

	xio_observable_notify_all_observers(&ctx->observable,
					    XIO_CONTEXT_EVENT_CLOSE, NULL);
	xio_observable_unreg_all_observers(&ctx->observable);

	for (i = 0; i < XIO_STAT_LAST; i++)
		if (ctx->stats.name[i])
			kfree(ctx->stats.name[i]);

	xio_workqueue_destroy(ctx->workqueue);

	/* can free only xio created loop */
	if (ctx->flags != XIO_LOOP_USER_LOOP)
		xio_ev_loop_destroy(ctx->ev_loop);

	ctx->ev_loop = NULL;

	if (ctx->ctx_dentry) {
		debugfs_remove_recursive(ctx->ctx_dentry);
		ctx->ctx_dentry = NULL;
	}

	kfree(ctx);
}
Ejemplo n.º 2
0
/*---------------------------------------------------------------------------*/
static void xio_server_destroy(struct kref *kref)
{
	struct xio_server *server = container_of(kref,
						 struct xio_server, kref);

	DEBUG_LOG("xio_server_destroy - server:%p\n", server);
	xio_observable_unreg_all_observers(&server->nexus_observable);

	xio_nexus_close(server->listener, NULL);

	XIO_OBSERVER_DESTROY(&server->observer);
	XIO_OBSERVABLE_DESTROY(&server->nexus_observable);

	kfree(server->uri);
	kfree(server);
}
Ejemplo n.º 3
0
/*---------------------------------------------------------------------------*/
void xio_destroy_context_continue(struct work_struct *work)
{
	xio_work_handle_t *xio_work;
	struct xio_context *ctx;
	int i;

	xio_work = container_of(work, xio_work_handle_t, work);
	ctx = container_of(xio_work, struct xio_context, destroy_ctx_work);
	if (ctx->run_private)
		ERROR_LOG("not all observers finished! run_private=%d\n",
			  ctx->run_private);

	xio_observable_notify_all_observers(&ctx->observable,
					    XIO_CONTEXT_EVENT_POST_CLOSE, NULL);

	if (!xio_observable_is_empty(&ctx->observable))
		ERROR_LOG("context destroy: observers leak - %p\n", ctx);

	xio_observable_unreg_all_observers(&ctx->observable);

	for (i = 0; i < XIO_STAT_LAST; i++)
		kfree(ctx->stats.name[i]);

	xio_workqueue_destroy(ctx->workqueue);
	xio_objpool_destroy(ctx->msg_pool);

	/* can free only xio created loop */
	if (ctx->flags != XIO_LOOP_USER_LOOP)
		xio_ev_loop_destroy(ctx->ev_loop);

	ctx->ev_loop = NULL;

	XIO_OBSERVABLE_DESTROY(&ctx->observable);

	xio_ctx_task_pools_destroy(ctx);

	if (ctx->mempool) {
		xio_mempool_destroy(ctx->mempool);
		ctx->mempool = NULL;
	}

	kfree(ctx);
}