/* This will trigger a watchdog timeout */
OBD_FAIL_TIMEOUT(OBD_FAIL_MDS_STATFS_LCW_SLEEP,
(MDT_SERVICE_WATCHDOG_TIMEOUT / 1000) + 1);
-
+
if (MDT_FAIL_CHECK(OBD_FAIL_MDS_STATFS_PACK)) {
rc = -ENOMEM;
if (MDT_FAIL_CHECK(OBD_FAIL_MDS_GETATTR_PACK))
RETURN(-ENOMEM);
-
+
repbody = req_capsule_server_get(pill, &RMF_MDT_BODY);
repbody->eadatasize = 0;
repbody->aclsize = 0;
}
#ifdef HAVE_SPLIT_SUPPORT
-/*
+/*
* Retrieve dir entry from the page and insert it to the
- * slave object, actually, this should be in osd layer,
+ * slave object, actually, this should be in osd layer,
* but since it will not in the final product, so just do
- * it here and do not define more moo api anymore for
+ * it here and do not define more moo api anymore for
* this.
*/
static int mdt_write_dir_page(struct mdt_thread_info *info, struct page *page)
struct lu_fid *lf = &ent->lde_fid;
/* FIXME: check isdir */
- rc = mdo_name_insert(info->mti_ctxt,
+ rc = mdo_name_insert(info->mti_ctxt,
md_object_next(&object->mot_obj),
ent->lde_name, lf, 0);
/* FIXME: add cross_flags */
}
}
kunmap(page);
-
+
RETURN(rc);
}
page = alloc_pages(GFP_KERNEL, 0);
if (!page)
GOTO(desc_cleanup, rc = -ENOMEM);
-
+
ptlrpc_prep_bulk_page(desc, page, 0, CFS_PAGE_SIZE);
/* FIXME: following parts are copied from ost_brw_write */
RETURN(-EFAULT);
rc = mdt_reint_unpack(info, op);
- if (rc != 0)
+ if (rc != 0)
RETURN(rc);
-
+
/*pack reply*/
if (req_capsule_has_field(pill, &RMF_MDT_MD, RCL_SERVER))
req_capsule_set_size(pill, &RMF_MDT_MD, RCL_SERVER,
if (lustre_msg_get_flags(req->rq_reqmsg) & MSG_RESENT) {
struct mdt_client_data *mcd;
-
+
mcd = req->rq_export->exp_mdt_data.med_mcd;
if (mcd->mcd_last_xid == req->rq_xid) {
mdt_reconstruct(info);
RETURN(lustre_msg_get_status(req->rq_repmsg));
- }
+ }
DEBUG_REQ(D_HA, req, "no reply for RESENT (xid "LPD64")",
mcd->mcd_last_xid);
}
rc = mdt_reint_internal(info, opc);
} else
rc = opc;
-
+
info->mti_fail_id = OBD_FAIL_MDS_REINT_NET_REP;
RETURN(rc);
}
next = mdt_object_child(info->mti_object);
fid = mdt_object_fid(info->mti_object);
info->mti_attr.ma_need = MA_INODE;
- rc = mo_attr_get(info->mti_ctxt, next,
+ rc = mo_attr_get(info->mti_ctxt, next,
&info->mti_attr);
la = &info->mti_attr.ma_attr;
if (rc == 0) {
LASSERT(f != NULL);
rc = ldlm_cli_enqueue_local(ns, *fid_build_res_name(f, res_id),
- LDLM_IBITS, policy, mode, &flags,
- ldlm_blocking_ast, ldlm_completion_ast,
+ LDLM_IBITS, policy, mode, &flags,
+ ldlm_blocking_ast, ldlm_completion_ast,
NULL, NULL, 0, NULL, lh);
return rc == ELDLM_OK ? 0 : -EIO;
}
policy->l_inodebits.bits = ibits;
- rc = fid_lock(ns, mdt_object_fid(o), &lh->mlh_lh, lh->mlh_mode,
+ rc = fid_lock(ns, mdt_object_fid(o), &lh->mlh_lh, lh->mlh_mode,
policy, res_id);
RETURN(rc);
}
if (info->mti_trans_flags & MDT_NONEED_TRANSNO)
return;
-
+
/*XXX: assert on this when all code will be finished */
if (rc != 0 && info->mti_transno != 0) {
info->mti_transno = 0;
spin_lock(&mdt->mdt_transno_lock);
req->rq_transno = info->mti_transno;
lustre_msg_set_transno(req->rq_repmsg, info->mti_transno);
-
+
target_committed_to_req(req);
-
+
spin_unlock(&mdt->mdt_transno_lock);
lustre_msg_set_last_xid(req->rq_repmsg, req_exp_last_xid(req));
//lustre_msg_set_last_xid(req->rq_repmsg, req->rq_xid);
/* mds/handler.c */
extern int mds_msg_check_version(struct lustre_msg *msg);
-static int mdt_handle0(struct ptlrpc_request *req,
+static int mdt_handle0(struct ptlrpc_request *req,
struct mdt_thread_info *info,
struct mdt_opc_slice *supported)
{
rc = mdt_recovery(req);
switch (rc) {
case +1:
- h = mdt_handler_find(lustre_msg_get_opc(msg),
+ h = mdt_handler_find(lustre_msg_get_opc(msg),
supported);
if (h != NULL)
rc = mdt_req_handle(info, h, req);
rep->lock_policy_res2 = rc;
mdt_set_disposition(info, rep, DISP_IT_EXECD);
-#if 0
+#if 0
mdt_finish_reply(info, rc);
#endif
RETURN(ELDLM_LOCK_ABORTED);
GOTO(out, rc = -ENODEV);
}
+ rc = lu_context_refill(ctx);
+ if (rc != 0) {
+ CERROR("Failure to refill context: '%d'\n", rc);
+ GOTO(out_type, rc);
+ }
+
ldt = type->typ_lu;
if (ldt == NULL) {
CERROR("type: '%s'\n", typename);
mdt_seq_fini(ctx, m);
mdt_seq_fini_cli(m);
-
+
mdt_fld_fini(ctx, m);
/* finish the stack */
obd = class_name2obd(dev);
LASSERT(obd);
-
+
spin_lock_init(&m->mdt_transno_lock);
#if 0
/* FIXME: We need to load them from disk. But now fake it */
lu_site_fini(s);
err_free_site:
OBD_FREE_PTR(s);
-
+
md_device_fini(&m->mdt_md_dev);
return (rc);
}
switch (ev) {
case MD_LOV_SYNC:
rc = next->md_ops->mdo_get_maxsize(ctx, next,
- &m->mdt_max_mdsize,
+ &m->mdt_max_mdsize,
&m->mdt_max_cookiesize);
CDEBUG(D_INFO, "get max mdsize %d max cookiesize %d\n",
m->mdt_max_mdsize, m->mdt_max_cookiesize);
static int mdt_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
void *karg, void *uarg)
{
- struct lu_context ctxt;
+ struct lu_context ctxt;
struct mdt_device *mdt = mdt_dev(exp->exp_obd->obd_lu_dev);
struct dt_device *dt = mdt->mdt_bottom;
int rc = 0;
.o_iocontrol = mdt_iocontrol
};
-static struct lu_device* mdt_device_fini(const struct lu_context *ctx,
+static struct lu_device* mdt_device_fini(const struct lu_context *ctx,
struct lu_device *d)
{
struct mdt_device *m = mdt_dev(d);
}
}
-static int keys_init(struct lu_context *ctx)
+static int keys_fill(const struct lu_context *ctx)
{
int i;
+
+ for (i = 0; i < ARRAY_SIZE(lu_keys); ++i) {
+ struct lu_context_key *key;
+
+ key = lu_keys[i];
+ if (ctx->lc_value[i] == NULL &&
+ key != NULL && key->lct_tags & ctx->lc_tags) {
+ void *value;
+
+ LASSERT(key->lct_init != NULL);
+ LASSERT(key->lct_index == i);
+
+ value = key->lct_init(ctx, key);
+ if (IS_ERR(value))
+ return PTR_ERR(value);
+ key->lct_used++;
+ ctx->lc_value[i] = value;
+ }
+ }
+ return 0;
+}
+
+static int keys_init(struct lu_context *ctx)
+{
int result;
OBD_ALLOC(ctx->lc_value, ARRAY_SIZE(lu_keys) * sizeof ctx->lc_value[0]);
- if (ctx->lc_value != NULL) {
- for (i = 0; i < ARRAY_SIZE(lu_keys); ++i) {
- struct lu_context_key *key;
-
- key = lu_keys[i];
- if (key != NULL && key->lct_tags & ctx->lc_tags) {
- void *value;
-
- LASSERT(key->lct_init != NULL);
- LASSERT(key->lct_index == i);
-
- value = key->lct_init(ctx, key);
- if (IS_ERR(value)) {
- keys_fini(ctx);
- return PTR_ERR(value);
- }
- key->lct_used++;
- ctx->lc_value[i] = value;
- }
- }
- result = 0;
- } else
+ if (ctx->lc_value != NULL)
+ result = keys_fill(ctx);
+ else
result = -ENOMEM;
+
+ if (result != 0)
+ keys_fini(ctx);
return result;
}
EXPORT_SYMBOL(lu_context_exit);
/*
+ * Allocate for context all missing keys that were registered after context
+ * creation.
+ */
+int lu_context_refill(const struct lu_context *ctx)
+{
+ LASSERT(ctx->lc_value != NULL);
+ return keys_fill(ctx);
+}
+EXPORT_SYMBOL(lu_context_refill);
+
+/*
* Initialization of global lu_* data.
*/
int lu_global_init(void)