- 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);
+ }
+ }