linkea_entry_unpack(ldata.ld_lee, &ldata.ld_reclen,
&lname, &fid);
- if (strncmp(lname.ln_name, name, namelen) ||
+ if (strncmp(lname.ln_name, name, namelen) != 0 ||
lu_fid_eq(&fid, mdd_object_fid(parent))) {
ldata.ld_lee = (struct link_ea_entry *)
((char *)ldata.ld_lee +
if (is_dir)
mdo_ref_del(env, mdd_sobj, handle);
+ /* Get the attr again after ref_del */
+ rc = mdd_la_get(env, mdd_sobj, so_attr,
+ mdd_object_capa(env, mdd_sobj));
+ if (rc != 0)
+ GOTO(stop_trans, rc);
ma->ma_attr = *so_attr;
ma->ma_valid |= MA_INODE;
rc = mdd_finish_unlink(env, mdd_sobj, ma, handle);
}
static int mdd_migrate(const struct lu_env *env, struct md_object *pobj,
- const struct lu_fid *lf, const struct lu_name *lname,
+ struct md_object *sobj, const struct lu_name *lname,
struct md_object *tobj, struct md_attr *ma)
{
struct mdd_object *mdd_pobj = md2mdd_obj(pobj);
struct mdd_device *mdd = mdo2mdd(pobj);
- struct mdd_object *mdd_sobj = NULL;
+ struct mdd_object *mdd_sobj = md2mdd_obj(sobj);
struct mdd_object *mdd_tobj = NULL;
struct lu_attr *so_attr = MDD_ENV_VAR(env, cattr);
struct lu_attr *pattr = MDD_ENV_VAR(env, pattr);
int rc;
ENTRY;
- /* object has to be locked by mdt, so it must exist */
- mdd_sobj = mdd_object_find(env, mdd, lf);
- LASSERT(mdd_sobj != NULL);
-
/* If the file will being migrated, it will check whether
* the file is being opened by someone else right now */
mdd_read_lock(env, mdd_sobj, MOR_SRC_CHILD);
if (rc != 0)
GOTO(put, rc);
put:
- if (mdd_sobj)
- mdd_object_put(env, mdd_sobj);
-
RETURN(rc);
}