LASSERT(flags != 0);
+ if (unlikely(!fid_is_sane(fid)))
+ RETURN(0);
+
idx = lfsck_sub_trace_file_fid2idx(fid);
obj = com->lc_sub_trace_objs[idx].lsto_obj;
mutex_lock(&com->lc_sub_trace_objs[idx].lsto_mutex);
bool bad_hash = false;
int idx = 0;
int count = 0;
- int rc;
+ int rc = 0;
enum lfsck_namespace_inconsistency_type type = LNIT_NONE;
ENTRY;
GOTO(out, rc);
}
+ if (unlikely(!fid_is_sane(&lnr->lnr_fid))) {
+ CDEBUG(D_LFSCK, "%s: dir scan find invalid FID "DFID
+ " for the name entry %.*s under "DFID"\n",
+ lfsck_lfsck2name(lfsck), PFID(&lnr->lnr_fid),
+ lnr->lnr_namelen, lnr->lnr_name, PFID(pfid));
+
+ if (strcmp(lnr->lnr_name, dotdot) != 0)
+ /* invalid FID means bad name entry, remove it. */
+ type = LNIT_BAD_DIRENT;
+ else
+ /* If the parent FID is invalid, we cannot remove
+ * the ".." entry directly. */
+ rc = lfsck_namespace_trace_update(env, com, pfid,
+ LNTF_CHECK_PARENT, true);
+
+ GOTO(out, rc);
+ }
+
if (unlikely(lnr->lnr_dir_cookie == MDS_DIR_END_OFF)) {
rc = lfsck_namespace_striped_dir_rescan(env, com, lnr);