From 6b61a552e8e82403a959f8fd6ceda07401605c83 Mon Sep 17 00:00:00 2001 From: tappro Date: Wed, 18 Oct 2006 22:23:40 +0000 Subject: [PATCH] - check that lookup is happened on correct mds in case of split, return -ERESTART otherwise --- lustre/cmm/cmm_object.c | 5 +++++ lustre/cmm/cmm_split.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/lustre/cmm/cmm_object.c b/lustre/cmm/cmm_object.c index 5d90f89..f029449 100644 --- a/lustre/cmm/cmm_object.c +++ b/lustre/cmm/cmm_object.c @@ -361,6 +361,11 @@ static int cml_lookup(const struct lu_env *env, struct md_object *mo_p, { int rc; ENTRY; +#ifdef HAVE_SPLIT_SUPPORT + rc = cmm_mdsnum_check(env, mo_p, name); + if (rc) + RETURN(rc); +#endif rc = mdo_lookup(env, md_object_next(mo_p), name, lf); RETURN(rc); diff --git a/lustre/cmm/cmm_split.c b/lustre/cmm/cmm_split.c index 8218521..1774484 100644 --- a/lustre/cmm/cmm_split.c +++ b/lustre/cmm/cmm_split.c @@ -48,6 +48,34 @@ enum { SPLIT_SIZE = 64*1024 }; +int cmm_mdsnum_check(const struct lu_env *env, struct md_object *mp, + const char *name) +{ + struct md_attr *ma = &cmm_env_info(env)->cmi_ma; + struct lmv_stripe_md *lmv; + int rc = 0; + ENTRY; + memset(ma, 0, sizeof(*ma)); + ma->ma_need = MA_INODE | MA_LMV; + rc = mo_attr_get(env, mp, ma); + if (rc) + RETURN(rc); + + if (ma->ma_valid & MA_LMV) { + int stripe; + lmv = ma->ma_lmv = lmv; + /* + * Get stripe by name to check the name belongs to master + * otherwise return the -ERESTART + * Master stripe is always 0 + */ + stripe = mea_name2idx(lmv, name, strlen(name)); + if (stripe != 0) + rc = -ERESTART; + } + RETURN(rc); +} + static int cmm_expect_splitting(const struct lu_env *env, struct md_object *mo, struct md_attr *ma) -- 1.8.3.1