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