Exemplo n.º 1
0
int out_tx_end(const struct lu_env *env, struct thandle_exec_args *ta)
{
	struct tgt_session_info *tsi = tgt_ses_info(env);
	int i = 0, rc;

	LASSERT(ta->ta_dev);
	LASSERT(ta->ta_handle);

	if (ta->ta_err != 0 || ta->ta_argno == 0)
		GOTO(stop, rc = ta->ta_err);

	rc = out_trans_start(env, ta);
	if (unlikely(rc))
		GOTO(stop, rc);

	for (i = 0; i < ta->ta_argno; i++) {
		rc = ta->ta_args[i].exec_fn(env, ta->ta_handle,
					    &ta->ta_args[i]);
		if (unlikely(rc != 0)) {
			CDEBUG(D_INFO, "error during execution of #%u from"
			       " %s:%d: rc = %d\n", i, ta->ta_args[i].file,
			       ta->ta_args[i].line, rc);
			while (--i >= 0) {
				if (ta->ta_args[i].undo_fn != NULL)
					ta->ta_args[i].undo_fn(env,
							       ta->ta_handle,
							      &ta->ta_args[i]);
				else
					CERROR("%s: undo for %s:%d: rc = %d\n",
					       dt_obd_name(ta->ta_dev),
					       ta->ta_args[i].file,
					       ta->ta_args[i].line, -ENOTSUPP);
			}
			break;
		}
	}

	/* Only fail for real update */
	tsi->tsi_reply_fail_id = OBD_FAIL_OUT_UPDATE_NET_REP;
stop:
	CDEBUG(D_INFO, "%s: executed %u/%u: rc = %d\n",
	       dt_obd_name(ta->ta_dev), i, ta->ta_argno, rc);
	out_trans_stop(env, ta, rc);
	ta->ta_handle = NULL;
	ta->ta_argno = 0;
	ta->ta_err = 0;

	RETURN(rc);
}
Exemplo n.º 2
0
int out_tx_end(struct mdt_thread_info *info, struct thandle_exec_args *th)
{
	struct thandle_exec_args *_th = &info->mti_handle;
	int i = 0, rc;

	LASSERT(th == _th);
	LASSERT(th->ta_dev);
	LASSERT(th->ta_handle);

	if (th->ta_err != 0 || th->ta_argno == 0)
		GOTO(stop, rc = th->ta_err);

	rc = out_trans_start(info->mti_env, th->ta_dev, th->ta_handle);
	if (unlikely(rc))
		GOTO(stop, rc);

	for (i = 0; i < th->ta_argno; i++) {
		rc = th->ta_args[i].exec_fn(info, th->ta_handle,
					    &th->ta_args[i]);
		if (unlikely(rc)) {
			CDEBUG(D_INFO, "error during execution of #%u from"
			       " %s:%d: rc = %d\n", i, th->ta_args[i].file,
			       th->ta_args[i].line, rc);
			while (--i >= 0) {
				LASSERTF(th->ta_args[i].undo_fn != NULL,
				    "can't undo changes, hope for failover!\n");
				th->ta_args[i].undo_fn(info, th->ta_handle,
						       &th->ta_args[i]);
			}
			break;
		}
	}
stop:
	CDEBUG(D_INFO, "%s: executed %u/%u: rc = %d\n",
	       mdt_obd_name(info->mti_mdt), i, th->ta_argno, rc);
	out_trans_stop(info->mti_env, th, rc);
	th->ta_handle = NULL;
	th->ta_argno = 0;
	th->ta_err = 0;

	RETURN(rc);
}
Exemplo n.º 3
0
static int out_tx_end(const struct lu_env *env, struct thandle_exec_args *ta,
		      int declare_ret)
{
	struct tgt_session_info	*tsi = tgt_ses_info(env);
	int			i;
	int			rc;
	int			rc1;
	ENTRY;

	if (ta->ta_handle == NULL)
		RETURN(0);

	if (declare_ret != 0 || ta->ta_argno == 0)
		GOTO(stop, rc = declare_ret);

	LASSERT(ta->ta_handle->th_dev != NULL);
	rc = out_trans_start(env, ta);
	if (unlikely(rc != 0))
		GOTO(stop, rc);

	for (i = 0; i < ta->ta_argno; i++) {
		rc = ta->ta_args[i]->exec_fn(env, ta->ta_handle,
					     ta->ta_args[i]);
		if (unlikely(rc != 0)) {
			CDEBUG(D_INFO, "error during execution of #%u from"
			       " %s:%d: rc = %d\n", i, ta->ta_args[i]->file,
			       ta->ta_args[i]->line, rc);
			while (--i >= 0) {
				if (ta->ta_args[i]->undo_fn != NULL)
					ta->ta_args[i]->undo_fn(env,
							       ta->ta_handle,
							       ta->ta_args[i]);
				else
					CERROR("%s: undo for %s:%d: rc = %d\n",
					     dt_obd_name(ta->ta_handle->th_dev),
					       ta->ta_args[i]->file,
					       ta->ta_args[i]->line, -ENOTSUPP);
			}
			break;
		}
		CDEBUG(D_INFO, "%s: executed %u/%u: rc = %d\n",
		       dt_obd_name(ta->ta_handle->th_dev), i, ta->ta_argno, rc);
	}

	/* Only fail for real updates, XXX right now llog updates will be
	* ignore, whose updates count is usually 1, so failover test
	* case will spot this FAIL_UPDATE_NET_REP precisely, and it will
	* be removed after async update patch is landed. */
	if (ta->ta_argno > 1)
		tsi->tsi_reply_fail_id = OBD_FAIL_OUT_UPDATE_NET_REP;

stop:
	rc1 = out_trans_stop(env, ta, rc);
	if (rc == 0)
		rc = rc1;

	ta->ta_handle = NULL;
	ta->ta_argno = 0;

	RETURN(rc);
}