int lfsck_read_stripe_lmv(const struct lu_env *env, struct dt_object *obj,
struct lmv_mds_md_v1 *lmv)
{
+ struct lfsck_thread_info *info = lfsck_env_info(env);
+ struct lu_buf *buf = &info->lti_buf;
+ int size = sizeof(*lmv) + sizeof(struct lu_fid) * 2;
int rc;
dt_read_lock(env, obj, 0);
- rc = dt_xattr_get(env, obj, lfsck_buf_get(env, lmv, sizeof(*lmv)),
- XATTR_NAME_LMV);
+ buf->lb_buf = lmv;
+ buf->lb_len = sizeof(*lmv);
+ rc = dt_xattr_get(env, obj, buf, XATTR_NAME_LMV);
+ if (unlikely(rc == -ERANGE)) {
+ buf = &info->lti_big_buf;
+ lu_buf_check_and_alloc(buf, size);
+ rc = dt_xattr_get(env, obj, buf, XATTR_NAME_LMV);
+ /* For the in-migration directory, its LMV EA contains
+ * not only the LMV header, but also the FIDs for both
+ * source and target. So the LMV EA size is larger. */
+ if (rc == size) {
+ rc = sizeof(*lmv);
+ memcpy(lmv, buf->lb_buf, rc);
+ }
+ }
dt_read_unlock(env, obj);
if (rc != sizeof(*lmv))
return rc > 0 ? -EINVAL : rc;
lmv3->lmv_magic = LMV_MAGIC;
lmv3->lmv_master_mdt_index = pidx;
+ lmv3->lmv_layout_version++;
if (flags & LEF_SET_LMV_ALL) {
rc = lfsck_allow_regenerate_master_lmv(env, com, obj,
GOTO(out, rc);
}
+ CFS_FAIL_TIMEOUT(OBD_FAIL_LFSCK_ENGINE_DELAY, cfs_fail_val);
+
parent = lfsck_object_find_bottom(env, lfsck, pfid);
if (IS_ERR(parent)) {
rc = lfsck_namespace_trace_update(env, com, cfid,
const struct lu_fid *cfid = &lslr->lslr_fid;
const struct lu_name *cname;
struct linkea_data ldata = { NULL };
- int len;
int rc1 = 0;
bool repair_linkea = false;
bool repair_lmvea = false;
if (fid_is_zero(cfid))
continue;
- len = snprintf(info->lti_tmpbuf, sizeof(info->lti_tmpbuf),
- DFID":%u", PFID(cfid), i);
- cname = lfsck_name_get_const(env, info->lti_tmpbuf, len);
- memcpy(lnr->lnr_name, info->lti_tmpbuf, len);
-
+ lnr->lnr_fid = *cfid;
+ lnr->lnr_namelen = snprintf(lnr->lnr_name,
+ lnr->lnr_size - sizeof(*lnr),
+ DFID":%u", PFID(cfid), i);
+ cname = lfsck_name_get_const(env, lnr->lnr_name,
+ lnr->lnr_namelen);
obj = lfsck_object_find_bottom(env, lfsck, cfid);
if (IS_ERR(obj)) {
if (dir == NULL) {
"%d "DFID" of the striped directory "DFID" with "
"dangling %s/%s, rename %s/%s, llinkea %s/%s, "
"repair_lmvea %s/%s: rc = %d\n", lfsck_lfsck2name(lfsck),
- i, PFID(cfid), PFID(&lnr->lnr_fid),
+ i, PFID(cfid), PFID(pfid),
create ? "yes" : "no", create_repaired ? "yes" : "no",
rename ? "yes" : "no", rename_repaired ? "yes" : "no",
repair_linkea ? "yes" : "no",