コード例 #1
0
ファイル: state_async.c プロジェクト: hongjil5/nfs-ganesha
/**
 * @brief Shut down asynchronous request system
 *
 * @return State status.
 */
state_status_t state_async_shutdown(void)
{
	int rc1, rc2;

	rc1 = fridgethr_sync_command(state_async_fridge,
				     fridgethr_comm_stop,
				     120);

	if (rc1 == ETIMEDOUT) {
		LogMajor(COMPONENT_STATE,
			 "Shutdown timed out, cancelling threads.");
		fridgethr_cancel(state_async_fridge);
	} else if (rc1 != 0) {
		LogMajor(COMPONENT_STATE,
			 "Failed shutting down state async thread: %d", rc1);
	}

	rc2 = fridgethr_sync_command(state_poll_fridge,
				     fridgethr_comm_stop,
				     120);

	if (rc2 == ETIMEDOUT) {
		LogMajor(COMPONENT_STATE,
			 "Shutdown timed out, cancelling threads.");
		fridgethr_cancel(state_poll_fridge);
	} else if (rc2 != 0) {
		LogMajor(COMPONENT_STATE,
			 "Failed shutting down state blocked lock polling thread: %d",
			 rc2);
	}

	return ((rc1 == 0) && (rc2 == 0)) ? STATE_SUCCESS : STATE_SIGNAL_ERROR;
}
コード例 #2
0
static void do_shutdown(void)
{
  int rc = 0;

  LogEvent(COMPONENT_MAIN, "NFS EXIT: stopping NFS service");

  LogEvent(COMPONENT_MAIN,
	   "Stopping delayed executor.");
  delayed_shutdown();
  LogEvent(COMPONENT_MAIN,
	   "Delayed executor stopped.");

  LogEvent(COMPONENT_MAIN,
	   "Stopping state asynchronous request thread");
  rc = state_async_shutdown();
  if (rc != 0)
    {
      LogMajor(COMPONENT_THREAD,
	       "Error shutting down state asynchronous request system: %d",
	       rc);
    }
  else
    {
      LogEvent(COMPONENT_THREAD,
	       "State asynchronous request system shut down.");
    }

  LogEvent(COMPONENT_MAIN, "Stopping request listener threads.");
  nfs_rpc_dispatch_stop();

  LogEvent(COMPONENT_MAIN, "Stopping request decoder threads");
  rc = fridgethr_sync_command(req_fridge,
			      fridgethr_comm_stop,
			      120);

  if (rc == ETIMEDOUT)
    {
      LogMajor(COMPONENT_THREAD,
	       "Shutdown timed out, cancelling threads!");
      fridgethr_cancel(req_fridge);
    }
  else if (rc != 0)
    {
      LogMajor(COMPONENT_THREAD,
	       "Failed to shut down the request thread fridge: %d!",
	       rc);
    }
  else
    {
      LogEvent(COMPONENT_THREAD,
	       "Request threads shut down.");
    }

  LogEvent(COMPONENT_MAIN, "Stopping worker threads");

  rc = worker_shutdown();

  if(rc != 0)
    LogMajor(COMPONENT_THREAD,
	     "Unable to shut down worker threads: %d",
	     rc);
  else
    LogEvent(COMPONENT_THREAD,
	     "Worker threads successfully shut down.");

  rc = general_fridge_shutdown();
  if (rc != 0)
    {
      LogMajor(COMPONENT_THREAD,
	       "Error shutting down general fridge: %d",
	       rc);
    }
  else
    {
      LogEvent(COMPONENT_THREAD,
	       "General fridge shut down.");
    }

  rc = reaper_shutdown();
  if (rc != 0)
    {
      LogMajor(COMPONENT_THREAD,
	       "Error shutting down reaper thread: %d",
	       rc);
    }
  else
    {
      LogEvent(COMPONENT_THREAD,
	       "Reaper thread shut down.");
    }

  LogEvent(COMPONENT_MAIN,
	   "Stopping LRU thread.");
  rc = cache_inode_lru_pkgshutdown();
  if (rc != 0)
    {
      LogMajor(COMPONENT_THREAD,
	       "Error shutting down LRU thread: %d",
	       rc);
    }
  else
    {
      LogEvent(COMPONENT_THREAD,
	       "LRU thread system shut down.");
    }

  LogEvent(COMPONENT_MAIN,
	   "Destroying the inode cache.");
  cache_inode_destroyer();
  LogEvent(COMPONENT_MAIN,
	   "Inode cache destroyed.");

  LogEvent(COMPONENT_MAIN,
	   "Destroying the FSAL system.");
  destroy_fsals();
  LogEvent(COMPONENT_MAIN,
	   "FSAL system destroyed.");

  unlink(pidfile_path);
}