if (IS_ERR(mp))
RETURN(PTR_ERR(mp));
- if (!mdt_object_remote(mp)) {
- rc = mdt_version_get_check_save(info, mp, 0);
- if (rc)
- GOTO(put_parent, rc);
- }
-
if (!uc->uc_rbac_fscrypt_admin &&
mp->mot_obj.lo_header->loh_attr & LOHA_FSCRYPT_MD)
GOTO(put_parent, rc = -EPERM);
if (rc != 0)
GOTO(put_parent, rc);
+ if (!mdt_object_remote(mp)) {
+ rc = mdt_version_get_check_save(info, mp, 0);
+ if (rc)
+ GOTO(unlock_parent, rc);
+ }
+
if (info->mti_spec.sp_rm_entry) {
if (!mdt_is_dne_client(req->rq_export))
/* Return -ENOTSUPP for old client */
if (IS_ERR(mp))
RETURN(PTR_ERR(mp));
- rc = mdt_version_get_check_save(info, mp, 0);
- if (rc)
- GOTO(put_parent, rc);
-
- rc = mdt_check_enc(info, mp);
- if (rc)
- GOTO(put_parent, rc);
-
/* step 2: find source */
ms = mdt_object_find(info->mti_env, info->mti_mdt, rr->rr_fid1);
if (IS_ERR(ms))
if (rc != 0)
GOTO(put_source, rc);
+ rc = mdt_version_get_check_save(info, mp, 0);
+ if (rc)
+ GOTO(unlock_parent, rc);
+
+ rc = mdt_check_enc(info, mp);
+ if (rc)
+ GOTO(unlock_parent, rc);
+
CFS_FAIL_TIMEOUT(OBD_FAIL_MDS_RENAME3, 5);
lhs = &info->mti_lh[MDT_LH_CHILD];
}
tgt_vbr_obj_set(info->mti_env, mdt_obj2dt(mold));
- /* save version after locking */
- mdt_version_get_save(info, mold, 2);
/* find mnew object:
* mnew target object may not exist now
if (rc < 0)
GOTO(out_unlock_new, rc);
+ /* save version after locking */
+ mdt_version_get_save(info, mold, 2);
+
/* Check if @msrcdir is subdir of @mnew, before locking child
* to avoid reverse locking.
*/
if (rc != 0)
GOTO(out_put_old, rc);
+ mdt_version_get_save(info, mold, 2);
mdt_enoent_version_save(info, 3);
}