Example #1
0
/*===========================================================================*
 *				lock_bsf				     *
 *===========================================================================*/
void lock_bsf(void)
{
  struct worker_thread *org_self;

  if (mutex_trylock(&bsf_lock) == 0)
	return;

  org_self = worker_suspend();

  if (mutex_lock(&bsf_lock) != 0)
	panic("unable to lock block special file lock");

  worker_resume(org_self);
}
Example #2
0
/*===========================================================================*
 *				lock_proc				     *
 *===========================================================================*/
void lock_proc(struct fproc *rfp)
{
  int r;
  struct worker_thread *org_self;

  r = mutex_trylock(&rfp->fp_lock);
  if (r == 0) return;

  org_self = worker_suspend();

  if ((r = mutex_lock(&rfp->fp_lock)) != 0)
	panic("unable to lock fproc lock: %d", r);

  worker_resume(org_self);
}
Example #3
0
File: dmap.c Project: Hooman3/minix
/*===========================================================================*
 *				lock_dmap		 		     *
 *===========================================================================*/
void lock_dmap(struct dmap *dp)
{
/* Lock a driver */
	struct worker_thread *org_self;
	int r;

	assert(dp != NULL);
	assert(dp->dmap_driver != NONE);

	org_self = worker_suspend();

	if ((r = mutex_lock(&dp->dmap_lock)) != 0)
		panic("unable to get a lock on dmap: %d\n", r);

	worker_resume(org_self);
}
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");

}