Esempio n. 1
0
__init int ptlrpc_init(void)
{
        int rc, cleanup_phase = 0;
        ENTRY;

        lustre_assert_wire_constants();
#if RS_DEBUG
	spin_lock_init(&ptlrpc_rs_debug_lock);
#endif
	mutex_init(&ptlrpc_all_services_mutex);
	mutex_init(&pinger_mutex);
	mutex_init(&ptlrpcd_mutex);
        ptlrpc_init_xid();

        rc = req_layout_init();
        if (rc)
                RETURN(rc);

        rc = ptlrpc_hr_init();
        if (rc)
                RETURN(rc);

        cleanup_phase = 1;

        rc = ptlrpc_init_portals();
        if (rc)
                GOTO(cleanup, rc);
        cleanup_phase = 2;

        rc = ptlrpc_connection_init();
        if (rc)
                GOTO(cleanup, rc);
        cleanup_phase = 3;

        ptlrpc_put_connection_superhack = ptlrpc_connection_put;

        rc = ptlrpc_start_pinger();
        if (rc)
                GOTO(cleanup, rc);
        cleanup_phase = 4;

        rc = ldlm_init();
        if (rc)
                GOTO(cleanup, rc);
        cleanup_phase = 5;

        rc = sptlrpc_init();
        if (rc)
                GOTO(cleanup, rc);

        cleanup_phase = 6;
        rc = llog_recov_init();
        if (rc)
                GOTO(cleanup, rc);

	cleanup_phase = 7;
	rc = ptlrpc_nrs_init();
	if (rc)
		GOTO(cleanup, rc);

#ifdef __KERNEL__
	cleanup_phase = 8;
	rc = tgt_mod_init();
	if (rc)
		GOTO(cleanup, rc);
#endif
        RETURN(0);

cleanup:
        switch(cleanup_phase) {
#ifdef __KERNEL__
	case 8:
		ptlrpc_nrs_fini();
#endif
	case 7:
		llog_recov_fini();
        case 6:
                sptlrpc_fini();
        case 5:
                ldlm_exit();
        case 4:
                ptlrpc_stop_pinger();
        case 3:
                ptlrpc_connection_fini();
        case 2:
                ptlrpc_exit_portals();
        case 1:
                ptlrpc_hr_fini();
                req_layout_fini();
        default: ;
        }

        return rc;
}
Esempio n. 2
0
__init int ptlrpc_init(void)
{
	int rc;

	ENTRY;

	lustre_assert_wire_constants();
#if RS_DEBUG
	spin_lock_init(&ptlrpc_rs_debug_lock);
#endif
	INIT_LIST_HEAD(&ptlrpc_all_services);
	mutex_init(&ptlrpc_all_services_mutex);
	mutex_init(&pinger_mutex);
	mutex_init(&ptlrpcd_mutex);
	ptlrpc_init_xid();

	rc = req_layout_init();
	if (rc)
		RETURN(rc);

	rc = tgt_mod_init();
	if (rc)
		GOTO(err_layout, rc);

	rc = ptlrpc_hr_init();
	if (rc)
		GOTO(err_tgt, rc);

	rc = ptlrpc_request_cache_init();
	if (rc)
		GOTO(err_hr, rc);

	rc = ptlrpc_init_portals();
	if (rc)
		GOTO(err_cache, rc);

	rc = ptlrpc_connection_init();
	if (rc)
		GOTO(err_portals, rc);

	ptlrpc_put_connection_superhack = ptlrpc_connection_put;

	rc = ptlrpc_start_pinger();
	if (rc)
		GOTO(err_conn, rc);

	rc = ldlm_init();
	if (rc)
		GOTO(err_pinger, rc);

	rc = sptlrpc_init();
	if (rc)
		GOTO(err_ldlm, rc);

	rc = ptlrpc_nrs_init();
	if (rc)
		GOTO(err_sptlrpc, rc);

	RETURN(0);
err_sptlrpc:
	sptlrpc_fini();
err_ldlm:
	ldlm_exit();
err_pinger:
	ptlrpc_stop_pinger();
err_conn:
	ptlrpc_connection_fini();
err_portals:
	ptlrpc_exit_portals();
err_cache:
	ptlrpc_request_cache_fini();
err_hr:
	ptlrpc_hr_fini();
err_tgt:
	tgt_mod_exit();
err_layout:
	req_layout_fini();
	return rc;
}
Esempio n. 3
0
static int __init ptlrpc_init(void)
{
	int rc, cleanup_phase = 0;

	lustre_assert_wire_constants();
#if RS_DEBUG
	spin_lock_init(&ptlrpc_rs_debug_lock);
#endif
	mutex_init(&ptlrpc_all_services_mutex);
	mutex_init(&pinger_mutex);
	mutex_init(&ptlrpcd_mutex);
	ptlrpc_init_xid();

	rc = req_layout_init();
	if (rc)
		return rc;

	rc = ptlrpc_hr_init();
	if (rc)
		return rc;

	cleanup_phase = 1;
	rc = ptlrpc_request_cache_init();
	if (rc)
		goto cleanup;

	cleanup_phase = 2;
	rc = ptlrpc_init_portals();
	if (rc)
		goto cleanup;

	cleanup_phase = 3;

	rc = ptlrpc_connection_init();
	if (rc)
		goto cleanup;

	cleanup_phase = 4;
	ptlrpc_put_connection_superhack = ptlrpc_connection_put;

	rc = ptlrpc_start_pinger();
	if (rc)
		goto cleanup;

	cleanup_phase = 5;
	rc = ldlm_init();
	if (rc)
		goto cleanup;

	cleanup_phase = 6;
	rc = sptlrpc_init();
	if (rc)
		goto cleanup;

	cleanup_phase = 7;
	rc = ptlrpc_nrs_init();
	if (rc)
		goto cleanup;

	cleanup_phase = 8;
	rc = tgt_mod_init();
	if (rc)
		goto cleanup;
	return 0;

cleanup:
	switch (cleanup_phase) {
	case 8:
		ptlrpc_nrs_fini();
		/* Fall through */
	case 7:
		sptlrpc_fini();
		/* Fall through */
	case 6:
		ldlm_exit();
		/* Fall through */
	case 5:
		ptlrpc_stop_pinger();
		/* Fall through */
	case 4:
		ptlrpc_connection_fini();
		/* Fall through */
	case 3:
		ptlrpc_exit_portals();
		/* Fall through */
	case 2:
		ptlrpc_request_cache_fini();
		/* Fall through */
	case 1:
		ptlrpc_hr_fini();
		req_layout_fini();
		/* Fall through */
	default:
		;
	}

	return rc;
}