LU_XATTR_CREATE = (1 << 1)
};
+/* For lu_context health-checks */
+enum lu_context_state {
+ LCS_INITIALIZED = 1,
+ LCS_ENTERED,
+ LCS_LEFT,
+ LCS_FINALIZED
+};
+
/*
* lu_context. Execution context for lu_object methods. Currently associated
* with thread.
* detail.
*/
void **lc_value;
+ enum lc_state;
};
/*
req->rq_svc_thread = thread;
req->rq_svc_thread->t_env->le_ses = &req->rq_session;
+ /* thread context */
+ lu_context_enter(&thread->t_env->le_ctx);
(void)handler(req);
+ lu_context_exit(&thread->t_env->le_ctx);
lu_context_exit(&req->rq_session);
lu_context_fini(&req->rq_session);
DEBUG_REQ(D_HA, req, "processing t"LPD64" from %s",
lustre_msg_get_transno(req->rq_reqmsg),
libcfs_nid2str(req->rq_peer.nid));
-
handle_recovery_req(thread, req,
trd->trd_recovery_handler);
obd->obd_replayed_requests++;
target_finish_recovery(obd);
- lu_env_fini(&env);
+ lu_context_fini(&env.le_ctx);
trd->trd_processing_task = 0;
complete(&trd->trd_finishing);
RETURN(rc);
void *lu_context_key_get(const struct lu_context *ctx,
struct lu_context_key *key)
{
+ LASSERT(ctx->lc_state == LCS_ENTERED);
LASSERT(0 <= key->lct_index && key->lct_index < ARRAY_SIZE(lu_keys));
return ctx->lc_value[key->lct_index];
}
int lu_context_init(struct lu_context *ctx, __u32 tags)
{
memset(ctx, 0, sizeof *ctx);
+ ctx->lc_state = LCS_INITIALIZED;
ctx->lc_tags = tags;
return keys_init(ctx);
}
*/
void lu_context_fini(struct lu_context *ctx)
{
+ LASSERT(ctx->lc_state == LCS_INITIALIZED || ctx->lc_state == LCS_LEFT);
+ ctx->lc_state = LCS_FINALIZED;
keys_fini(ctx);
}
EXPORT_SYMBOL(lu_context_fini);
*/
void lu_context_enter(struct lu_context *ctx)
{
+ LASSERT(ctx->lc_state == LCS_INITIALIZED || ctx->lc_state == LCS_LEFT);
+ ctx->lc_state = LCS_ENTERED;
}
EXPORT_SYMBOL(lu_context_enter);
{
int i;
+ LASSERT(ctx->lc_state == LCS_ENTERED);
+ ctx->lc_state = LCS_LEFT;
if (ctx->lc_value != NULL) {
for (i = 0; i < ARRAY_SIZE(lu_keys); ++i) {
if (ctx->lc_value[i] != NULL) {
if (error) {
CERROR("transaction @0x%p commit error: %d\n", th, error);
} else {
+ struct lu_env *env = &osd_dt_dev(dev)->od_env_for_commit;
/*
* This od_env_for_commit is only for commit usage. see
* "struct dt_device"
*/
- dt_txn_hook_commit(&osd_dt_dev(dev)->od_env_for_commit, th);
+ lu_context_enter(&env->le_ctx);
+ dt_txn_hook_commit(env, th);
+ lu_context_exit(&env->le_ctx);
}
lu_device_put(&dev->dd_lu_dev);
static int osd_device_init(const struct lu_env *env, struct lu_device *d,
const char *name, struct lu_device *next)
{
- return lu_env_init(&osd_dev(d)->od_env_for_commit, NULL, LCT_MD_THREAD);
+ return lu_context_init(&osd_dev(d)->od_env_for_commit.le_ctx,
+ LCT_MD_THREAD);
}
static int osd_shutdown(const struct lu_env *env, struct osd_device *o)
osd_dev(d)->od_mount->lmi_mnt);
osd_dev(d)->od_mount = NULL;
- lu_env_fini(&osd_dev(d)->od_env_for_commit);
+ lu_context_fini(&osd_dev(d)->od_env_for_commit.le_ctx);
RETURN(NULL);
}
if (svc->srv_done != NULL)
svc->srv_done(thread);
- lu_env_fini(&env);
+ lu_context_fini(&env.le_ctx);
out:
CDEBUG(D_NET, "service thread %d exiting: rc %d\n", thread->t_id, rc);