Whamcloud - gitweb
git://git.whamcloud.com
/
fs
/
lustre-release.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
Branch HEAD
[fs/lustre-release.git]
/
lustre
/
mdt
/
mdt_handler.c
diff --git
a/lustre/mdt/mdt_handler.c
b/lustre/mdt/mdt_handler.c
index
6d6f6dc
..
54fd4ab
100644
(file)
--- a/
lustre/mdt/mdt_handler.c
+++ b/
lustre/mdt/mdt_handler.c
@@
-1396,7
+1396,6
@@
static int mdt_reint_internal(struct mdt_thread_info *info,
{
struct req_capsule *pill = &info->mti_pill;
struct mdt_device *mdt = info->mti_mdt;
- struct ptlrpc_request *req = mdt_info_req(info);
struct mdt_body *repbody;
int need_shrink = 0;
int rc;
@@
-1443,21
+1442,12
@@
static int mdt_reint_internal(struct mdt_thread_info *info,
if (rc != 0)
GOTO(out_ucred, rc = err_serious(rc));
- 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 (req_xid_is_last(req)) {
- need_shrink = 0;
- mdt_reconstruct(info, lhc);
- rc = lustre_msg_get_status(req->rq_repmsg);
- GOTO(out_ucred, rc);
- }
- DEBUG_REQ(D_HA, req, "no reply for RESENT (xid "LPD64")",
- mcd->mcd_last_xid);
- }
-
need_shrink = 0;
+ if (mdt_check_resent(info, mdt_reconstruct, lhc)) {
+ rc = lustre_msg_get_status(mdt_info_req(info)->rq_repmsg);
+ GOTO(out_ucred, rc);
+ }
+
rc = mdt_reint_rec(info, lhc);
EXIT;
out_ucred:
@@
-3882,7
+3872,8
@@
static int mdt_init0(const struct lu_env *env, struct mdt_device *m,
snprintf(info->mti_u.ns_name, sizeof info->mti_u.ns_name,
LUSTRE_MDT_NAME"-%p", m);
m->mdt_namespace = ldlm_namespace_new(info->mti_u.ns_name,
- LDLM_NAMESPACE_SERVER);
+ LDLM_NAMESPACE_SERVER,
+ LDLM_NAMESPACE_GREEDY);
if (m->mdt_namespace == NULL)
GOTO(err_fini_seq, rc = -ENOMEM);
@@
-4367,6
+4358,18
@@
out:
return rc;
}
+static void mdt_allow_cli(struct mdt_device *m, unsigned int flag)
+{
+ if (flag & CONFIG_LOG)
+ m->mdt_fl_cfglog = 1;
+ if (flag & CONFIG_SYNC)
+ m->mdt_fl_synced = 1;
+
+ if (m->mdt_fl_cfglog && m->mdt_fl_synced)
+ /* Open for clients */
+ m->mdt_md_dev.md_lu_dev.ld_obd->obd_no_conn = 0;
+}
+
static int mdt_upcall(const struct lu_env *env, struct md_device *md,
enum md_upcall_event ev)
{
@@
-4383,12
+4386,17
@@
static int mdt_upcall(const struct lu_env *env, struct md_device *md,
&m->mdt_max_cookiesize);
CDEBUG(D_INFO, "get max mdsize %d max cookiesize %d\n",
m->mdt_max_mdsize, m->mdt_max_cookiesize);
+ mdt_allow_cli(m, CONFIG_SYNC);
break;
case MD_NO_TRANS:
mti = lu_context_key_get(&env->le_ctx, &mdt_thread_key);
mti->mti_no_need_trans = 1;
CDEBUG(D_INFO, "disable mdt trans for this thread\n");
break;
+ case MD_LOV_CONFIG:
+ /* Check that MDT is not yet configured */
+ LASSERT(!m->mdt_fl_cfglog);
+ break;
default:
CERROR("invalid event\n");
rc = -EINVAL;
@@
-4399,15
+4407,16
@@
static int mdt_upcall(const struct lu_env *env, struct md_device *md,
static int mdt_obd_notify(struct obd_device *host,
struct obd_device *watched,
- enum obd_notify_event ev, void *
owner
)
+ enum obd_notify_event ev, void *
data
)
{
ENTRY;
switch (ev) {
case OBD_NOTIFY_CONFIG:
- host->obd_no_conn = 0;
+ mdt_allow_cli(mdt_dev(host->obd_lu_dev), (unsigned int)data);
+ break;
default:
- CDEBUG(D_INFO, "
Notification 0x%
x\n", ev);
+ CDEBUG(D_INFO, "
Unhandled notification %#
x\n", ev);
}
RETURN(0);
}
@@
-4534,56
+4543,11
@@
static struct lu_device *mdt_device_alloc(const struct lu_env *env,
/*
* context key constructor/destructor
*/
-static void *mdt_key_init(const struct lu_context *ctx,
- struct lu_context_key *key)
-{
- struct mdt_thread_info *info;
-
- /*
- * check that no high order allocations are incurred.
- */
- CLASSERT(CFS_PAGE_SIZE >= sizeof *info);
- OBD_ALLOC_PTR(info);
- if (info == NULL)
- info = ERR_PTR(-ENOMEM);
- return info;
-}
-
-static void mdt_key_fini(const struct lu_context *ctx,
- struct lu_context_key *key, void *data)
-{
- struct mdt_thread_info *info = data;
- OBD_FREE_PTR(info);
-}
-
-struct lu_context_key mdt_thread_key = {
- .lct_tags = LCT_MD_THREAD,
- .lct_init = mdt_key_init,
- .lct_fini = mdt_key_fini
-};
-
-static void *mdt_txn_key_init(const struct lu_context *ctx,
- struct lu_context_key *key)
-{
- struct mdt_txn_info *txi;
+LU_KEY_INIT_FINI(mdt, struct mdt_thread_info);
- /*
- * check that no high order allocations are incurred.
- */
- CLASSERT(CFS_PAGE_SIZE >= sizeof *txi);
- OBD_ALLOC_PTR(txi);
- if (txi == NULL)
- txi = ERR_PTR(-ENOMEM);
- memset(txi, 0, sizeof(*txi));
- return txi;
-}
+LU_CONTEXT_KEY_DEFINE(mdt, LCT_MD_THREAD);
-static void mdt_txn_key_fini(const struct lu_context *ctx,
- struct lu_context_key *key, void *data)
-{
- struct mdt_txn_info *txi = data;
- OBD_FREE_PTR(txi);
-}
+LU_KEY_INIT_FINI(mdt_txn, struct mdt_txn_info);
struct lu_context_key mdt_txn_key = {
.lct_tags = LCT_TX_HANDLE,
@@
-4596,24
+4560,7
@@
struct md_ucred *mdt_ucred(const struct mdt_thread_info *info)
return md_ucred(info->mti_env);
}
-static int mdt_type_init(struct lu_device_type *t)
-{
- int rc;
-
- LU_CONTEXT_KEY_INIT(&mdt_thread_key);
- rc = lu_context_key_register(&mdt_thread_key);
- if (rc == 0) {
- LU_CONTEXT_KEY_INIT(&mdt_txn_key);
- rc = lu_context_key_register(&mdt_txn_key);
- }
- return rc;
-}
-
-static void mdt_type_fini(struct lu_device_type *t)
-{
- lu_context_key_degister(&mdt_thread_key);
- lu_context_key_degister(&mdt_txn_key);
-}
+LU_TYPE_INIT_FINI(mdt, &mdt_thread_key, &mdt_txn_key);
static struct lu_device_type_operations mdt_device_type_ops = {
.ldto_init = mdt_type_init,