From: fanyong Date: Thu, 23 Nov 2006 06:39:59 +0000 (+0000) Subject: More sanity check for filename length. X-Git-Tag: v1_8_0_110~486^2~88 X-Git-Url: https://git.whamcloud.com/gitweb?a=commitdiff_plain;h=153f16748ec621e190145b60aa0b9e4545891b02;p=fs%2Flustre-release.git More sanity check for filename length. --- diff --git a/lustre/cmm/cmm_object.c b/lustre/cmm/cmm_object.c index ac0d330..2e32186 100644 --- a/lustre/cmm/cmm_object.c +++ b/lustre/cmm/cmm_object.c @@ -347,9 +347,10 @@ static struct md_object_operations cml_mo_ops = { /* md_dir operations */ static int cml_lookup(const struct lu_env *env, struct md_object *mo_p, - const char *name, struct lu_fid *lf, + const struct lu_name *lname, struct lu_fid *lf, struct md_op_spec *spec) { + char *name = lname->ln_name; struct cmm_device *cmm = cmm_obj2dev(md2cmm_obj(mo_p)); struct timeval start; int rc; @@ -366,7 +367,7 @@ static int cml_lookup(const struct lu_env *env, struct md_object *mo_p, } } #endif - rc = mdo_lookup(env, md_object_next(mo_p), name, lf, spec); + rc = mdo_lookup(env, md_object_next(mo_p), lname, lf, spec); cmm_lprocfs_time_end(cmm, &start, LPROC_CMM_LOOKUP); RETURN(rc); @@ -386,9 +387,10 @@ static mdl_mode_t cml_lock_mode(const struct lu_env *env, } static int cml_create(const struct lu_env *env, struct md_object *mo_p, - const char *name, struct md_object *mo_c, + const struct lu_name *lname, struct md_object *mo_c, struct md_op_spec *spec, struct md_attr *ma) { + char *name = lname->ln_name; struct cmm_device *cmm = cmm_obj2dev(md2cmm_obj(mo_p)); struct timeval start; int rc; @@ -444,7 +446,7 @@ static int cml_create(const struct lu_env *env, struct md_object *mo_p, } #endif - rc = mdo_create(env, md_object_next(mo_p), name, md_object_next(mo_c), + rc = mdo_create(env, md_object_next(mo_p), lname, md_object_next(mo_c), spec, ma); EXIT; @@ -466,13 +468,13 @@ static int cml_create_data(const struct lu_env *env, struct md_object *p, } static int cml_link(const struct lu_env *env, struct md_object *mo_p, - struct md_object *mo_s, const char *name, + struct md_object *mo_s, const struct lu_name *lname, struct md_attr *ma) { int rc; ENTRY; rc = mdo_link(env, md_object_next(mo_p), md_object_next(mo_s), - name, ma); + lname, ma); RETURN(rc); } @@ -813,7 +815,7 @@ static struct md_object_operations cmr_mo_ops = { /* remote part of md_dir operations */ static int cmr_lookup(const struct lu_env *env, struct md_object *mo_p, - const char *name, struct lu_fid *lf, + const struct lu_name *lname, struct lu_fid *lf, struct md_op_spec *spec) { /* @@ -840,17 +842,18 @@ static mdl_mode_t cmr_lock_mode(const struct lu_env *env, * For more details see rollback HLD/DLD. */ static int cmr_create(const struct lu_env *env, struct md_object *mo_p, - const char *child_name, struct md_object *mo_c, + const struct lu_name *lchild_name, struct md_object *mo_c, struct md_op_spec *spec, struct md_attr *ma) { + char *child_name = lchild_name->ln_name; struct cmm_thread_info *cmi; struct md_attr *tmp_ma; int rc; ENTRY; /* Make sure that name isn't exist before doing remote call. */ - rc = mdo_lookup(env, md_object_next(mo_p), child_name, + rc = mdo_lookup(env, md_object_next(mo_p), lchild_name, &cmm_env_info(env)->cmi_fid, NULL); if (rc == 0) RETURN(-EEXIST); @@ -910,14 +913,15 @@ static int cmr_create(const struct lu_env *env, struct md_object *mo_p, } static int cmr_link(const struct lu_env *env, struct md_object *mo_p, - struct md_object *mo_s, const char *name, + struct md_object *mo_s, const struct lu_name *lname, struct md_attr *ma) { + char *name = lname->ln_name; int rc; ENTRY; /* Make sure that name isn't exist before doing remote call. */ - rc = mdo_lookup(env, md_object_next(mo_p), name, + rc = mdo_lookup(env, md_object_next(mo_p), lname, &cmm_env_info(env)->cmi_fid, NULL); if (rc == 0) { rc = -EEXIST; diff --git a/lustre/include/lu_object.h b/lustre/include/lu_object.h index 0ab5f51..e09fbb0 100644 --- a/lustre/include/lu_object.h +++ b/lustre/include/lu_object.h @@ -1014,6 +1014,14 @@ int lu_env_init(struct lu_env *env, struct lu_context *ses, __u32 tags); void lu_env_fini(struct lu_env *env); /* + * Common name structure to be passed around for various name related methods. + */ +struct lu_name { + char *ln_name; + int ln_namelen; +}; + +/* * Common buffer structure to be passed around for various xattr_{s,g}et() * methods. */ diff --git a/lustre/include/md_object.h b/lustre/include/md_object.h index 875b33e..ae50ce6 100644 --- a/lustre/include/md_object.h +++ b/lustre/include/md_object.h @@ -225,14 +225,14 @@ struct md_dir_operations { const struct lu_fid *fid, struct lu_fid *sfid); int (*mdo_lookup)(const struct lu_env *env, struct md_object *obj, - const char *name, struct lu_fid *fid, + const struct lu_name *lname, struct lu_fid *fid, struct md_op_spec *spec); mdl_mode_t (*mdo_lock_mode)(const struct lu_env *env, struct md_object *obj, mdl_mode_t mode); int (*mdo_create)(const struct lu_env *env, struct md_object *pobj, - const char *name, struct md_object *child, + const struct lu_name *lname, struct md_object *child, struct md_op_spec *spec, struct md_attr *ma); @@ -248,7 +248,7 @@ struct md_dir_operations { const char *tname, struct md_attr *ma); int (*mdo_link)(const struct lu_env *env, struct md_object *tgt_obj, - struct md_object *src_obj, const char *name, + struct md_object *src_obj, const struct lu_name *lname, struct md_attr *ma); int (*mdo_unlink)(const struct lu_env *env, struct md_object *pobj, @@ -482,12 +482,12 @@ static inline int mo_capa_get(const struct lu_env *env, static inline int mdo_lookup(const struct lu_env *env, struct md_object *p, - const char *name, + const struct lu_name *lname, struct lu_fid *f, struct md_op_spec *spec) { LASSERT(p->mo_dir_ops->mdo_lookup); - return p->mo_dir_ops->mdo_lookup(env, p, name, f, spec); + return p->mo_dir_ops->mdo_lookup(env, p, lname, f, spec); } static inline mdl_mode_t mdo_lock_mode(const struct lu_env *env, @@ -501,13 +501,13 @@ static inline mdl_mode_t mdo_lock_mode(const struct lu_env *env, static inline int mdo_create(const struct lu_env *env, struct md_object *p, - const char *child_name, + const struct lu_name *lchild_name, struct md_object *c, struct md_op_spec *spc, struct md_attr *at) { LASSERT(c->mo_dir_ops->mdo_create); - return c->mo_dir_ops->mdo_create(env, p, child_name, c, spc, at); + return c->mo_dir_ops->mdo_create(env, p, lchild_name, c, spc, at); } static inline int mdo_create_data(const struct lu_env *env, @@ -545,11 +545,11 @@ static inline int mdo_is_subdir(const struct lu_env *env, static inline int mdo_link(const struct lu_env *env, struct md_object *p, struct md_object *s, - const char *name, + const struct lu_name *lname, struct md_attr *ma) { LASSERT(s->mo_dir_ops->mdo_link); - return s->mo_dir_ops->mdo_link(env, p, s, name, ma); + return s->mo_dir_ops->mdo_link(env, p, s, lname, ma); } static inline int mdo_unlink(const struct lu_env *env, diff --git a/lustre/mdd/mdd_dir.c b/lustre/mdd/mdd_dir.c index 1a586d3..ef3d5f9 100644 --- a/lustre/mdd/mdd_dir.c +++ b/lustre/mdd/mdd_dir.c @@ -48,12 +48,19 @@ static const char dot[] = "."; static const char dotdot[] = ".."; +static struct lu_name lname_dotdot = { + (char *) dotdot, + sizeof(dotdot) - 1 +}; + static int __mdd_lookup(const struct lu_env *env, struct md_object *pobj, - const char *name, struct lu_fid* fid, int mask); + const struct lu_name *lname, struct lu_fid* fid, + int mask); static int __mdd_lookup_locked(const struct lu_env *env, struct md_object *pobj, - const char *name, struct lu_fid* fid, int mask) + const struct lu_name *lname, struct lu_fid* fid, int mask) { + char *name = lname->ln_name; struct mdd_object *mdd_obj = md2mdd_obj(pobj); struct dynlock_handle *dlh; int rc; @@ -61,19 +68,19 @@ __mdd_lookup_locked(const struct lu_env *env, struct md_object *pobj, dlh = mdd_pdo_read_lock(env, mdd_obj, name); if (dlh == NULL) return -ENOMEM; - rc = __mdd_lookup(env, pobj, name, fid, mask); + rc = __mdd_lookup(env, pobj, lname, fid, mask); mdd_pdo_read_unlock(env, mdd_obj, dlh); return rc; } static int mdd_lookup(const struct lu_env *env, - struct md_object *pobj, const char *name, + struct md_object *pobj, const struct lu_name *lname, struct lu_fid* fid, struct md_op_spec *spec) { int rc; ENTRY; - rc = __mdd_lookup_locked(env, pobj, name, fid, MAY_EXEC); + rc = __mdd_lookup_locked(env, pobj, lname, fid, MAY_EXEC); RETURN(rc); } @@ -81,7 +88,7 @@ static int mdd_lookup(const struct lu_env *env, static int mdd_parent_fid(const struct lu_env *env, struct mdd_object *obj, struct lu_fid *fid) { - return __mdd_lookup_locked(env, &obj->mod_obj, dotdot, fid, 0); + return __mdd_lookup_locked(env, &obj->mod_obj, &lname_dotdot, fid, 0); } /* @@ -271,7 +278,9 @@ static int mdd_may_delete(const struct lu_env *env, RETURN(rc); } -int mdd_link_sanity_check(const struct lu_env *env, struct mdd_object *tgt_obj, +int mdd_link_sanity_check(const struct lu_env *env, + struct mdd_object *tgt_obj, + const struct lu_name *lname, struct mdd_object *src_obj) { struct lu_attr *la = &mdd_env_info(env)->mti_la; @@ -279,6 +288,10 @@ int mdd_link_sanity_check(const struct lu_env *env, struct mdd_object *tgt_obj, int rc = 0; ENTRY; + /* Local ops, no lookup before link, check filename length here. */ + if (lname && (lname->ln_namelen > m->mdd_dt_conf.ddp_max_name_len)) + RETURN(-ENAMETOOLONG); + if (mdd_is_immutable(src_obj) || mdd_is_append(src_obj)) RETURN(-EPERM); @@ -395,9 +408,10 @@ __mdd_index_insert_only(const struct lu_env *env, struct mdd_object *pobj, } static int mdd_link(const struct lu_env *env, struct md_object *tgt_obj, - struct md_object *src_obj, const char *name, + struct md_object *src_obj, const struct lu_name *lname, struct md_attr *ma) { + char *name = lname->ln_name; struct lu_attr *la = &mdd_env_info(env)->mti_la_for_fix; struct mdd_object *mdd_tobj = md2mdd_obj(tgt_obj); struct mdd_object *mdd_sobj = md2mdd_obj(src_obj); @@ -417,7 +431,7 @@ static int mdd_link(const struct lu_env *env, struct md_object *tgt_obj, GOTO(out_trans, rc = -ENOMEM); mdd_write_lock(env, mdd_sobj); - rc = mdd_link_sanity_check(env, mdd_tobj, mdd_sobj); + rc = mdd_link_sanity_check(env, mdd_tobj, lname, mdd_sobj); if (rc) GOTO(out_unlock, rc); @@ -952,10 +966,12 @@ out_free: static int __mdd_lookup(const struct lu_env *env, struct md_object *pobj, - const char *name, struct lu_fid* fid, int mask) + const struct lu_name *lname, struct lu_fid* fid, int mask) { + char *name = lname->ln_name; const struct dt_key *key = (const struct dt_key *)name; struct mdd_object *mdd_obj = md2mdd_obj(pobj); + struct mdd_device *m = mdo2mdd(pobj); struct dt_object *dir = mdd_object_child(mdd_obj); struct dt_rec *rec = (struct dt_rec *)fid; struct timeval start; @@ -975,6 +991,10 @@ __mdd_lookup(const struct lu_env *env, struct md_object *pobj, LBUG(); } + /* The common filename length check. */ + if (lname->ln_namelen > m->mdd_dt_conf.ddp_max_name_len) + RETURN(-ENAMETOOLONG); + rc = mdd_permission_internal_locked(env, mdd_obj, NULL, mask); if (rc) RETURN(rc); @@ -1037,7 +1057,7 @@ int mdd_object_initialize(const struct lu_env *env, const struct lu_fid *pfid, static int mdd_create_sanity_check(const struct lu_env *env, struct md_object *pobj, - const char *name, + const struct lu_name *lname, struct md_attr *ma, struct md_op_spec *spec) { @@ -1058,6 +1078,12 @@ static int mdd_create_sanity_check(const struct lu_env *env, * In some cases this lookup is not needed - we know before if name * exists or not because MDT performs lookup for it. */ + /* XXX we perform filename length check in lookup. */ +#if 1 + /* XXX check filename length here temporary when lookup disabled. */ + if (lname->ln_namelen > m->mdd_dt_conf.ddp_max_name_len) + RETURN(-ENAMETOOLONG); +#endif /* XXX disable that lookup temporary */ if (0 && lookup) { /* @@ -1065,13 +1091,13 @@ static int mdd_create_sanity_check(const struct lu_env *env, * _index_insert also, for avoiding rolling back if exists * _index_insert. */ - rc = __mdd_lookup_locked(env, pobj, name, fid, + rc = __mdd_lookup_locked(env, pobj, lname, fid, MAY_WRITE | MAY_EXEC); if (rc != -ENOENT) RETURN(rc ? : -EEXIST); } else { /* - * Check if has WRITE permission for the parent. + * Check WRITE permission for the parent. */ rc = mdd_permission_internal_locked(env, obj, NULL, MAY_WRITE); if (rc) @@ -1124,11 +1150,13 @@ static int mdd_create_sanity_check(const struct lu_env *env, * Create object and insert it into namespace. */ static int mdd_create(const struct lu_env *env, - struct md_object *pobj, const char *name, + struct md_object *pobj, + const struct lu_name *lname, struct md_object *child, struct md_op_spec *spec, struct md_attr* ma) { + char *name = lname->ln_name; struct lu_attr *la = &mdd_env_info(env)->mti_la_for_fix; struct mdd_object *mdd_pobj = md2mdd_obj(pobj); struct mdd_object *son = md2mdd_obj(child); @@ -1180,7 +1208,7 @@ static int mdd_create(const struct lu_env *env, */ /* Sanity checks before big job. */ - rc = mdd_create_sanity_check(env, pobj, name, ma, spec); + rc = mdd_create_sanity_check(env, pobj, lname, ma, spec); if (rc) RETURN(rc); diff --git a/lustre/mdd/mdd_internal.h b/lustre/mdd/mdd_internal.h index 6fa75fa..c26b53c 100644 --- a/lustre/mdd/mdd_internal.h +++ b/lustre/mdd/mdd_internal.h @@ -183,7 +183,7 @@ int mdd_object_initialize(const struct lu_env *env, const struct lu_fid *pfid, struct mdd_object *child, struct md_attr *ma, struct thandle *handle); int mdd_link_sanity_check(const struct lu_env *env, struct mdd_object *tgt_obj, - struct mdd_object *src_obj); + const struct lu_name *lname, struct mdd_object *src_obj); void mdd_ref_add_internal(const struct lu_env *env, struct mdd_object *obj, struct thandle *handle); void mdd_ref_del_internal(const struct lu_env *env, struct mdd_object *obj, diff --git a/lustre/mdd/mdd_object.c b/lustre/mdd/mdd_object.c index cdede2c..831ce06 100644 --- a/lustre/mdd/mdd_object.c +++ b/lustre/mdd/mdd_object.c @@ -1082,7 +1082,7 @@ static int mdd_ref_add(const struct lu_env *env, RETURN(-ENOMEM); mdd_write_lock(env, mdd_obj); - rc = mdd_link_sanity_check(env, NULL, mdd_obj); + rc = mdd_link_sanity_check(env, NULL, NULL, mdd_obj); if (rc == 0) mdd_ref_add_internal(env, mdd_obj, handle); mdd_write_unlock(env, mdd_obj); diff --git a/lustre/mdt/mdt_handler.c b/lustre/mdt/mdt_handler.c index 737877a..87c9456 100644 --- a/lustre/mdt/mdt_handler.c +++ b/lustre/mdt/mdt_handler.c @@ -697,7 +697,7 @@ static int mdt_is_subdir(struct mdt_thread_info *info) static int mdt_raw_lookup(struct mdt_thread_info *info, struct mdt_object *parent, - const char* name, + const struct lu_name *lname, struct ldlm_reply *ldlm_rep) { struct md_object *next = mdt_object_child(info->mti_object); @@ -713,7 +713,7 @@ static int mdt_raw_lookup(struct mdt_thread_info *info, LASSERT(!info->mti_cross_ref); /* Only got the fid of this obj by name */ - rc = mdo_lookup(info->mti_env, next, name, child_fid, + rc = mdo_lookup(info->mti_env, next, lname, child_fid, &info->mti_spec); #if 0 /* XXX is raw_lookup possible as intent operation? */ @@ -753,6 +753,7 @@ static int mdt_getattr_name_lock(struct mdt_thread_info *info, struct lu_fid *child_fid = &info->mti_tmp_fid1; int is_resent, rc, namelen = 0; const char *name; + struct lu_name *lname; struct mdt_lock_handle *lhp; struct ldlm_lock *lock; struct ldlm_res_id *res_id; @@ -770,6 +771,8 @@ static int mdt_getattr_name_lock(struct mdt_thread_info *info, namelen = req_capsule_get_size(&info->mti_pill, &RMF_NAME, RCL_CLIENT); + lname = mdt_name(info->mti_env, (char *)name, namelen); + CDEBUG(D_INODE, "getattr with lock for "DFID"/%s, ldlm_rep = %p\n", PFID(mdt_object_fid(parent)), name, ldlm_rep); @@ -787,7 +790,7 @@ static int mdt_getattr_name_lock(struct mdt_thread_info *info, LBUG(); } - rc = mdt_raw_lookup(info, parent, name, ldlm_rep); + rc = mdt_raw_lookup(info, parent, lname, ldlm_rep); if (rc != 0) { if (rc > 0) rc = 0; @@ -847,7 +850,7 @@ static int mdt_getattr_name_lock(struct mdt_thread_info *info, RETURN(rc); /* step 2: lookup child's fid by name */ - rc = mdo_lookup(info->mti_env, next, name, child_fid, + rc = mdo_lookup(info->mti_env, next, lname, child_fid, &info->mti_spec); if (rc != 0) { if (rc == -ENOENT) diff --git a/lustre/mdt/mdt_internal.h b/lustre/mdt/mdt_internal.h index 583ebf3..733b7df 100644 --- a/lustre/mdt/mdt_internal.h +++ b/lustre/mdt/mdt_internal.h @@ -393,6 +393,9 @@ struct mdt_thread_info { /* Time for stats */ struct timeval mti_time; + + /* Ops object filename */ + struct lu_name mti_name; }; /* * Info allocated per-transaction. @@ -708,6 +711,19 @@ static inline ldlm_mode_t mdt_mdl_mode2dlm_mode(mdl_mode_t mode) return mdt_dlm_lock_modes[mode]; } +static inline struct lu_name *mdt_name(const struct lu_env *env, + char *name, int namelen) +{ + struct lu_name *lname; + struct mdt_thread_info *mti; + + mti = lu_context_key_get(&env->le_ctx, &mdt_thread_key); + lname = &mti->mti_name; + lname->ln_name = name; + lname->ln_namelen = namelen; + return lname; +} + /* lprocfs stuff */ int mdt_procfs_init(struct mdt_device *mdt, const char *name); int mdt_procfs_fini(struct mdt_device *mdt); diff --git a/lustre/mdt/mdt_open.c b/lustre/mdt/mdt_open.c index 0df9eff..129e170 100644 --- a/lustre/mdt/mdt_open.c +++ b/lustre/mdt/mdt_open.c @@ -729,6 +729,7 @@ int mdt_reint_open(struct mdt_thread_info *info, struct mdt_lock_handle *lhc) struct lu_attr *la = &ma->ma_attr; __u32 create_flags = info->mti_spec.sp_cr_flags; struct mdt_reint_record *rr = &info->mti_rr; + struct lu_name *lname; int result; int created = 0; ENTRY; @@ -805,8 +806,11 @@ int mdt_reint_open(struct mdt_thread_info *info, struct mdt_lock_handle *lhc) GOTO(out, result = PTR_ERR(parent)); fid_zero(child_fid); + + lname = mdt_name(info->mti_env, (char *)rr->rr_name, rr->rr_namelen); + result = mdo_lookup(info->mti_env, mdt_object_child(parent), - rr->rr_name, child_fid, &info->mti_spec); + lname, child_fid, &info->mti_spec); LASSERTF(ergo(result == 0, fid_is_sane(child_fid)), "looking for "DFID"/%s, result fid="DFID"\n", PFID(mdt_object_fid(parent)), rr->rr_name, PFID(child_fid)); @@ -858,7 +862,7 @@ int mdt_reint_open(struct mdt_thread_info *info, struct mdt_lock_handle *lhc) result = mdo_create(info->mti_env, mdt_object_child(parent), - rr->rr_name, + lname, mdt_object_child(child), &info->mti_spec, &info->mti_attr); diff --git a/lustre/mdt/mdt_reint.c b/lustre/mdt/mdt_reint.c index 753d544..545dbc1 100644 --- a/lustre/mdt/mdt_reint.c +++ b/lustre/mdt/mdt_reint.c @@ -46,6 +46,7 @@ static int mdt_md_create(struct mdt_thread_info *info) struct mdt_body *repbody; struct md_attr *ma = &info->mti_attr; struct mdt_reint_record *rr = &info->mti_rr; + struct lu_name *lname; int rc; ENTRY; @@ -81,7 +82,9 @@ static int mdt_md_create(struct mdt_thread_info *info) */ info->mti_spec.sp_cr_lookup = 1; - rc = mdo_create(info->mti_env, next, rr->rr_name, + lname = mdt_name(info->mti_env, (char *)rr->rr_name, + rr->rr_namelen); + rc = mdo_create(info->mti_env, next, lname, mdt_object_child(child), &info->mti_spec, ma); if (rc == 0) { @@ -371,6 +374,7 @@ static int mdt_reint_unlink(struct mdt_thread_info *info, struct mdt_object *mc; struct mdt_lock_handle *parent_lh; struct mdt_lock_handle *child_lh; + struct lu_name *lname; int rc; ENTRY; @@ -431,8 +435,9 @@ static int mdt_reint_unlink(struct mdt_thread_info *info, } /* step 2: find & lock the child */ + lname = mdt_name(info->mti_env, (char *)rr->rr_name, rr->rr_namelen); rc = mdo_lookup(info->mti_env, mdt_object_child(mp), - rr->rr_name, child_fid, &info->mti_spec); + lname, child_fid, &info->mti_spec); if (rc != 0) GOTO(out_unlock_parent, rc); @@ -486,6 +491,7 @@ static int mdt_reint_link(struct mdt_thread_info *info, struct mdt_object *mp; struct mdt_lock_handle *lhs; struct mdt_lock_handle *lhp; + struct lu_name *lname; int rc; ENTRY; @@ -548,8 +554,9 @@ static int mdt_reint_link(struct mdt_thread_info *info, mdt_fail_write(info->mti_env, info->mti_mdt->mdt_bottom, OBD_FAIL_MDS_REINT_LINK_WRITE); + lname = mdt_name(info->mti_env, (char *)rr->rr_name, rr->rr_namelen); rc = mdo_link(info->mti_env, mdt_object_child(mp), - mdt_object_child(ms), rr->rr_name, ma); + mdt_object_child(ms), lname, ma); EXIT; mdt_object_unlock_put(info, ms, lhs, rc); @@ -572,6 +579,7 @@ static int mdt_reint_rename_tgt(struct mdt_thread_info *info) struct mdt_lock_handle *lh_tgtdir; struct mdt_lock_handle *lh_tgt; struct lu_fid *tgt_fid = &info->mti_tmp_fid1; + struct lu_name *lname; int rc; ENTRY; @@ -589,8 +597,9 @@ static int mdt_reint_rename_tgt(struct mdt_thread_info *info) /* step 2: find & lock the target object if exists. */ mdt_set_capainfo(info, 0, rr->rr_fid1, BYPASS_CAPA); + lname = mdt_name(info->mti_env, (char *)rr->rr_tgt, rr->rr_tgtlen); rc = mdo_lookup(info->mti_env, mdt_object_child(mtgtdir), - rr->rr_tgt, tgt_fid, &info->mti_spec); + lname, tgt_fid, &info->mti_spec); if (rc != 0 && rc != -ENOENT) { GOTO(out_unlock_tgtdir, rc); } else if (rc == 0) { @@ -743,6 +752,7 @@ static int mdt_reint_rename(struct mdt_thread_info *info, struct lu_fid *old_fid = &info->mti_tmp_fid1; struct lu_fid *new_fid = &info->mti_tmp_fid2; struct lustre_handle rename_lh = { 0 }; + struct lu_name *lname; int rc; ENTRY; @@ -804,8 +814,9 @@ static int mdt_reint_rename(struct mdt_thread_info *info, } /* step 3: find & lock the old object. */ + lname = mdt_name(info->mti_env, (char *)rr->rr_name, rr->rr_namelen); rc = mdo_lookup(info->mti_env, mdt_object_child(msrcdir), - rr->rr_name, old_fid, &info->mti_spec); + lname, old_fid, &info->mti_spec); if (rc != 0) GOTO(out_unlock_target, rc); @@ -827,8 +838,9 @@ static int mdt_reint_rename(struct mdt_thread_info *info, /* step 4: find & lock the new object. */ /* new target object may not exist now */ + lname = mdt_name(info->mti_env, (char *)rr->rr_tgt, rr->rr_tgtlen); rc = mdo_lookup(info->mti_env, mdt_object_child(mtgtdir), - rr->rr_tgt, new_fid, &info->mti_spec); + lname, new_fid, &info->mti_spec); if (rc == 0) { /* the new_fid should have been filled at this moment */ if (lu_fid_eq(old_fid, new_fid))