* \retval negative error number on failure
*/
static int lfsck_disable_master_lmv(const struct lu_env *env,
* \retval negative error number on failure
*/
static int lfsck_disable_master_lmv(const struct lu_env *env,
- rc = dt_xattr_del(env, obj, XATTR_NAME_LMV, th, BYPASS_CAPA);
+ rc = dt_xattr_del(env, obj, XATTR_NAME_LMV, th);
- rc = dt_attr_set(env, obj, la, th, BYPASS_CAPA);
+ rc = dt_attr_set(env, obj, la, th);
* striped directory to be handled and other information
*
* \retval positive number if nothing to be done
* striped directory to be handled and other information
*
* \retval positive number if nothing to be done
* \retval negative error number on failure
*/
static int lfsck_remove_lmv(const struct lu_env *env,
* \retval negative error number on failure
*/
static int lfsck_remove_lmv(const struct lu_env *env,
* \param[in] index the old shard's index in the striped directory
* \param[in] flags the new shard's flags in the @lslr slot
*
* \param[in] index the old shard's index in the striped directory
* \param[in] flags the new shard's flags in the @lslr slot
*
* \retval negative error number on failure
*/
static int lfsck_replace_lmv(const struct lu_env *env,
* \retval negative error number on failure
*/
static int lfsck_replace_lmv(const struct lu_env *env,
* \retval "-ERANGE" for invalid @shard_idx
* \retval "-EEXIST" for the required lslr slot has been
* occupied by other shard
* \retval "-ERANGE" for invalid @shard_idx
* \retval "-EEXIST" for the required lslr slot has been
* occupied by other shard
dt_read_lock(env, obj, 0);
rc = dt_xattr_get(env, obj, lfsck_buf_get(env, lmv, sizeof(*lmv)),
dt_read_lock(env, obj, 0);
rc = dt_xattr_get(env, obj, lfsck_buf_get(env, lmv, sizeof(*lmv)),
dt_read_unlock(env, obj);
if (rc != sizeof(*lmv))
return rc > 0 ? -EINVAL : rc;
dt_read_unlock(env, obj);
if (rc != sizeof(*lmv))
return rc > 0 ? -EINVAL : rc;
- rc = dt_xattr_set(env, obj, buf, XATTR_NAME_LMV, 0, th, BYPASS_CAPA);
+ rc = dt_xattr_set(env, obj, buf, XATTR_NAME_LMV, 0, th);
snprintf(info->lti_tmpbuf, sizeof(info->lti_tmpbuf), DFID":%u",
PFID(cfid), cidx);
rc = dt_lookup(env, obj, (struct dt_rec *)tfid,
snprintf(info->lti_tmpbuf, sizeof(info->lti_tmpbuf), DFID":%u",
PFID(cfid), cidx);
rc = dt_lookup(env, obj, (struct dt_rec *)tfid,
* \param[in] index the MDT index on which the LFSCK instance to be notified
*
* \retval positive number if nothing to be done
* \param[in] index the MDT index on which the LFSCK instance to be notified
*
* \retval positive number if nothing to be done
* \retval negative error number on failure
*/
static int lfsck_namespace_notify_lmv_remote(const struct lu_env *env,
* \retval negative error number on failure
*/
static int lfsck_namespace_notify_lmv_remote(const struct lu_env *env,
* \param[in] obj pointer to the striped directory to be rescanned
*
* \retval positive number if nothing to be done
* \param[in] obj pointer to the striped directory to be rescanned
*
* \retval positive number if nothing to be done
* \retval negative error number on failure
*/
int lfsck_namespace_notify_lmv_master_local(const struct lu_env *env,
* \retval negative error number on failure
*/
int lfsck_namespace_notify_lmv_master_local(const struct lu_env *env,
* \param[in] flags to indicate which element(s) in the LMV EA will be set
*
* \retval positive number if nothing to be done
* \param[in] flags to indicate which element(s) in the LMV EA will be set
*
* \retval positive number if nothing to be done
* \retval negative error number on failure
*/
static int lfsck_namespace_set_lmv_master(const struct lu_env *env,
* \retval negative error number on failure
*/
static int lfsck_namespace_set_lmv_master(const struct lu_env *env,
* \retval negative error number on failure
*/
int lfsck_namespace_repair_bad_name_hash(const struct lu_env *env,
* \retval negative error number on failure
*/
int lfsck_namespace_repair_bad_name_hash(const struct lu_env *env,
ENTRY;
rc = dt_lookup(env, shard, (struct dt_rec *)pfid,
ENTRY;
rc = dt_lookup(env, shard, (struct dt_rec *)pfid,
+ if (unlikely(!dt_object_exists(parent)))
+ /* The parent object was previously accessed when verifying
+ * the slave LMV EA. If this condition is true it is because
+ * the striped directory is being removed. */
+ GOTO(log, rc = 1);
+
*lmv2 = llmv->ll_lmv;
lmv2->lmv_hash_type = LMV_HASH_TYPE_UNKNOWN | LMV_HASH_FLAG_BAD_TYPE;
rc = lfsck_namespace_set_lmv_master(env, com, parent, lmv2,
*lmv2 = llmv->ll_lmv;
lmv2->lmv_hash_type = LMV_HASH_TYPE_UNKNOWN | LMV_HASH_FLAG_BAD_TYPE;
rc = lfsck_namespace_set_lmv_master(env, com, parent, lmv2,
args = lfsck->li_args_dir & ~(LUDA_VERIFY | LUDA_VERIFY_DRYRUN);
iops = &child->do_index_ops->dio_it;
args = lfsck->li_args_dir & ~(LUDA_VERIFY | LUDA_VERIFY_DRYRUN);
iops = &child->do_index_ops->dio_it;
ns->ln_flags |= LF_INCONSISTENT;
rc = lfsck_namespace_repair_bad_name_hash(env, com,
child, llmv, ent->lde_name);
ns->ln_flags |= LF_INCONSISTENT;
rc = lfsck_namespace_repair_bad_name_hash(env, com,
child, llmv, ent->lde_name);
* \param[in] obj pointer to the object which LMV EA will be checked
* \param[in] llmv pointer to buffer holding the slave LMV EA
*
* \param[in] obj pointer to the object which LMV EA will be checked
* \param[in] llmv pointer to buffer holding the slave LMV EA
*
* \retval negative error number on failure
*/
int lfsck_namespace_verify_stripe_slave(const struct lu_env *env,
* \retval negative error number on failure
*/
int lfsck_namespace_verify_stripe_slave(const struct lu_env *env,
}
rc = dt_lookup(env, obj, (struct dt_rec *)pfid,
}
rc = dt_lookup(env, obj, (struct dt_rec *)pfid,
if (rc != 0 || !fid_is_sane(pfid)) {
rc = lfsck_namespace_trace_update(env, com, cfid,
LNTF_UNCERTAIN_LMV, true);
if (rc != 0 || !fid_is_sane(pfid)) {
rc = lfsck_namespace_trace_update(env, com, cfid,
LNTF_UNCERTAIN_LMV, true);
if (unlikely(!dt_try_as_dir(env, parent)))
GOTO(out, rc = -ENOTDIR);
if (unlikely(!dt_try_as_dir(env, parent)))
GOTO(out, rc = -ENOTDIR);
}
rc = dt_lookup(env, parent, (struct dt_rec *)&tfid,
}
rc = dt_lookup(env, parent, (struct dt_rec *)&tfid,
if (rc != 0 || !lu_fid_eq(cfid, &tfid))
rc = lfsck_namespace_trace_update(env, com, cfid,
LNTF_UNCERTAIN_LMV, true);
if (rc != 0 || !lu_fid_eq(cfid, &tfid))
rc = lfsck_namespace_trace_update(env, com, cfid,
LNTF_UNCERTAIN_LMV, true);
* \retval negative error number on failure
*/
int lfsck_namespace_striped_dir_rescan(const struct lu_env *env,
struct lfsck_component *com,
* \retval negative error number on failure
*/
int lfsck_namespace_striped_dir_rescan(const struct lu_env *env,
struct lfsck_component *com,
struct lfsck_lmv *llmv = lnr->lnr_lmv;
struct lmv_mds_md_v1 *lmv = &llmv->ll_lmv;
struct lmv_mds_md_v1 *lmv2 = &info->lti_lmv2;
struct lfsck_lmv *llmv = lnr->lnr_lmv;
struct lmv_mds_md_v1 *lmv = &llmv->ll_lmv;
struct lmv_mds_md_v1 *lmv2 = &info->lti_lmv2;
- const struct lu_fid *pfid = lfsck_dto2fid(dir);
+ struct lfsck_assistant_object *lso = lnr->lnr_lar.lar_parent;
+ const struct lu_fid *pfid = &lso->lso_fid;
+ struct dt_object *dir = NULL;
+ struct dt_object *obj = NULL;
if (llmv->ll_lmv_slave) {
if (llmv->ll_lmv_verified) {
ns->ln_striped_shards_scanned++;
if (llmv->ll_lmv_slave) {
if (llmv->ll_lmv_verified) {
ns->ln_striped_shards_scanned++;
lmv->lmv_layout_version++;
rc = lfsck_namespace_update_lmv(env, com, dir, lmv, false);
if (rc != 0)
lmv->lmv_layout_version++;
rc = lfsck_namespace_update_lmv(env, com, dir, lmv, false);
if (rc != 0)
struct lfsck_slave_lmv_rec *lslr = llmv->ll_lslr + i;
const struct lu_fid *cfid = &lslr->lslr_fid;
const struct lu_name *cname;
struct lfsck_slave_lmv_rec *lslr = llmv->ll_lslr + i;
const struct lu_fid *cfid = &lslr->lslr_fid;
const struct lu_name *cname;
- if (lfsck_is_dead_obj(dir))
- RETURN(0);
+ if (dir == NULL) {
+ dir = lfsck_assistant_object_load(env, lfsck,
+ lso);
+ if (IS_ERR(dir)) {
+ if (PTR_ERR(dir) == -ENOENT)
+ RETURN(0);
+
+ dir = NULL;
+ }
+ } else if (lfsck_is_dead_obj(dir)) {
+ GOTO(out, rc = 0);
+ }
rc1 = lfsck_namespace_repair_dangling(env, com, dir,
obj, lnr);
if (rc1 >= 0) {
rc1 = lfsck_namespace_repair_dangling(env, com, dir,
obj, lnr);
if (rc1 >= 0) {
rc1 = lfsck_namespace_repair_dirent(env, com, dir, obj,
info->lti_tmpbuf2, lnr->lnr_name,
lnr->lnr_type, true, false);
rc1 = lfsck_namespace_repair_dirent(env, com, dir, obj,
info->lti_tmpbuf2, lnr->lnr_name,
lnr->lnr_type, true, false);
rc1 = lfsck_ibits_lock(env, lfsck, obj, &lh,
MDS_INODELOCK_UPDATE |
MDS_INODELOCK_XATTR, LCK_EX);
rc1 = lfsck_ibits_lock(env, lfsck, obj, &lh,
MDS_INODELOCK_UPDATE |
MDS_INODELOCK_XATTR, LCK_EX);
if (rc1 != 0)
goto next;
rc1 = lfsck_namespace_rebuild_linkea(env, com, obj,
&ldata);
if (rc1 != 0)
goto next;
rc1 = lfsck_namespace_rebuild_linkea(env, com, obj,
&ldata);
repair_lmvea ? "yes" : "no",
lmvea_repaired ? "yes" : "no", rc1);
repair_lmvea ? "yes" : "no",
lmvea_repaired ? "yes" : "no", rc1);
+ GOTO(out, rc);
+
+out:
+ if (obj != NULL && !IS_ERR(obj))
+ lfsck_object_put(env, obj);
+
+ if (dir != NULL && !IS_ERR(dir))
+ lfsck_object_put(env, dir);
+
+ return rc;
* \param[in] lnr pointer to the namespace request that contains the
* shard's name, parent object, parent's LMV, and ect.
*
* \param[in] lnr pointer to the namespace request that contains the
* shard's name, parent object, parent's LMV, and ect.
*
* \retval negative error number on failure
*/
int lfsck_namespace_handle_striped_master(const struct lu_env *env,
struct lfsck_component *com,
* \retval negative error number on failure
*/
int lfsck_namespace_handle_striped_master(const struct lu_env *env,
struct lfsck_component *com,
struct lfsck_instance *lfsck = com->lc_lfsck;
struct lfsck_namespace *ns = com->lc_file_ram;
struct lfsck_lmv *llmv = lnr->lnr_lmv;
struct lfsck_instance *lfsck = com->lc_lfsck;
struct lfsck_namespace *ns = com->lc_file_ram;
struct lfsck_lmv *llmv = lnr->lnr_lmv;
shard_idx = lfsck_find_mdt_idx_by_fid(env, lfsck, &lnr->lnr_fid);
if (shard_idx < 0)
GOTO(fail_lmv, rc = shard_idx);
shard_idx = lfsck_find_mdt_idx_by_fid(env, lfsck, &lnr->lnr_fid);
if (shard_idx < 0)
GOTO(fail_lmv, rc = shard_idx);
if (unlikely(ltd == NULL)) {
CDEBUG(D_LFSCK, "%s: cannot talk with MDT %x which "
"did not join the namespace LFSCK\n",
if (unlikely(ltd == NULL)) {
CDEBUG(D_LFSCK, "%s: cannot talk with MDT %x which "
"did not join the namespace LFSCK\n",
CDEBUG(D_LFSCK, "%s: namespace LFSCK assistant fail to handle "
"the shard: "DFID", parent "DFID", name %.*s: rc = %d\n",
lfsck_lfsck2name(lfsck), PFID(&lnr->lnr_fid),
CDEBUG(D_LFSCK, "%s: namespace LFSCK assistant fail to handle "
"the shard: "DFID", parent "DFID", name %.*s: rc = %d\n",
lfsck_lfsck2name(lfsck), PFID(&lnr->lnr_fid),
- PFID(lfsck_dto2fid(dir)),
- lnr->lnr_namelen, lnr->lnr_name, rc);
+ PFID(pfid), lnr->lnr_namelen, lnr->lnr_name, rc);
if ((rc == -ENOTCONN || rc == -ESHUTDOWN || rc == -EREMCHG ||
rc == -ETIMEDOUT || rc == -EHOSTDOWN ||
if ((rc == -ENOTCONN || rc == -ESHUTDOWN || rc == -EREMCHG ||
rc == -ETIMEDOUT || rc == -EHOSTDOWN ||
if (obj != NULL && !IS_ERR(obj))
lfsck_object_put(env, obj);
if (obj != NULL && !IS_ERR(obj))
lfsck_object_put(env, obj);