ns->ln_pos_first_inconsistent = pos;
CDEBUG(D_LFSCK, "%s: namespace LFSCK hit first non-repaired "
- "inconsistency at the pos ["LPU64", "DFID", "LPX64"]\n",
+ "inconsistency at the pos [%llu, "DFID", %#llx]\n",
lfsck_lfsck2name(lfsck),
ns->ln_pos_first_inconsistent.lp_oit_cookie,
PFID(&ns->ln_pos_first_inconsistent.lp_dir_parent),
/* For destroying all invalid linkEA entries. */
rc = dt_declare_xattr_del(env, obj, XATTR_NAME_LINK, handle);
- if (rc != 0)
- return rc;
-
- /* For insert new linkEA entry. */
- rc = dt_declare_xattr_set(env, obj,
+ if (rc == 0)
+ /* For insert new linkEA entry. */
+ rc = dt_declare_xattr_set(env, obj,
lfsck_buf_get_const(env, NULL, DEFAULT_LINKEA_SIZE),
XATTR_NAME_LINK, 0, handle);
return rc;
if (rc == -ERANGE) {
/* Buf was too small, figure out what we need. */
rc = dt_xattr_get(env, obj, &LU_BUF_NULL, XATTR_NAME_LINK);
- if (rc <= 0)
+ if (unlikely(rc == 0))
+ return -ENODATA;
+
+ if (rc < 0)
return rc;
lu_buf_realloc(ldata->ld_buf, rc);
rc = dt_xattr_get(env, obj, ldata->ld_buf, XATTR_NAME_LINK);
}
+ if (unlikely(rc == 0))
+ return -ENODATA;
+
if (rc > 0)
rc = linkea_init(ldata);
return dt_xattr_set(env, obj, buf, XATTR_NAME_LINK, 0, handle);
}
-static void lfsck_namespace_unpack_linkea_entry(struct linkea_data *ldata,
- struct lu_name *cname,
- struct lu_fid *pfid,
- char *buf)
+static int lfsck_namespace_unpack_linkea_entry(struct linkea_data *ldata,
+ struct lu_name *cname,
+ struct lu_fid *pfid,
+ char *buf, const int buflen)
{
linkea_entry_unpack(ldata->ld_lee, &ldata->ld_reclen, cname, pfid);
+ if (unlikely(ldata->ld_reclen <= 0 ||
+ ldata->ld_reclen + sizeof(struct link_ea_header) >
+ ldata->ld_leh->leh_len ||
+ cname->ln_namelen <= 0 ||
+ cname->ln_namelen > NAME_MAX ||
+ cname->ln_namelen >= buflen ||
+ !fid_is_sane(pfid)))
+ return -EINVAL;
+
/* To guarantee the 'name' is terminated with '0'. */
memcpy(buf, cname->ln_name, cname->ln_namelen);
buf[cname->ln_namelen] = 0;
cname->ln_name = buf;
+
+ return 0;
+}
+
+static void lfsck_linkea_del_buf(struct linkea_data *ldata,
+ const struct lu_name *lname)
+{
+ LASSERT(ldata->ld_leh != NULL && ldata->ld_lee != NULL);
+
+ /* If current record is corrupted, all the subsequent
+ * records will be dropped. */
+ if (unlikely(ldata->ld_reclen <= 0 ||
+ ldata->ld_reclen + sizeof(struct link_ea_header) >
+ ldata->ld_leh->leh_len)) {
+ void *ptr = ldata->ld_lee;
+
+ ldata->ld_leh->leh_len = sizeof(struct link_ea_header);
+ ldata->ld_leh->leh_reccount = 0;
+ linkea_first_entry(ldata);
+ while (ldata->ld_lee != NULL &&
+ (char *)ldata->ld_lee < (char *)ptr) {
+ int reclen = (ldata->ld_lee->lee_reclen[0] << 8) |
+ ldata->ld_lee->lee_reclen[1];
+
+ ldata->ld_leh->leh_len += reclen;
+ ldata->ld_leh->leh_reccount++;
+ ldata->ld_lee = (struct link_ea_entry *)
+ ((char *)ldata->ld_lee + reclen);
+ }
+
+ ldata->ld_lee = NULL;
+ } else {
+ linkea_del_buf(ldata, lname);
+ }
}
static int lfsck_namespace_filter_linkea_entry(struct linkea_data *ldata,
if (!remove)
break;
- linkea_del_buf(ldata, cname);
+ lfsck_linkea_del_buf(ldata, cname);
} else {
linkea_next_entry(ldata);
}
struct thandle *th = NULL;
struct lfsck_lock_handle *pllh = &info->lti_llh;
struct lustre_handle clh = { 0 };
- struct linkea_data ldata = { NULL };
+ struct linkea_data ldata2 = { NULL };
struct lu_buf linkea_buf;
int namelen;
int idx = 0;
cname->ln_name = info->lti_key;
cname->ln_namelen = namelen;
- rc = linkea_data_new(&ldata, &info->lti_linkea_buf2);
+ rc = linkea_data_new(&ldata2, &info->lti_linkea_buf2);
if (rc != 0)
GOTO(log, rc);
- rc = linkea_add_buf(&ldata, cname, pfid);
+ rc = linkea_add_buf(&ldata2, cname, pfid);
if (rc != 0)
GOTO(log, rc);
if (rc != 0)
GOTO(log, rc);
- lfsck_buf_init(&linkea_buf, ldata.ld_buf->lb_buf,
- ldata.ld_leh->leh_len);
+ lfsck_buf_init(&linkea_buf, ldata2.ld_buf->lb_buf,
+ ldata2.ld_leh->leh_len);
th = dt_trans_create(env, dev);
if (IS_ERR(th))
GOTO(log, rc = PTR_ERR(th));
GOTO(stop, rc);
dt_write_lock(env, orphan, 0);
- rc = lfsck_links_read(env, orphan, &ldata);
+ rc = lfsck_links_read2(env, orphan, &ldata2);
if (likely((rc == -ENODATA) || (rc == -EINVAL) ||
- (rc == 0 && ldata.ld_leh->leh_reccount == 0))) {
+ (rc == 0 && ldata2.ld_leh != NULL &&
+ ldata2.ld_leh->leh_reccount == 0))) {
if (lfsck->li_bookmark_ram.lb_param & LPF_DRYRUN)
GOTO(unlock, rc = 1);
th);
} else {
if (rc == 0 && count != NULL)
- *count = ldata.ld_leh->leh_reccount;
+ *count = ldata2.ld_leh->leh_reccount;
GOTO(unlock, rc);
}
struct lustre_handle lh = { 0 };
struct linkea_data ldata_new = { NULL };
struct lu_buf linkea_buf;
+ int buflen = 0;
int rc = 0;
ENTRY;
GOTO(log, rc);
if (next)
- linkea_del_buf(ldata, cname);
+ lfsck_linkea_del_buf(ldata, cname);
else
lfsck_namespace_filter_linkea_entry(ldata, cname, pfid,
true);
- lfsck_buf_init(&linkea_buf, ldata->ld_buf->lb_buf,
- ldata->ld_leh->leh_len);
+ if (ldata->ld_leh->leh_reccount > 0) {
+ lfsck_buf_init(&linkea_buf, ldata->ld_buf->lb_buf,
+ ldata->ld_leh->leh_len);
+ buflen = linkea_buf.lb_len;
+ }
again:
th = dt_trans_create(env, dev);
if (IS_ERR(th))
GOTO(unlock1, rc = PTR_ERR(th));
- rc = dt_declare_xattr_set(env, obj, &linkea_buf,
- XATTR_NAME_LINK, 0, th);
+ if (buflen != 0)
+ rc = dt_declare_xattr_set(env, obj, &linkea_buf,
+ XATTR_NAME_LINK, 0, th);
+ else
+ rc = dt_declare_xattr_del(env, obj, XATTR_NAME_LINK, th);
if (rc != 0)
GOTO(stop, rc);
rc = lfsck_links_read2(env, obj, &ldata_new);
if (rc != 0)
- GOTO(unlock2, rc);
+ GOTO(unlock2,
+ rc = (rc == -ENODATA ? 0 : rc));
/* The specified linkEA entry has been removed by race. */
rc = linkea_links_find(&ldata_new, cname, pfid);
GOTO(unlock2, rc = 1);
if (next)
- linkea_del_buf(&ldata_new, cname);
+ lfsck_linkea_del_buf(&ldata_new, cname);
else
lfsck_namespace_filter_linkea_entry(&ldata_new, cname, pfid,
true);
- if (linkea_buf.lb_len < ldata_new.ld_leh->leh_len) {
+ if (buflen < ldata_new.ld_leh->leh_len) {
dt_write_unlock(env, obj);
dt_trans_stop(env, dev, th);
lfsck_buf_init(&linkea_buf, ldata_new.ld_buf->lb_buf,
goto again;
}
- lfsck_buf_init(&linkea_buf, ldata_new.ld_buf->lb_buf,
- ldata_new.ld_leh->leh_len);
- rc = dt_xattr_set(env, obj, &linkea_buf, XATTR_NAME_LINK, 0, th);
+ if (ldata_new.ld_leh->leh_reccount > 0) {
+ lfsck_buf_init(&linkea_buf, ldata_new.ld_buf->lb_buf,
+ ldata_new.ld_leh->leh_len);
+ rc = dt_xattr_set(env, obj, &linkea_buf,
+ XATTR_NAME_LINK, 0, th);
+ } else {
+ rc = dt_xattr_del(env, obj, XATTR_NAME_LINK, th);
+ }
GOTO(unlock2, rc = (rc == 0 ? 1 : rc));
GOTO(stop, rc);
}
- if (dec) {
+ if (dec && S_ISDIR(type)) {
rc = dt_declare_ref_del(env, parent, th);
if (rc != 0)
GOTO(stop, rc);
GOTO(unlock2, rc);
}
- if (dec) {
+ if (dec && S_ISDIR(type)) {
rc = dt_ref_del(env, parent, th);
if (rc != 0)
GOTO(unlock2, rc);
* \param[out] type to tell the caller what the inconsistency is
* \param[in] retry if found inconsistency, but the caller does not hold
* ldlm lock on the @child, then set @retry as true
+ * \param[in] unknown set if does not know how to repair the inconsistency
*
* \retval positive number for repaired cases
* \retval 0 if nothing to be repaired
struct linkea_data *ldata,
struct lustre_handle *lh,
enum lfsck_namespace_inconsistency_type *type,
- bool *retry)
+ bool *retry, bool *unknown)
{
struct lfsck_thread_info *info = lfsck_env_info(env);
struct lu_name *cname = &info->lti_name;
int rc = 0;
ENTRY;
- lfsck_namespace_unpack_linkea_entry(ldata, cname, &tfid, info->lti_key);
+ rc = lfsck_namespace_unpack_linkea_entry(ldata, cname, &tfid,
+ info->lti_key,
+ sizeof(info->lti_key));
/* The unique linkEA entry with bad parent will be handled as orphan. */
- if (!fid_is_sane(&tfid)) {
+ if (rc != 0) {
if (!lustre_handle_is_used(lh) && retry != NULL)
*retry = true;
else
}
GOTO(out, rc);
- }
+ } /* !dt_object_exists(parent) */
/* The unique linkEA entry with bad parent will be handled as orphan. */
if (unlikely(!dt_try_as_dir(env, parent))) {
}
GOTO(out, rc);
- }
+ } /* rc == -ENOENT */
if (rc != 0)
GOTO(out, rc);
GOTO(out, rc);
}
- if (fid_is_zero(pfid))
+ /* Zero FID may because the remote directroy object has invalid linkEA,
+ * or lost linkEA. Under such case, the LFSCK on this MDT does not know
+ * how to repair the inconsistency, but the namespace LFSCK on the MDT
+ * where its name entry resides may has more information (name, FID) to
+ * repair such inconsistency. So here, keep the inconsistency to avoid
+ * some imporper repairing. */
+ if (fid_is_zero(pfid)) {
+ if (unknown)
+ *unknown = true;
+
GOTO(out, rc = 0);
+ }
/* The ".." name entry is wrong, update it. */
if (!lu_fid_eq(pfid, lfsck_dto2fid(parent))) {
* \param[in,out] lh ldlm lock handler for the given @child
* \param[out] type to tell the caller what the inconsistency is
* \param[in] lpf true if the ".." entry is under lost+found/MDTxxxx/
+ * \param[in] unknown set if does not know how to repair the inconsistency
*
* \retval positive number for repaired cases
* \retval 0 if nothing to be repaired
struct linkea_data *ldata,
struct lustre_handle *lh,
enum lfsck_namespace_inconsistency_type *type,
- bool lpf)
+ bool lpf, bool *unknown)
{
struct lfsck_thread_info *info = lfsck_env_info(env);
struct lu_name *cname = &info->lti_name;
struct dt_object *parent = NULL;
struct linkea_data ldata_new = { NULL };
int dirent_count = 0;
- int linkea_count = 0;
int rc = 0;
bool once = true;
ENTRY;
again:
while (ldata->ld_lee != NULL) {
- lfsck_namespace_unpack_linkea_entry(ldata, cname, &tfid,
- info->lti_key);
- /* Drop repeated linkEA entries. */
- lfsck_namespace_filter_linkea_entry(ldata, cname, &tfid, true);
+ rc = lfsck_namespace_unpack_linkea_entry(ldata, cname, &tfid,
+ info->lti_key,
+ sizeof(info->lti_key));
/* Drop invalid linkEA entry. */
- if (!fid_is_sane(&tfid)) {
- linkea_del_buf(ldata, cname);
- linkea_count++;
+ if (rc != 0) {
+ lfsck_linkea_del_buf(ldata, cname);
continue;
}
+ /* Drop repeated linkEA entries. */
+ lfsck_namespace_filter_linkea_entry(ldata, cname, &tfid, true);
+
/* If current dotdot is the .lustre/lost+found/MDTxxxx/,
* then it is possible that: the directry object has ever
* been lost, but its name entry was there. In the former
* there is still other chance to make the
* child to be visible via other parent, then
* remove this linkEA entry. */
- linkea_del_buf(ldata, cname);
- linkea_count++;
+ lfsck_linkea_del_buf(ldata, cname);
continue;
}
/* The linkEA entry with bad parent will be removed. */
if (unlikely(!dt_try_as_dir(env, parent))) {
lfsck_object_put(env, parent);
- linkea_del_buf(ldata, cname);
- linkea_count++;
+ lfsck_linkea_del_buf(ldata, cname);
continue;
}
if (lu_fid_eq(&tfid, cfid)) {
lfsck_object_put(env, parent);
+ /* If the parent (that is declared via linkEA entry)
+ * directory contains the specified child, but such
+ * parent does not match the dotdot name entry, then
+ * trust the linkEA. */
if (!lu_fid_eq(pfid, pfid2)) {
*type = LNIT_UNMATCHED_PAIRS;
rc = lfsck_namespace_repair_unmatched_pairs(env,
if (rc < 0)
RETURN(rc);
- linkea_del_buf(ldata, cname);
- linkea_count++;
+ lfsck_linkea_del_buf(ldata, cname);
linkea_first_entry(ldata);
/* There may be some invalid dangling name entries under
* other parent directories, remove all of them. */
while (ldata->ld_lee != NULL) {
- lfsck_namespace_unpack_linkea_entry(ldata,
- cname, &tfid, info->lti_key);
- if (!fid_is_sane(&tfid))
+ rc = lfsck_namespace_unpack_linkea_entry(ldata,
+ cname, &tfid, info->lti_key,
+ sizeof(info->lti_key));
+ if (rc != 0)
goto next;
parent = lfsck_object_find_bottom(env, lfsck,
dirent_count += rc;
next:
- linkea_del_buf(ldata, cname);
+ lfsck_linkea_del_buf(ldata, cname);
}
ns->ln_dirent_repaired += dirent_count;
RETURN(rc);
- }
+ } /* lu_fid_eq(&tfid, lfsck_dto2fid(child)) */
lfsck_ibits_unlock(lh, LCK_EX);
/* The name entry references another MDT-object that may be
if (rc > 0)
goto rebuild;
- linkea_del_buf(ldata, cname);
- }
+ lfsck_linkea_del_buf(ldata, cname);
+ } /* while (ldata->ld_lee != NULL) */
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);
+ lh, type, NULL, unknown);
RETURN(rc);
}
}
GOTO(out, rc);
- }
+ } /* rc != 0 */
linkea_first_entry(&ldata);
/* This is the most common case: the object has unique linkEA entry. */
if (ldata.ld_leh->leh_reccount == 1) {
rc = lfsck_namespace_dsd_single(env, com, child, pfid, &ldata,
- &lh, &type, &retry);
+ &lh, &type, &retry, &unknown);
if (retry) {
LASSERT(!lustre_handle_is_used(&lh));
* but the LFSCK cannot aware that at that time, then it adds
* the bad linkEA entry for further processing. */
rc = lfsck_namespace_dsd_multiple(env, com, child, pfid, &ldata,
- &lh, &type, lpf);
+ &lh, &type, lpf, &unknown);
GOTO(out, rc);
rc = lfsck_links_read(env, child, &ldata);
dt_read_unlock(env, child);
+
+ if (rc == -EINVAL) {
+ struct lustre_handle lh = { 0 };
+
+ rc = lfsck_ibits_lock(env, com->lc_lfsck, child, &lh,
+ MDS_INODELOCK_UPDATE |
+ MDS_INODELOCK_XATTR, LCK_EX);
+ if (rc == 0) {
+ rc = lfsck_namespace_links_remove(env, com, child);
+ lfsck_ibits_unlock(&lh, LCK_EX);
+ }
+
+ GOTO(out, rc = (rc == -ENOENT ? 0 : rc));
+ }
+
if (rc != 0)
GOTO(out, rc);
linkea_first_entry(&ldata);
while (ldata.ld_lee != NULL) {
- lfsck_namespace_unpack_linkea_entry(&ldata, cname, pfid,
- info->lti_key);
+ rc = lfsck_namespace_unpack_linkea_entry(&ldata, cname, pfid,
+ info->lti_key,
+ sizeof(info->lti_key));
+ /* Invalid PFID in the linkEA entry. */
+ if (rc != 0) {
+ rc = lfsck_namespace_shrink_linkea(env, com, child,
+ &ldata, cname, pfid, true);
+ if (rc < 0)
+ GOTO(out, rc);
+
+ if (rc > 0)
+ repaired = true;
+
+ continue;
+ }
+
rc = lfsck_namespace_filter_linkea_entry(&ldata, cname, pfid,
false);
/* Found repeated linkEA entries */
/* fall through */
}
- /* Invalid PFID in the linkEA entry. */
- if (!fid_is_sane(pfid)) {
- rc = lfsck_namespace_shrink_linkea(env, com, child,
- &ldata, cname, pfid, true);
- if (rc < 0)
- GOTO(out, rc);
-
- if (rc > 0)
- repaired = true;
-
- continue;
- }
-
parent = lfsck_object_find_bottom(env, lfsck, pfid);
if (IS_ERR(parent))
GOTO(out, rc = PTR_ERR(parent));
repaired = true;
continue;
- }
+ } /* !dt_object_exists(parent) */
/* The linkEA entry with bad parent will be removed. */
if (unlikely(!dt_try_as_dir(env, parent))) {
continue;
}
+ /* The following handles -ENOENT case */
+
rc = dt_attr_get(env, child, la);
if (rc != 0)
GOTO(out, rc);
if (rc < 0 && rc != -ENODATA)
return rc;
- if (rc == 0) {
- LASSERT(ldata.ld_leh != NULL);
-
+ if (rc == 0 && ldata.ld_leh != NULL)
count = ldata.ld_leh->leh_reccount;
- }
if (count == 0) {
/* If the LFSCK is marked as LF_INCOMPLETE, then means some
__u32 time_phase1,
__u32 time_phase2)
{
- seq_printf(m, "checked_phase1: "LPU64"\n"
- "checked_phase2: "LPU64"\n"
- "updated_phase1: "LPU64"\n"
- "updated_phase2: "LPU64"\n"
- "failed_phase1: "LPU64"\n"
- "failed_phase2: "LPU64"\n"
- "directories: "LPU64"\n"
- "dirent_repaired: "LPU64"\n"
- "linkea_repaired: "LPU64"\n"
- "nlinks_repaired: "LPU64"\n"
- "multiple_linked_checked: "LPU64"\n"
- "multiple_linked_repaired: "LPU64"\n"
- "unknown_inconsistency: "LPU64"\n"
- "unmatched_pairs_repaired: "LPU64"\n"
- "dangling_repaired: "LPU64"\n"
- "multiple_referenced_repaired: "LPU64"\n"
- "bad_file_type_repaired: "LPU64"\n"
- "lost_dirent_repaired: "LPU64"\n"
- "local_lost_found_scanned: "LPU64"\n"
- "local_lost_found_moved: "LPU64"\n"
- "local_lost_found_skipped: "LPU64"\n"
- "local_lost_found_failed: "LPU64"\n"
- "striped_dirs_scanned: "LPU64"\n"
- "striped_dirs_repaired: "LPU64"\n"
- "striped_dirs_failed: "LPU64"\n"
- "striped_dirs_disabled: "LPU64"\n"
- "striped_dirs_skipped: "LPU64"\n"
- "striped_shards_scanned: "LPU64"\n"
- "striped_shards_repaired: "LPU64"\n"
- "striped_shards_failed: "LPU64"\n"
- "striped_shards_skipped: "LPU64"\n"
- "name_hash_repaired: "LPU64"\n"
+ seq_printf(m, "checked_phase1: %llu\n"
+ "checked_phase2: %llu\n"
+ "updated_phase1: %llu\n"
+ "updated_phase2: %llu\n"
+ "failed_phase1: %llu\n"
+ "failed_phase2: %llu\n"
+ "directories: %llu\n"
+ "dirent_repaired: %llu\n"
+ "linkea_repaired: %llu\n"
+ "nlinks_repaired: %llu\n"
+ "multiple_linked_checked: %llu\n"
+ "multiple_linked_repaired: %llu\n"
+ "unknown_inconsistency: %llu\n"
+ "unmatched_pairs_repaired: %llu\n"
+ "dangling_repaired: %llu\n"
+ "multiple_referenced_repaired: %llu\n"
+ "bad_file_type_repaired: %llu\n"
+ "lost_dirent_repaired: %llu\n"
+ "local_lost_found_scanned: %llu\n"
+ "local_lost_found_moved: %llu\n"
+ "local_lost_found_skipped: %llu\n"
+ "local_lost_found_failed: %llu\n"
+ "striped_dirs_scanned: %llu\n"
+ "striped_dirs_repaired: %llu\n"
+ "striped_dirs_failed: %llu\n"
+ "striped_dirs_disabled: %llu\n"
+ "striped_dirs_skipped: %llu\n"
+ "striped_shards_scanned: %llu\n"
+ "striped_shards_repaired: %llu\n"
+ "striped_shards_failed: %llu\n"
+ "striped_shards_skipped: %llu\n"
+ "name_hash_repaired: %llu\n"
"success_count: %u\n"
"run_time_phase1: %u seconds\n"
"run_time_phase2: %u seconds\n",
up_write(&com->lc_sem);
log:
- CDEBUG(D_LFSCK, "%s: namespace LFSCK checkpoint at the pos ["LPU64
- ", "DFID", "LPX64"], status = %d: rc = %d\n",
+ CDEBUG(D_LFSCK, "%s: namespace LFSCK checkpoint at the pos [%llu"
+ ", "DFID", %#llx], status = %d: rc = %d\n",
lfsck_lfsck2name(lfsck), lfsck->li_pos_current.lp_oit_cookie,
PFID(&lfsck->li_pos_current.lp_dir_parent),
lfsck->li_pos_current.lp_dir_cookie, ns->ln_status, rc);
rc = lfsck_start_assistant(env, com, lsp);
- CDEBUG(D_LFSCK, "%s: namespace LFSCK prep done, start pos ["LPU64", "
- DFID", "LPX64"]: rc = %d\n",
+ CDEBUG(D_LFSCK, "%s: namespace LFSCK prep done, start pos [%llu, "
+ DFID", %#llx]: rc = %d\n",
lfsck_lfsck2name(lfsck), pos->lp_oit_cookie,
PFID(&pos->lp_dir_parent), pos->lp_dir_cookie, rc);
do_div(speed, rtime);
lfsck_namespace_dump_statistics(m, ns, checked, 0, rtime, 0);
- seq_printf(m, "average_speed_phase1: "LPU64" items/sec\n"
+ seq_printf(m, "average_speed_phase1: %llu items/sec\n"
"average_speed_phase2: N/A\n"
- "average_speed_total: "LPU64" items/sec\n"
- "real_time_speed_phase1: "LPU64" items/sec\n"
+ "average_speed_total: %llu items/sec\n"
+ "real_time_speed_phase1: %llu items/sec\n"
"real_time_speed_phase2: N/A\n",
speed,
speed,
lfsck_namespace_dump_statistics(m, ns, ns->ln_items_checked,
checked,
ns->ln_run_time_phase1, rtime);
- seq_printf(m, "average_speed_phase1: "LPU64" items/sec\n"
- "average_speed_phase2: "LPU64" objs/sec\n"
- "average_speed_total: "LPU64" items/sec\n"
+ seq_printf(m, "average_speed_phase1: %llu items/sec\n"
+ "average_speed_phase2: %llu objs/sec\n"
+ "average_speed_total: %llu items/sec\n"
"real_time_speed_phase1: N/A\n"
- "real_time_speed_phase2: "LPU64" objs/sec\n"
+ "real_time_speed_phase2: %llu objs/sec\n"
"current_position: "DFID"\n",
speed1,
speed2,
ns->ln_objs_checked_phase2,
ns->ln_run_time_phase1,
ns->ln_run_time_phase2);
- seq_printf(m, "average_speed_phase1: "LPU64" items/sec\n"
- "average_speed_phase2: "LPU64" objs/sec\n"
- "average_speed_total: "LPU64" items/sec\n"
+ seq_printf(m, "average_speed_phase1: %llu items/sec\n"
+ "average_speed_phase2: %llu objs/sec\n"
+ "average_speed_total: %llu items/sec\n"
"real_time_speed_phase1: N/A\n"
"real_time_speed_phase2: N/A\n"
"current_position: N/A\n",
LASSERT(newdata);
rc = dt_xattr_del(env, obj, XATTR_NAME_LINK, handle);
- if (rc != 0)
+ if (rc != 0 && rc != -ENOENT && rc != -ENODATA)
GOTO(stop, rc);
}
break;
}
- if (count == 1 && S_ISREG(lfsck_object_type(obj)))
+ if (obj != NULL && count == 1 &&
+ S_ISREG(lfsck_object_type(obj)))
dt_attr_get(env, obj, la);
}
if (!(bk->lb_param & LPF_FAILOUT))
rc = 0;
} else {
- if (log)
- CDEBUG(D_LFSCK, "%s: namespace LFSCK assistant "
- "repaired the entry: "DFID", parent "DFID
- ", name %.*s\n", lfsck_lfsck2name(lfsck),
- PFID(&lnr->lnr_fid), PFID(pfid),
- lnr->lnr_namelen, lnr->lnr_name);
-
if (repaired) {
ns->ln_items_repaired++;
+ if (log)
+ CDEBUG(D_LFSCK, "%s: namespace LFSCK assistant "
+ "repaired the entry: "DFID", parent "DFID
+ ", name %.*s\n", lfsck_lfsck2name(lfsck),
+ PFID(&lnr->lnr_fid), PFID(pfid),
+ lnr->lnr_namelen, lnr->lnr_name);
switch (type) {
case LNIT_DANGLING:
ns->ln_name_hash_repaired++;
/* Not count repeatedly. */
- if (!repaired)
+ if (!repaired) {
ns->ln_items_repaired++;
+ if (log)
+ CDEBUG(D_LFSCK, "%s: namespace LFSCK "
+ "assistant repaired the entry: "
+ DFID", parent "DFID
+ ", name %.*s\n",
+ lfsck_lfsck2name(lfsck),
+ PFID(&lnr->lnr_fid), PFID(pfid),
+ lnr->lnr_namelen, lnr->lnr_name);
+ }
if (bk->lb_param & LPF_DRYRUN &&
lfsck_pos_is_zero(&ns->ln_pos_first_inconsistent))