Details
-
Bug
-
Resolution: Fixed
-
Minor
-
None
-
None
-
3
-
9223372036854775807
Description
In hsm_cdt_request_completed() and upon error being returned from mdt_hsm_get_md_hsm(), where "struct md_hsm mh" has not been populated, HS_DIRTY can be wrongly detected and thus CLF_HSM_DIRTY flag will be reported by error :
/** * get obj and HSM attributes on a fid * \param mti [IN] context * \param fid [IN] object fid * \param hsm [OUT] HSM meta data * \retval obj or error (-ENOENT if not found) */ struct mdt_object *mdt_hsm_get_md_hsm(struct mdt_thread_info *mti, const struct lu_fid *fid, struct md_hsm *hsm) { struct md_attr *ma; struct mdt_object *obj; int rc; ENTRY; ma = &mti->mti_attr; ma->ma_need = MA_HSM; ma->ma_valid = 0; /* find object by FID */ obj = mdt_object_find(mti->mti_env, mti->mti_mdt, fid); if (IS_ERR(obj)) RETURN(obj); if (!mdt_object_exists(obj)) { /* no more object */ mdt_object_put(mti->mti_env, obj); RETURN(ERR_PTR(-ENOENT)); } rc = mdt_attr_get_complex(mti, obj, ma); if (rc) { mdt_object_put(mti->mti_env, obj); RETURN(ERR_PTR(rc)); } if (ma->ma_valid & MA_HSM) *hsm = ma->ma_hsm; else memset(hsm, 0, sizeof(*hsm)); ma->ma_valid = 0; RETURN(obj); } ................... /** * update status of a completed request * \param mti [IN] context * \param pgs [IN] progress of the copy tool * \param update_record [IN] update llog record * \retval 0 success * \retval -ve failure */ static int hsm_cdt_request_completed(struct mdt_thread_info *mti, struct hsm_progress_kernel *pgs, const struct cdt_agent_req *car, enum agent_req_status *status) { const struct lu_env *env = mti->mti_env; struct mdt_device *mdt = mti->mti_mdt; struct coordinator *cdt = &mdt->mdt_coordinator; struct mdt_object *obj = NULL; int cl_flags = 0, rc = 0; struct md_hsm mh; bool is_mh_changed; bool need_changelog = true; ENTRY; /* default is to retry */ *status = ARS_WAITING; /* find object by FID, mdt_hsm_get_md_hsm() returns obj or err * if error/removed continue anyway to get correct reporting done */ obj = mdt_hsm_get_md_hsm(mti, &car->car_hai->hai_fid, &mh); ...................... /* rc != 0 means error when analysing action, it may come from * a crasy CT no need to manage DIRTY */ if (rc == 0) hsm_set_cl_flags(&cl_flags, mh.mh_flags & HS_DIRTY ? CLF_HSM_DIRTY : 0); .......................
!IS_ERR(obj) should also be tested before adding CLF_HSM_DIRTY in cl_flags.
This can be the cause of errors in associated sanity-hsm sub-tests test_220a, test_222c, test_222d, tests_224a, when analyzing ChangeLog flags.
Attachments
Issue Links
- is related to
-
LU-10043 sanity-hsm test_222c: Changelog flag is not 0x82
- Resolved