/** * @brief Start NFS service * * @param[in] p_start_info Startup parameters */ void nfs_start(nfs_start_info_t *p_start_info) { struct rlimit ulimit_data; /* store the start info so it is available for all layers */ nfs_start_info = *p_start_info; if (p_start_info->dump_default_config == true) { nfs_print_param_config(); exit(0); } /* Set the Core dump size if set */ if (nfs_param.core_param.core_dump_size != -1) { LogInfo(COMPONENT_INIT, "core size rlimit set to %ld", nfs_param.core_param.core_dump_size); ulimit_data.rlim_cur = nfs_param.core_param.core_dump_size; ulimit_data.rlim_max = nfs_param.core_param.core_dump_size; if (setrlimit(RLIMIT_CORE, &ulimit_data) != 0) { LogCrit(COMPONENT_INIT, "setrlimit() returned error on RLIMIT_CORE, core dump size: %ld, error %s(%d)", nfs_param.core_param.core_dump_size, strerror(errno), errno); } } else { if (getrlimit(RLIMIT_CORE, &ulimit_data) != 0) { LogCrit(COMPONENT_INIT, "getrlimit() returned error on RLIMIT_CORE, error %s(%d)", strerror(errno), errno); } else { LogInfo(COMPONENT_INIT, "core size rlimit is %ld", ulimit_data.rlim_cur); } } /* Make sure Ganesha runs with a 0000 umask. */ umask(0000); { /* Set the write verifiers */ union { verifier4 NFS4_write_verifier; writeverf3 NFS3_write_verifier; uint64_t epoch; } build_verifier; build_verifier.epoch = (uint64_t) ServerEpoch; memcpy(NFS3_write_verifier, build_verifier.NFS3_write_verifier, sizeof(NFS3_write_verifier)); memcpy(NFS4_write_verifier, build_verifier.NFS4_write_verifier, sizeof(NFS4_write_verifier)); } #ifdef USE_CAPS lower_my_caps(); #endif /* Initialize all layers and service threads */ nfs_Init(p_start_info); /* Spawns service threads */ nfs_Start_threads(); if (nfs_param.core_param.enable_NLM) { /* NSM Unmonitor all */ nsm_unmonitor_all(); } if (nfs_param.ip_name_param.mapfile == NULL) { LogDebug(COMPONENT_INIT, "No Hosts Map file is used"); } else { LogEvent(COMPONENT_INIT, "Populating IP_NAME with file %s", nfs_param.ip_name_param.mapfile); if (nfs_ip_name_populate(nfs_param.ip_name_param.mapfile) != IP_NAME_SUCCESS) LogDebug(COMPONENT_INIT, "IP_NAME was NOT populated"); } LogEvent(COMPONENT_INIT, "-------------------------------------------------"); LogEvent(COMPONENT_INIT, " NFS SERVER INITIALIZED"); LogEvent(COMPONENT_INIT, "-------------------------------------------------"); /* Wait for dispatcher to exit */ LogDebug(COMPONENT_THREAD, "Wait for admin thread to exit"); pthread_join(admin_thrid, NULL); /* Regular exit */ LogEvent(COMPONENT_MAIN, "NFS EXIT: regular exit"); /* if not in grace period, clean up the old state directory */ if (!nfs_in_grace()) nfs4_clean_old_recov_dir(); Cleanup(); /* let main return 0 to exit */ }
/** * @brief Start NFS service * * @param[in] p_start_info Startup parameters */ void nfs_start(nfs_start_info_t *p_start_info) { /* store the start info so it is available for all layers */ nfs_start_info = *p_start_info; if (p_start_info->dump_default_config == true) { nfs_print_param_config(); exit(0); } /* Make sure Ganesha runs with a 0000 umask. */ umask(0000); { /* Set the write verifiers */ union { verifier4 NFS4_write_verifier; writeverf3 NFS3_write_verifier; uint64_t epoch; } build_verifier; build_verifier.epoch = (uint64_t) ServerEpoch; memcpy(NFS3_write_verifier, build_verifier.NFS3_write_verifier, sizeof(NFS3_write_verifier)); memcpy(NFS4_write_verifier, build_verifier.NFS4_write_verifier, sizeof(NFS4_write_verifier)); } #ifdef USE_CAPS lower_my_caps(); #endif /* Initialize all layers and service threads */ nfs_Init(p_start_info); /* Spawns service threads */ nfs_Start_threads(); if (nfs_param.core_param.enable_NLM) { /* NSM Unmonitor all */ nsm_unmonitor_all(); } LogEvent(COMPONENT_INIT, "-------------------------------------------------"); LogEvent(COMPONENT_INIT, " NFS SERVER INITIALIZED"); LogEvent(COMPONENT_INIT, "-------------------------------------------------"); /* Wait for dispatcher to exit */ LogDebug(COMPONENT_THREAD, "Wait for admin thread to exit"); pthread_join(admin_thrid, NULL); /* Regular exit */ LogEvent(COMPONENT_MAIN, "NFS EXIT: regular exit"); /* if not in grace period, clean up the old state directory */ if (!nfs_in_grace()) nfs4_clean_old_recov_dir(v4_old_dir); Cleanup(); /* let main return 0 to exit */ }