Usually, LFSCK engine will locate the object against the bottom
device (OSD), then make related check/repair directly. Sometimes,
such as lfsck_namespace_repair_dirent(), we need to modify based
on LOD device. Under such case, the LFSCK will re-locate related
object with the same FID.
Originally, there is no special rules about the parameter's name,
that is confused which one should be used. For example, the input
parameter is named as "parent" that is against OSD, we need to
re-locate the obj based on the LOD, named as "pobj", then in the
subsequent logic, "pobj" should be used, but unfortunately, the
"parent" may be used by wrong. It is difficult to find out such
invalid usage.
To avoid such trouble, we prefer to reuse the (input) parameter
name after re-locating the object, name "pobj" as "parent".
Signed-off-by: Fan Yong <fan.yong@intel.com>
Change-Id: I5b6d7c5c10e1817ef2bade4931485228b26c511d
Reviewed-on: http://review.whamcloud.com/16932
Tested-by: Jenkins
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
struct dt_insert_rec *rec = &info->lti_dt_rec;
struct lfsck_instance *lfsck = com->lc_lfsck;
/* The child and its name may be on different MDTs. */
struct dt_insert_rec *rec = &info->lti_dt_rec;
struct lfsck_instance *lfsck = com->lc_lfsck;
/* The child and its name may be on different MDTs. */
+ const struct lu_fid *pfid = lfsck_dto2fid(parent);
+ const struct lu_fid *cfid = lfsck_dto2fid(child);
struct dt_device *dev = lfsck->li_next;
struct dt_device *dev = lfsck->li_next;
- struct dt_object *pobj = NULL;
- struct dt_object *cobj = NULL;
struct thandle *th = NULL;
struct lfsck_lock_handle *llh = &info->lti_llh;
int rc = 0;
struct thandle *th = NULL;
struct lfsck_lock_handle *llh = &info->lti_llh;
int rc = 0;
/* @parent/@child may be based on lfsck->li_bottom,
* but here we need the object based on the lfsck->li_next. */
/* @parent/@child may be based on lfsck->li_bottom,
* but here we need the object based on the lfsck->li_next. */
- pobj = lfsck_object_locate(dev, parent);
- if (IS_ERR(pobj))
- GOTO(log, rc = PTR_ERR(pobj));
+ parent = lfsck_object_locate(dev, parent);
+ if (IS_ERR(parent))
+ GOTO(log, rc = PTR_ERR(parent));
- if (unlikely(!dt_try_as_dir(env, pobj)))
+ if (unlikely(!dt_try_as_dir(env, parent)))
GOTO(log, rc = -ENOTDIR);
GOTO(log, rc = -ENOTDIR);
- cobj = lfsck_object_locate(dev, child);
- if (IS_ERR(cobj))
- GOTO(log, rc = PTR_ERR(cobj));
+ child = lfsck_object_locate(dev, child);
+ if (IS_ERR(child))
+ GOTO(log, rc = PTR_ERR(child));
if (lfsck->li_bookmark_ram.lb_param & LPF_DRYRUN)
GOTO(log, rc = 1);
if (lfsck->li_bookmark_ram.lb_param & LPF_DRYRUN)
GOTO(log, rc = 1);
if (IS_ERR(th))
GOTO(unlock, rc = PTR_ERR(th));
if (IS_ERR(th))
GOTO(unlock, rc = PTR_ERR(th));
- rec->rec_type = lfsck_object_type(cobj) & S_IFMT;
- rec->rec_fid = lfsck_dto2fid(cobj);
- rc = dt_declare_insert(env, pobj, (const struct dt_rec *)rec,
+ rec->rec_type = lfsck_object_type(child) & S_IFMT;
+ rec->rec_fid = cfid;
+ rc = dt_declare_insert(env, parent, (const struct dt_rec *)rec,
(const struct dt_key *)name, th);
if (rc != 0)
GOTO(stop, rc);
if (S_ISDIR(rec->rec_type)) {
(const struct dt_key *)name, th);
if (rc != 0)
GOTO(stop, rc);
if (S_ISDIR(rec->rec_type)) {
- rc = dt_declare_ref_add(env, pobj, th);
+ rc = dt_declare_ref_add(env, parent, th);
if (rc != 0)
GOTO(stop, rc);
}
if (rc != 0)
GOTO(stop, rc);
}
memset(la, 0, sizeof(*la));
la->la_ctime = cfs_time_current_sec();
la->la_valid = LA_CTIME;
memset(la, 0, sizeof(*la));
la->la_ctime = cfs_time_current_sec();
la->la_valid = LA_CTIME;
- rc = dt_declare_attr_set(env, pobj, la, th);
+ rc = dt_declare_attr_set(env, parent, la, th);
if (rc != 0)
GOTO(stop, rc);
if (rc != 0)
GOTO(stop, rc);
- rc = dt_declare_attr_set(env, cobj, la, th);
+ rc = dt_declare_attr_set(env, child, la, th);
if (rc != 0)
GOTO(stop, rc);
if (rc != 0)
GOTO(stop, rc);
if (rc != 0)
GOTO(stop, rc);
if (rc != 0)
GOTO(stop, rc);
- rc = dt_insert(env, pobj, (const struct dt_rec *)rec,
+ rc = dt_insert(env, parent, (const struct dt_rec *)rec,
(const struct dt_key *)name, th, 1);
if (rc != 0)
GOTO(stop, rc);
if (S_ISDIR(rec->rec_type)) {
(const struct dt_key *)name, th, 1);
if (rc != 0)
GOTO(stop, rc);
if (S_ISDIR(rec->rec_type)) {
- dt_write_lock(env, pobj, 0);
- rc = dt_ref_add(env, pobj, th);
- dt_write_unlock(env, pobj);
+ dt_write_lock(env, parent, 0);
+ rc = dt_ref_add(env, parent, th);
+ dt_write_unlock(env, parent);
if (rc != 0)
GOTO(stop, rc);
}
la->la_ctime = cfs_time_current_sec();
if (rc != 0)
GOTO(stop, rc);
}
la->la_ctime = cfs_time_current_sec();
- rc = dt_attr_set(env, pobj, la, th);
+ rc = dt_attr_set(env, parent, la, th);
if (rc != 0)
GOTO(stop, rc);
if (rc != 0)
GOTO(stop, rc);
- rc = dt_attr_set(env, cobj, la, th);
+ rc = dt_attr_set(env, child, la, th);
GOTO(stop, rc = (rc == 0 ? 1 : rc));
GOTO(stop, rc = (rc == 0 ? 1 : rc));
log:
CDEBUG(D_LFSCK, "%s: namespace LFSCK insert object "DFID" with "
"the name %s and type %o to the parent "DFID": rc = %d\n",
log:
CDEBUG(D_LFSCK, "%s: namespace LFSCK insert object "DFID" with "
"the name %s and type %o to the parent "DFID": rc = %d\n",
- lfsck_lfsck2name(lfsck), PFID(lfsck_dto2fid(child)), name,
- lfsck_object_type(child) & S_IFMT,
- PFID(lfsck_dto2fid(parent)), rc);
+ lfsck_lfsck2name(lfsck), PFID(cfid), name,
+ lfsck_object_type(child) & S_IFMT, PFID(pfid), rc);
if (rc != 0) {
struct lfsck_namespace *ns = com->lc_file_ram;
if (rc != 0) {
struct lfsck_namespace *ns = com->lc_file_ram;
/* The child and its name may be on different MDTs. */
struct dt_device *dev = lfsck->li_next;
const char *name = cname->ln_name;
/* The child and its name may be on different MDTs. */
struct dt_device *dev = lfsck->li_next;
const char *name = cname->ln_name;
- struct dt_object *pobj = NULL;
+ const struct lu_fid *pfid = lfsck_dto2fid(parent);
struct dt_object *cobj = NULL;
struct lfsck_lock_handle *pllh = &info->lti_llh;
struct lustre_handle clh = { 0 };
struct dt_object *cobj = NULL;
struct lfsck_lock_handle *pllh = &info->lti_llh;
struct lustre_handle clh = { 0 };
/* @parent/@child may be based on lfsck->li_bottom,
* but here we need the object based on the lfsck->li_next. */
/* @parent/@child may be based on lfsck->li_bottom,
* but here we need the object based on the lfsck->li_next. */
- pobj = lfsck_object_locate(dev, parent);
- if (IS_ERR(pobj))
- GOTO(log, rc = PTR_ERR(pobj));
+ parent = lfsck_object_locate(dev, parent);
+ if (IS_ERR(parent))
+ GOTO(log, rc = PTR_ERR(parent));
- if (unlikely(!dt_try_as_dir(env, pobj)))
+ if (unlikely(!dt_try_as_dir(env, parent)))
GOTO(log, rc = -ENOTDIR);
rc = lfsck_lock(env, lfsck, parent, name, pllh,
GOTO(log, rc = -ENOTDIR);
rc = lfsck_lock(env, lfsck, parent, name, pllh,
- rc = dt_lookup(env, pobj, (struct dt_rec *)&tfid,
+ rc = dt_lookup(env, parent, (struct dt_rec *)&tfid,
(const struct dt_key *)name);
if (rc == -ENOENT) {
exist = false;
(const struct dt_key *)name);
if (rc == -ENOENT) {
exist = false;
if (rc != 0)
GOTO(log, rc);
if (rc != 0)
GOTO(log, rc);
- rc = linkea_links_find(&ldata, cname, lfsck_dto2fid(pobj));
+ rc = linkea_links_find(&ldata, cname, pfid);
/* Someone moved the child, no need to replace. */
if (rc != 0)
GOTO(log, rc = 0);
/* Someone moved the child, no need to replace. */
if (rc != 0)
GOTO(log, rc = 0);
- rc = dt_declare_delete(env, pobj, (const struct dt_key *)name, th);
+ rc = dt_declare_delete(env, parent, (const struct dt_key *)name, th);
if (rc != 0)
GOTO(stop, rc);
rec->rec_type = S_IFDIR;
rec->rec_fid = lfsck_dto2fid(child);
if (rc != 0)
GOTO(stop, rc);
rec->rec_type = S_IFDIR;
rec->rec_fid = lfsck_dto2fid(child);
- rc = dt_declare_insert(env, pobj, (const struct dt_rec *)rec,
+ rc = dt_declare_insert(env, parent, (const struct dt_rec *)rec,
(const struct dt_key *)name, th);
if (rc != 0)
GOTO(stop, rc);
(const struct dt_key *)name, th);
if (rc != 0)
GOTO(stop, rc);
}
/* The old name entry maybe not exist. */
}
/* The old name entry maybe not exist. */
- rc = dt_delete(env, pobj, (const struct dt_key *)name, th);
+ rc = dt_delete(env, parent, (const struct dt_key *)name, th);
if (rc != 0 && rc != -ENOENT)
GOTO(stop, rc);
if (rc != 0 && rc != -ENOENT)
GOTO(stop, rc);
- rc = dt_insert(env, pobj, (const struct dt_rec *)rec,
+ rc = dt_insert(env, parent, (const struct dt_rec *)rec,
(const struct dt_key *)name, th, 1);
GOTO(stop, rc = (rc == 0 ? 1 : rc));
(const struct dt_key *)name, th, 1);
GOTO(stop, rc = (rc == 0 ? 1 : rc));
"object "DFID" because of conflict with the object "DFID
" under the parent "DFID" with name %s: rc = %d\n",
lfsck_lfsck2name(lfsck), PFID(cfid),
"object "DFID" because of conflict with the object "DFID
" under the parent "DFID" with name %s: rc = %d\n",
lfsck_lfsck2name(lfsck), PFID(cfid),
- PFID(lfsck_dto2fid(child)), PFID(lfsck_dto2fid(parent)),
- name, rc);
+ PFID(lfsck_dto2fid(child)), PFID(pfid), name, rc);
{
struct lfsck_thread_info *info = lfsck_env_info(env);
struct dt_insert_rec *rec = &info->lti_dt_rec;
{
struct lfsck_thread_info *info = lfsck_env_info(env);
struct dt_insert_rec *rec = &info->lti_dt_rec;
+ const struct lu_fid *pfid = lfsck_dto2fid(parent);
const struct lu_fid *cfid = lfsck_dto2fid(child);
struct lu_fid tfid;
struct lfsck_instance *lfsck = com->lc_lfsck;
const struct lu_fid *cfid = lfsck_dto2fid(child);
struct lu_fid tfid;
struct lfsck_instance *lfsck = com->lc_lfsck;
struct dt_device *dev = lfsck->li_next;
struct thandle *th = NULL;
struct lfsck_lock_handle *llh = &info->lti_llh;
struct dt_device *dev = lfsck->li_next;
struct thandle *th = NULL;
struct lfsck_lock_handle *llh = &info->lti_llh;
+ parent = lfsck_object_locate(dev, parent);
+ if (IS_ERR(parent))
+ GOTO(log, rc = PTR_ERR(parent));
+
if (unlikely(!dt_try_as_dir(env, parent)))
GOTO(log, rc = -ENOTDIR);
if (unlikely(!dt_try_as_dir(env, parent)))
GOTO(log, rc = -ENOTDIR);
if (IS_ERR(th))
GOTO(unlock1, rc = PTR_ERR(th));
if (IS_ERR(th))
GOTO(unlock1, rc = PTR_ERR(th));
- dto = dt_object_locate(parent, th->th_dev);
- rc = dt_declare_delete(env, dto, (const struct dt_key *)name, th);
+ rc = dt_declare_delete(env, parent, (const struct dt_key *)name, th);
if (rc != 0)
GOTO(stop, rc);
if (update) {
rec->rec_type = lfsck_object_type(child) & S_IFMT;
rec->rec_fid = cfid;
if (rc != 0)
GOTO(stop, rc);
if (update) {
rec->rec_type = lfsck_object_type(child) & S_IFMT;
rec->rec_fid = cfid;
- rc = dt_declare_insert(env, dto,
+ rc = dt_declare_insert(env, parent,
(const struct dt_rec *)rec,
(const struct dt_key *)name2, th);
if (rc != 0)
(const struct dt_rec *)rec,
(const struct dt_key *)name2, th);
if (rc != 0)
- rc = dt_declare_ref_del(env, dto, th);
+ rc = dt_declare_ref_del(env, parent, th);
if (rc != 0)
GOTO(stop, rc);
}
if (rc != 0)
GOTO(stop, rc);
}
- dt_write_lock(env, dto, 0);
- rc = dt_lookup(env, dto, (struct dt_rec *)&tfid,
+ dt_write_lock(env, parent, 0);
+ rc = dt_lookup(env, parent, (struct dt_rec *)&tfid,
(const struct dt_key *)name);
/* Someone has removed the bad name entry by race. */
if (rc == -ENOENT)
(const struct dt_key *)name);
/* Someone has removed the bad name entry by race. */
if (rc == -ENOENT)
if (lfsck->li_bookmark_ram.lb_param & LPF_DRYRUN)
GOTO(unlock2, rc = 1);
if (lfsck->li_bookmark_ram.lb_param & LPF_DRYRUN)
GOTO(unlock2, rc = 1);
- rc = dt_delete(env, dto, (const struct dt_key *)name, th);
+ rc = dt_delete(env, parent, (const struct dt_key *)name, th);
if (rc != 0)
GOTO(unlock2, rc);
if (update) {
if (rc != 0)
GOTO(unlock2, rc);
if (update) {
- rc = dt_insert(env, dto,
+ rc = dt_insert(env, parent,
(const struct dt_rec *)rec,
(const struct dt_key *)name2, th, 1);
if (rc != 0)
(const struct dt_rec *)rec,
(const struct dt_key *)name2, th, 1);
if (rc != 0)
- rc = dt_ref_del(env, dto, th);
+ rc = dt_ref_del(env, parent, th);
if (rc != 0)
GOTO(unlock2, rc);
}
if (rc != 0)
GOTO(unlock2, rc);
}
CDEBUG(D_LFSCK, "%s: namespace LFSCK assistant found bad name "
"entry for: parent "DFID", child "DFID", name %s, type "
"in name entry %o, type claimed by child %o. repair it "
CDEBUG(D_LFSCK, "%s: namespace LFSCK assistant found bad name "
"entry for: parent "DFID", child "DFID", name %s, type "
"in name entry %o, type claimed by child %o. repair it "
- "by %s with new name2 %s: rc = %d\n", lfsck_lfsck2name(lfsck),
- PFID(lfsck_dto2fid(parent)), PFID(cfid),
+ "by %s with new name2 %s: rc = %d\n",
+ lfsck_lfsck2name(lfsck), PFID(pfid), PFID(cfid),
name, type, update ? lfsck_object_type(child) : 0,
update ? "updating" : "removing", name2, rc);
name, type, update ? lfsck_object_type(child) : 0,
update ? "updating" : "removing", name2, rc);
struct dt_object_format *dof = &info->lti_dof;
struct dt_insert_rec *rec = &info->lti_dt_rec;
struct lmv_mds_md_v1 *lmv2 = &info->lti_lmv2;
struct dt_object_format *dof = &info->lti_dof;
struct dt_insert_rec *rec = &info->lti_dt_rec;
struct lmv_mds_md_v1 *lmv2 = &info->lti_lmv2;
- struct dt_object *pobj = NULL;
- struct dt_object *cobj = NULL;
const struct lu_name *cname;
const struct lu_name *cname;
+ const struct lu_fid *pfid = lfsck_dto2fid(parent);
+ const struct lu_fid *cfid = lfsck_dto2fid(child);
struct linkea_data ldata = { NULL };
struct lfsck_lock_handle *llh = &info->lti_llh;
struct lu_buf linkea_buf;
struct linkea_data ldata = { NULL };
struct lfsck_lock_handle *llh = &info->lti_llh;
struct lu_buf linkea_buf;
/* We may need to create the sub-objects of the @child via LOD,
* so make the modification based on lfsck->li_next. */
/* We may need to create the sub-objects of the @child via LOD,
* so make the modification based on lfsck->li_next. */
- pobj = lfsck_object_locate(dev, parent);
- if (IS_ERR(pobj))
- GOTO(log, rc = PTR_ERR(pobj));
+ parent = lfsck_object_locate(dev, parent);
+ if (IS_ERR(parent))
+ GOTO(log, rc = PTR_ERR(parent));
- if (unlikely(!dt_try_as_dir(env, pobj)))
+ if (unlikely(!dt_try_as_dir(env, parent)))
GOTO(log, rc = -ENOTDIR);
GOTO(log, rc = -ENOTDIR);
- cobj = lfsck_object_locate(dev, child);
- if (IS_ERR(cobj))
- GOTO(log, rc = PTR_ERR(cobj));
+ child = lfsck_object_locate(dev, child);
+ if (IS_ERR(child))
+ GOTO(log, rc = PTR_ERR(child));
rc = linkea_data_new(&ldata, &info->lti_linkea_buf2);
if (rc != 0)
GOTO(log, rc);
rc = linkea_data_new(&ldata, &info->lti_linkea_buf2);
if (rc != 0)
GOTO(log, rc);
- rc = linkea_add_buf(&ldata, cname, lfsck_dto2fid(pobj));
+ rc = linkea_add_buf(&ldata, cname, pfid);
if (rc != 0)
GOTO(log, rc);
if (rc != 0)
GOTO(log, rc);
if (rc != 0)
GOTO(log, rc);
if (rc != 0)
GOTO(log, rc);
- rc = lfsck_namespace_check_exist(env, pobj, cobj, lnr->lnr_name);
+ rc = lfsck_namespace_check_exist(env, parent, child, lnr->lnr_name);
if (rc != 0)
GOTO(log, rc);
if (rc != 0)
GOTO(log, rc);
la->la_valid = LA_TYPE | LA_MODE | LA_UID | LA_GID |
LA_ATIME | LA_MTIME | LA_CTIME;
la->la_valid = LA_TYPE | LA_MODE | LA_UID | LA_GID |
LA_ATIME | LA_MTIME | LA_CTIME;
- cobj->do_ops->do_ah_init(env, hint, pobj, cobj,
+ child->do_ops->do_ah_init(env, hint, parent, child,
la->la_mode & S_IFMT);
memset(dof, 0, sizeof(*dof));
la->la_mode & S_IFMT);
memset(dof, 0, sizeof(*dof));
GOTO(log, rc = PTR_ERR(th));
/* 1a. create child. */
GOTO(log, rc = PTR_ERR(th));
/* 1a. create child. */
- rc = dt_declare_create(env, cobj, la, hint, dof, th);
+ rc = dt_declare_create(env, child, la, hint, dof, th);
if (rc != 0)
GOTO(stop, rc);
if (S_ISDIR(type)) {
if (rc != 0)
GOTO(stop, rc);
if (S_ISDIR(type)) {
- if (unlikely(!dt_try_as_dir(env, cobj)))
+ if (unlikely(!dt_try_as_dir(env, child)))
GOTO(stop, rc = -ENOTDIR);
/* 2a. insert dot into child dir */
rec->rec_type = S_IFDIR;
GOTO(stop, rc = -ENOTDIR);
/* 2a. insert dot into child dir */
rec->rec_type = S_IFDIR;
- rec->rec_fid = lfsck_dto2fid(cobj);
- rc = dt_declare_insert(env, cobj,
+ rec->rec_fid = cfid;
+ rc = dt_declare_insert(env, child,
(const struct dt_rec *)rec,
(const struct dt_key *)dot, th);
if (rc != 0)
GOTO(stop, rc);
/* 3a. insert dotdot into child dir */
(const struct dt_rec *)rec,
(const struct dt_key *)dot, th);
if (rc != 0)
GOTO(stop, rc);
/* 3a. insert dotdot into child dir */
- rec->rec_fid = lfsck_dto2fid(pobj);
- rc = dt_declare_insert(env, cobj,
+ rec->rec_fid = pfid;
+ rc = dt_declare_insert(env, child,
(const struct dt_rec *)rec,
(const struct dt_key *)dotdot, th);
if (rc != 0)
GOTO(stop, rc);
/* 4a. increase child nlink */
(const struct dt_rec *)rec,
(const struct dt_key *)dotdot, th);
if (rc != 0)
GOTO(stop, rc);
/* 4a. increase child nlink */
- rc = dt_declare_ref_add(env, cobj, th);
+ rc = dt_declare_ref_add(env, child, th);
if (rc != 0)
GOTO(stop, rc);
if (rc != 0)
GOTO(stop, rc);
idx = lfsck_shard_name_to_index(env,
lnr->lnr_name, lnr->lnr_namelen,
idx = lfsck_shard_name_to_index(env,
lnr->lnr_name, lnr->lnr_namelen,
- type, lfsck_dto2fid(cobj));
if (unlikely(idx < 0))
GOTO(stop, rc = idx);
if (unlikely(idx < 0))
GOTO(stop, rc = idx);
lfsck_lmv_header_cpu_to_le(lmv2, lmv2);
lfsck_buf_init(&lmv_buf, lmv2, sizeof(*lmv2));
lfsck_lmv_header_cpu_to_le(lmv2, lmv2);
lfsck_buf_init(&lmv_buf, lmv2, sizeof(*lmv2));
- rc = dt_declare_xattr_set(env, cobj, &lmv_buf,
+ rc = dt_declare_xattr_set(env, child, &lmv_buf,
XATTR_NAME_LMV, 0, th);
if (rc != 0)
GOTO(stop, rc);
XATTR_NAME_LMV, 0, th);
if (rc != 0)
GOTO(stop, rc);
/* 6a. insert linkEA for child */
lfsck_buf_init(&linkea_buf, ldata.ld_buf->lb_buf,
ldata.ld_leh->leh_len);
/* 6a. insert linkEA for child */
lfsck_buf_init(&linkea_buf, ldata.ld_buf->lb_buf,
ldata.ld_leh->leh_len);
- rc = dt_declare_xattr_set(env, cobj, &linkea_buf,
+ rc = dt_declare_xattr_set(env, child, &linkea_buf,
XATTR_NAME_LINK, 0, th);
if (rc != 0)
GOTO(stop, rc);
XATTR_NAME_LINK, 0, th);
if (rc != 0)
GOTO(stop, rc);
if (rc != 0)
GOTO(stop, rc = (rc == -EEXIST ? 1 : rc));
if (rc != 0)
GOTO(stop, rc = (rc == -EEXIST ? 1 : rc));
- dt_write_lock(env, cobj, 0);
+ dt_write_lock(env, child, 0);
- rc = dt_create(env, cobj, la, hint, dof, th);
+ rc = dt_create(env, child, la, hint, dof, th);
if (rc != 0)
GOTO(unlock, rc = (rc == -EEXIST ? 1 : rc));
if (S_ISDIR(type)) {
/* 2b. insert dot into child dir */
rec->rec_type = S_IFDIR;
if (rc != 0)
GOTO(unlock, rc = (rc == -EEXIST ? 1 : rc));
if (S_ISDIR(type)) {
/* 2b. insert dot into child dir */
rec->rec_type = S_IFDIR;
- rec->rec_fid = lfsck_dto2fid(cobj);
- rc = dt_insert(env, cobj, (const struct dt_rec *)rec,
+ rec->rec_fid = cfid;
+ rc = dt_insert(env, child, (const struct dt_rec *)rec,
(const struct dt_key *)dot, th, 1);
if (rc != 0)
GOTO(unlock, rc);
/* 3b. insert dotdot into child dir */
(const struct dt_key *)dot, th, 1);
if (rc != 0)
GOTO(unlock, rc);
/* 3b. insert dotdot into child dir */
- rec->rec_fid = lfsck_dto2fid(pobj);
- rc = dt_insert(env, cobj, (const struct dt_rec *)rec,
+ rec->rec_fid = pfid;
+ rc = dt_insert(env, child, (const struct dt_rec *)rec,
(const struct dt_key *)dotdot, th, 1);
if (rc != 0)
GOTO(unlock, rc);
/* 4b. increase child nlink */
(const struct dt_key *)dotdot, th, 1);
if (rc != 0)
GOTO(unlock, rc);
/* 4b. increase child nlink */
- rc = dt_ref_add(env, cobj, th);
+ rc = dt_ref_add(env, child, th);
if (rc != 0)
GOTO(unlock, rc);
/* 5b. generate slave LMV EA. */
if (lnr->lnr_lmv != NULL && lnr->lnr_lmv->ll_lmv_master) {
if (rc != 0)
GOTO(unlock, rc);
/* 5b. generate slave LMV EA. */
if (lnr->lnr_lmv != NULL && lnr->lnr_lmv->ll_lmv_master) {
- rc = dt_xattr_set(env, cobj, &lmv_buf, XATTR_NAME_LMV,
+ rc = dt_xattr_set(env, child, &lmv_buf, XATTR_NAME_LMV,
0, th);
if (rc != 0)
GOTO(unlock, rc);
0, th);
if (rc != 0)
GOTO(unlock, rc);
}
/* 6b. insert linkEA for child. */
}
/* 6b. insert linkEA for child. */
- rc = dt_xattr_set(env, cobj, &linkea_buf,
+ rc = dt_xattr_set(env, child, &linkea_buf,
XATTR_NAME_LINK, 0, th);
GOTO(unlock, rc);
unlock:
XATTR_NAME_LINK, 0, th);
GOTO(unlock, rc);
unlock:
- dt_write_unlock(env, cobj);
+ dt_write_unlock(env, child);
stop:
dt_trans_stop(env, dev, th);
stop:
dt_trans_stop(env, dev, th);
CDEBUG(D_LFSCK, "%s: namespace LFSCK assistant found dangling "
"reference for: parent "DFID", child "DFID", type %u, "
"name %s. %s: rc = %d\n", lfsck_lfsck2name(lfsck),
CDEBUG(D_LFSCK, "%s: namespace LFSCK assistant found dangling "
"reference for: parent "DFID", child "DFID", type %u, "
"name %s. %s: rc = %d\n", lfsck_lfsck2name(lfsck),
- PFID(lfsck_dto2fid(parent)), PFID(lfsck_dto2fid(child)),
- type, cname->ln_name,
+ PFID(pfid), PFID(cfid), type, cname->ln_name,
create ? "Create the lost MDT-object as required" :
"Keep the MDT-object there by default", rc);
create ? "Create the lost MDT-object as required" :
"Keep the MDT-object there by default", rc);