Example #1
0
/* lock_comm()
 * Sets the MD_CLUSTER_SEND_LOCK bit to lock the send channel.
 */
static int lock_comm(struct md_cluster_info *cinfo)
{
	wait_event(cinfo->wait,
		   !test_and_set_bit(MD_CLUSTER_SEND_LOCK, &cinfo->state));

	return lock_token(cinfo);
}
Example #2
0
void
StateReporter::setPath(jstring jpath, jlong jrevision, jobject jdepth,
                       jboolean jstart_empty, jstring jlock_token)
{
  //DEBUG:fprintf(stderr, "  (n) StateReporter::setPath()\n");

  if (!m_valid) { throw_reporter_inactive(); return; }

  JNIStringHolder lock_token(jlock_token);
  if (JNIUtil::isJavaExceptionThrown())
    return;

  SVN::Pool subPool(pool);
  Relpath path(jpath, subPool);
  if (JNIUtil::isJavaExceptionThrown())
    return;
  svn_depth_t depth = EnumMapper::toDepth(jdepth);
  if (JNIUtil::isJavaExceptionThrown())
    return;

  SVN_JNI_ERR(m_raw_reporter->set_path(m_report_baton, path.c_str(),
                                       svn_revnum_t(jrevision), depth,
                                       bool(jstart_empty), lock_token.c_str(),
                                       subPool.getPool()),);
}
Example #3
0
/*
 * Check if the communication is already locked, else lock the communication
 * channel.
 * If it is already locked, token is in EX mode, and hence lock_token()
 * should not be called.
 */
static int metadata_update_start(struct mddev *mddev)
{
	struct md_cluster_info *cinfo = mddev->cluster_info;

	wait_event(cinfo->wait,
		   !test_and_set_bit(MD_CLUSTER_SEND_LOCK, &cinfo->state) ||
		   test_and_clear_bit(MD_CLUSTER_SEND_LOCKED_ALREADY, &cinfo->state));

	/* If token is already locked, return 0 */
	if (cinfo->token_lockres->mode == DLM_LOCK_EX)
		return 0;

	return lock_token(cinfo);
}