return rc;
}
-static int lfsck_namespace_check_exist(const struct lu_env *env,
- struct dt_object *dir,
- struct dt_object *obj, const char *name)
+int lfsck_namespace_check_exist(const struct lu_env *env,
+ struct dt_object *dir,
+ struct dt_object *obj, const char *name)
{
struct lu_fid *fid = &lfsck_env_info(env)->lti_fid;
int rc;
GOTO(out, rc);
}
+ if (fid_is_zero(pfid))
+ GOTO(out, rc = 0);
+
/* The ".." name entry is wrong, update it. */
if (!lu_fid_eq(pfid, lfsck_dto2fid(parent))) {
if (!lustre_handle_is_used(lh) && retry != NULL) {
struct lfsck_bookmark *bk = &lfsck->li_bookmark_ram;
struct dt_object *parent = NULL;
struct linkea_data ldata_new = { 0 };
- int count = 0;
+ int dirent_count = 0;
+ int linkea_count = 0;
int rc = 0;
bool once = true;
ENTRY;
/* Drop invalid linkEA entry. */
if (!fid_is_sane(tfid)) {
linkea_del_buf(ldata, cname);
+ linkea_count++;
continue;
}
* child to be visible via other parent, then
* remove this linkEA entry. */
linkea_del_buf(ldata, cname);
+ linkea_count++;
continue;
}
if (unlikely(!dt_try_as_dir(env, parent))) {
lfsck_object_put(env, parent);
linkea_del_buf(ldata, cname);
+ linkea_count++;
continue;
}
RETURN(rc);
linkea_del_buf(ldata, cname);
+ linkea_count++;
linkea_first_entry(ldata);
/* There may be some invalid dangling name entries under
* other parent directories, remove all of them. */
goto next;
}
- count += rc;
+ dirent_count += rc;
next:
linkea_del_buf(ldata, cname);
}
- ns->ln_dirent_repaired += count;
+ ns->ln_dirent_repaired += dirent_count;
RETURN(rc);
}
linkea_del_buf(ldata, cname);
}
+ linkea_first_entry(ldata);
if (ldata->ld_leh->leh_reccount == 1) {
rc = lfsck_namespace_dsd_single(env, com, child, pfid, ldata,
lh, type, NULL);
+ if (rc == 0 && fid_is_zero(pfid) && linkea_count > 0)
+ rc = lfsck_namespace_rebuild_linkea(env, com, child,
+ ldata);
+
RETURN(rc);
}
RETURN(rc);
}
- linkea_first_entry(ldata);
/* If the dangling name entry for the orphan directory object has
* been remvoed, then just check whether the directory object is
* still under the .lustre/lost+found/MDTxxxx/ or not. */
} else if (lfsck->li_lpf_obj != NULL &&
lu_fid_eq(pfid, lfsck_dto2fid(lfsck->li_lpf_obj))) {
lpf = true;
+ } else if (unlikely(!fid_is_sane(pfid))) {
+ fid_zero(pfid);
}
rc = lfsck_links_read(env, child, &ldata);
lfsck->li_time_last_checkpoint;
__u64 checked = ns->ln_items_checked + com->lc_new_checked;
__u64 speed = checked;
- __u64 new_checked = com->lc_new_checked * HZ;
+ __u64 new_checked = msecs_to_jiffies(com->lc_new_checked *
+ MSEC_PER_SEC);
__u32 rtime = ns->ln_run_time_phase1 +
cfs_duration_sec(duration + HALF_SEC);
com->lc_new_checked;
__u64 speed1 = ns->ln_items_checked;
__u64 speed2 = checked;
- __u64 new_checked = com->lc_new_checked * HZ;
+ __u64 new_checked = msecs_to_jiffies(com->lc_new_checked *
+ MSEC_PER_SEC);
__u32 rtime = ns->ln_run_time_phase2 +
cfs_duration_sec(duration + HALF_SEC);
RETURN(rc > 0 ? 0 : rc);
}
+ case LE_SET_LMV_SLAVE: {
+ if (!(lr->lr_flags & LEF_RECHECK_NAME_HASH))
+ ns->ln_striped_shards_repaired++;
+
+ rc = lfsck_namespace_trace_update(env, com, &lr->lr_fid,
+ LNTF_RECHECK_NAME_HASH, true);
+
+ RETURN(rc > 0 ? 0 : rc);
+ }
case LE_PHASE1_DONE:
case LE_PHASE2_DONE:
case LE_PEER_EXIT:
(lnr->lnr_namelen == 1 || fid_seq_is_dot(fid_seq(&lnr->lnr_fid))))
GOTO(out, rc = 0);
+ if (lnr->lnr_lmv != NULL && lnr->lnr_lmv->ll_lmv_master) {
+ rc = lfsck_namespace_handle_striped_master(env, com, lnr);
+
+ RETURN(rc);
+ }
+
idx = lfsck_find_mdt_idx_by_fid(env, lfsck, &lnr->lnr_fid);
if (idx < 0)
GOTO(out, rc = idx);
*
* Sometimes, the master LMV EA of the striped directory maybe lost, so when
* the namespace LFSCK engine scan the striped directory for the first time,
- * it will be reguarded as a normal directory. As the LFSCK processing, some
+ * it will be regarded as a normal directory. As the LFSCK processing, some
* other LFSCK instance on other MDT will find the shard of this striped dir,
* and find that the master MDT-object of the striped directory lost its LMV
* EA, then such remote LFSCK instance will regenerate the master LMV EA and
goto next;
}
- if (ent->lde_attrs & LUDA_IGNORE &&
- strcmp(ent->lde_name, dotdot) != 0)
+ if (name_is_dot_or_dotdot(ent->lde_name, ent->lde_namelen))
goto next;
lnr = lfsck_namespace_assistant_req_init(lfsck, ent, type);