}
-static inline int mdt_remote_permission_check(struct mdt_thread_info *info)
+static inline int mdt_remote_dir_permission_check(struct mdt_thread_info *info)
{
struct lu_ucred *uc = mdt_ucred(info);
struct mdt_device *mdt = info->mti_mdt;
}
/**
- * mdt_remote_permission: Check whether the remote operation is permitted,
+ * mdt_remote_dir_permission: Check whether the remote operation is permitted,
*
* Only sysadmin can create remote directory / striped directory,
* migrate directory and set default stripedEA on directory, unless
* retval = 0 remote operation is allowed.
* < 0 remote operation is denied.
*/
-int mdt_remote_permission(struct mdt_thread_info *info)
+int mdt_remote_dir_permission(struct mdt_thread_info *info)
{
struct md_op_spec *spec = &info->mti_spec;
struct lu_attr *attr = &info->mti_attr.ma_attr;
int rc;
if (info->mti_rr.rr_opcode == REINT_MIGRATE) {
- rc = mdt_remote_permission_check(info);
+ rc = mdt_remote_dir_permission_check(info);
if (rc != 0)
return rc;
}
!mdt_is_striped_client(exp))
return -ENOTSUPP;
- rc = mdt_remote_permission_check(info);
+ rc = mdt_remote_dir_permission_check(info);
if (rc != 0)
return rc;
}
struct md_attr *ma = &info->mti_attr;
if ((ma->ma_valid & MA_LMV)) {
- rc = mdt_remote_permission_check(info);
+ rc = mdt_remote_dir_permission_check(info);
if (rc != 0)
return rc;
}
if (unlikely(IS_ERR(child)))
GOTO(unlock_parent, rc = PTR_ERR(child));
- rc = mdt_remote_permission(info);
+ rc = mdt_remote_dir_permission(info);
if (rc != 0)
GOTO(put_child, rc);
int mdt_add_dirty_flag(struct mdt_thread_info *info, struct mdt_object *mo,
struct md_attr *ma)
{
+ struct lu_ucred *uc = mdt_ucred(info);
+ cfs_cap_t cap_saved;
int rc;
ENTRY;
&& !(ma->ma_hsm.mh_flags & (HS_DIRTY|HS_RELEASED))) {
ma->ma_hsm.mh_flags |= HS_DIRTY;
+ /* Bump cap so that closes from non-owner writers can
+ * set the HSM state to dirty. */
+ cap_saved = uc->uc_cap;
+ uc->uc_cap |= MD_CAP_TO_MASK(CFS_CAP_FOWNER);
rc = mdt_hsm_attr_set(info, mo, &ma->ma_hsm);
+ uc->uc_cap = cap_saved;
if (rc)
CERROR("file attribute change error for "DFID": %d\n",
PFID(mdt_object_fid(mo)), rc);
struct lu_buf *buf = &info->mti_buf;
struct mdt_lock_handle *lh;
- rc = mdt_remote_permission(info);
+ rc = mdt_remote_dir_permission(info);
if (rc < 0)
GOTO(out_put, rc);
if (!cos_incompat) {
rc = mdt_object_striped(info, mc);
if (rc < 0)
- GOTO(unlock_parent, rc = PTR_ERR(mc));
+ GOTO(unlock_parent, rc);
cos_incompat = rc;
if (cos_incompat) {
* going to be sent to client. If it is - mdt_intent_policy() path will
* fix it up and turn FL_LOCAL flag off.
*/
- rc = mdt_fid_lock(ns, &lh->mlh_reg_lh, lh->mlh_reg_mode, policy,
- res, dlmflags, &info->mti_exp->exp_handle.h_cookie);
+ rc = mdt_fid_lock(info->mti_env, ns, &lh->mlh_reg_lh, lh->mlh_reg_mode,
+ policy, res, dlmflags,
+ &info->mti_exp->exp_handle.h_cookie);
return rc;
}
memset(policy, 0, sizeof *policy);
policy->l_inodebits.bits = MDS_INODELOCK_UPDATE;
flags = LDLM_FL_LOCAL_ONLY | LDLM_FL_ATOMIC_CB;
- rc = ldlm_cli_enqueue_local(ns, res_id, LDLM_IBITS, policy,
- LCK_EX, &flags, ldlm_blocking_ast,
- ldlm_completion_ast, NULL, NULL, 0,
- LVB_T_NONE,
- &info->mti_exp->exp_handle.h_cookie,
- lh);
+ rc = ldlm_cli_enqueue_local(info->mti_env, ns, res_id,
+ LDLM_IBITS, policy, LCK_EX, &flags,
+ ldlm_blocking_ast,
+ ldlm_completion_ast, NULL, NULL, 0,
+ LVB_T_NONE,
+ &info->mti_exp->exp_handle.h_cookie,
+ lh);
RETURN(rc);
}
RETURN(rc);
fid_build_reg_res_name(mdt_object_fid(obj), res);
memset(policy, 0, sizeof(*policy));
policy->l_inodebits.bits = MDS_INODELOCK_LOOKUP;
- rc = mdt_fid_lock(info->mti_mdt->mdt_namespace, &lh->mlh_reg_lh,
- LCK_EX, policy, res, dlmflags, NULL);
+ rc = mdt_fid_lock(info->mti_env, info->mti_mdt->mdt_namespace,
+ &lh->mlh_reg_lh, LCK_EX, policy, res,
+ dlmflags, NULL);
}
if (rc != ELDLM_OK)
if (lu_name_is_dot_or_dotdot(&rr->rr_name))
RETURN(-EBUSY);
- rc = mdt_remote_permission(info);
+ rc = mdt_remote_dir_permission(info);
if (rc)
RETURN(rc);
*/
do_sync = rc;
+ /* TODO: DoM migration is not supported yet */
+ if (S_ISREG(lu_object_attr(&sobj->mot_obj))) {
+ ma->ma_lmm = info->mti_big_lmm;
+ ma->ma_lmm_size = info->mti_big_lmmsize;
+ ma->ma_valid = 0;
+ rc = mdt_stripe_get(info, sobj, ma, XATTR_NAME_LOV);
+ if (rc)
+ GOTO(put_source, rc);
+
+ if (ma->ma_valid & MA_LOV &&
+ mdt_lmm_dom_entry(ma->ma_lmm) != LMM_NO_DOM)
+ GOTO(put_source, rc = -EOPNOTSUPP);
+ }
+
/* if migration HSM is allowed */
if (!mdt->mdt_opts.mo_migrate_hsm_allowed) {
ma->ma_need = MA_HSM;
struct mdt_object *mo;
struct ldlm_lock *lease;
struct mdt_body *repbody;
- struct md_layout_change layout = { 0 };
+ struct md_layout_change layout = { .mlc_mirror_id = rr->rr_mirror_id };
bool lease_broken;
int rc, rc2;
ENTRY;
if (mdt_object_remote(mo))
GOTO(out_obj, rc = -EREMOTE);
- lease = ldlm_handle2lock(rr->rr_handle);
+ lease = ldlm_handle2lock(rr->rr_lease_handle);
if (lease == NULL)
GOTO(out_obj, rc = -ESTALE);