void *admin_thread(void *UnusedArg) { SetNameFunction("admin_thr"); while(1) { P(mutex_admin_condvar); while(reload_exports == FALSE) pthread_cond_wait(&(admin_condvar), &(mutex_admin_condvar)); reload_exports = FALSE; V(mutex_admin_condvar); if (rebuild_export_list() <= 0) { LogCrit(COMPONENT_MAIN, "Could not reload the exports list."); continue; } if(pause_threads(PAUSE_RELOAD_EXPORTS) == PAUSE_EXIT) { LogDebug(COMPONENT_MAIN, "Export reload interrupted by shutdown while pausing threads"); /* Be helpfull and exit * (other termination will just blow us away, and that's ok... */ break; } /* Clear the id mapping cache for gss principals to uid/gid. * The id mapping may have changed. */ #ifdef _HAVE_GSSAPI #ifdef _USE_NFSIDMAP uidgidmap_clear(); idmap_clear(); namemap_clear(); #endif /* _USE_NFSIDMAP */ #endif /* _HAVE_GSSAPI */ if (ChangeoverExports()) { LogCrit(COMPONENT_MAIN, "ChangeoverExports failed."); continue; } LogEvent(COMPONENT_MAIN, "Exports reloaded and active"); /* wake_workers could return PAUSE_PAUSE, but we don't have to do * anything special in that case. */ if(wake_threads(AWAKEN_RELOAD_EXPORTS) == PAUSE_EXIT) { LogDebug(COMPONENT_MAIN, "Export reload interrupted by shutdown while waking threads"); /* Be helpfull and exit * (other termination will just blow us away, and that's ok... */ break; } } return NULL; } /* admin_thread */
static void redo_exports(void) { /** * @todo If we make this accessible by DBUS we should have a good * way of indicating error. */ int rc = 0; if (rebuild_export_list() <= 0) { return; } rc = state_async_pause(); if (rc != STATE_SUCCESS) { LogMajor(COMPONENT_THREAD, "Error pausing async state thread: %d", rc); return; } if (worker_pause() != 0) { LogMajor(COMPONENT_MAIN, "Unable to pause workers."); return; } /* Clear the id mapping cache for gss principals to uid/gid. The id * mapping may have changed. */ #ifdef _HAVE_GSSAPI #ifdef USE_NFSIDMAP idmapper_clear_cache(); #endif /* USE_NFSIDMAP */ #endif /* _HAVE_GSSAPI */ if (ChangeoverExports()) { LogCrit(COMPONENT_MAIN, "ChangeoverExports failed."); return; } if (worker_resume() != 0) { /* It's not as if there's anything you can do if this happens... */ LogFatal(COMPONENT_MAIN, "Unable to resume workers."); return; } rc = state_async_resume(); if (rc != STATE_SUCCESS) { LogFatal(COMPONENT_THREAD, "Error resumeing down upcall system: %d", rc); } LogEvent(COMPONENT_MAIN, "Exports reloaded and active"); }