lmv->lmv_hash_type |= cpu_to_le32(LMV_HASH_FLAG_MERGE |
LMV_HASH_FLAG_MIGRATION);
+ lmv->lmv_hash_type |= lum->lum_hash_type &
+ cpu_to_le32(LMV_HASH_FLAG_FIXED);
lmv->lmv_merge_offset = lum->lum_stripe_count;
lmv->lmv_merge_hash = lum->lum_hash_type;
lmv->lmv_layout_version = cpu_to_le32(++version);
struct mdt_object *parent = NULL;
struct mdt_object *child = NULL;
struct mdt_object *stripe = NULL;
- struct ldlm_enqueue_info *einfo = &info->mti_einfo[0];
+ struct ldlm_enqueue_info *einfo = &info->mti_einfo;
struct mdt_lock_handle *lhp;
struct mdt_lock_handle *lhc;
u32 lmv_stripe_count = 0;
GOTO(restriping_clear, rc);
lhp = &info->mti_lh[MDT_LH_PARENT];
- mdt_lock_pdo_init(lhp, LCK_PW, lname);
- rc = mdt_reint_object_lock(info, parent, lhp, MDS_INODELOCK_UPDATE,
- true);
+ rc = mdt_parent_lock(info, parent, lhp, lname, LCK_PW);
if (rc)
GOTO(restriping_clear, rc);
lhc = &info->mti_lh[MDT_LH_CHILD];
- mdt_lock_reg_init(lhc, LCK_EX);
- if (mdt_object_remote(parent)) {
- /* enqueue object remote LOOKUP lock */
- rc = mdt_remote_object_lock(info, parent, mdt_object_fid(child),
- &lhc->mlh_rreg_lh,
- lhc->mlh_rreg_mode,
- MDS_INODELOCK_LOOKUP, false);
- if (rc != ELDLM_OK)
- GOTO(unlock_parent, rc);
- }
-
- rc = mdt_reint_striped_lock(info, child, lhc, MDS_INODELOCK_FULL, einfo,
- true);
+ rc = mdt_object_stripes_lock(info, parent, child, lhc, einfo,
+ MDS_INODELOCK_FULL, LCK_EX);
if (rc)
- GOTO(unlock_child, rc);
+ GOTO(unlock_parent, rc);
mdt_auto_split_prep(info, spec, ma, lum_stripe_count);
rc = mdt_restripe_internal(info, parent, child, lname, fid, spec, ma);
EXIT;
-unlock_child:
- mdt_reint_striped_unlock(info, child, lhc, einfo, rc);
+ mdt_object_stripes_unlock(info, child, lhc, einfo, rc);
unlock_parent:
mdt_object_unlock(info, parent, lhp, rc);
restriping_clear:
buf.lb_len = sizeof(*lmv);
lh = &info->mti_lh[MDT_LH_PARENT];
- mdt_lock_reg_init(lh, LCK_EX);
- rc = mdt_reint_object_lock(info, stripe, lh, MDS_INODELOCK_XATTR,
- false);
+ rc = mdt_object_lock(info, stripe, lh, MDS_INODELOCK_XATTR, LCK_EX);
if (!rc)
rc = mo_xattr_set(info->mti_env, mdt_object_child(stripe), &buf,
XATTR_NAME_LMV, LU_XATTR_REPLACE);
if ((lmv_is_splitting(lmv) &&
idx >= le32_to_cpu(lmv->lmv_split_offset)) ||
(lmv_is_merging(lmv) &&
- le32_to_cpu(lmv->lmv_hash_type) == LMV_HASH_TYPE_CRUSH &&
+ ((le32_to_cpu(lmv->lmv_hash_type) & LMV_HASH_TYPE_MASK) ==
+ LMV_HASH_TYPE_CRUSH ||
+ (le32_to_cpu(lmv->lmv_hash_type) & LMV_HASH_TYPE_MASK) ==
+ LMV_HASH_TYPE_CRUSH2) &&
idx < le32_to_cpu(lmv->lmv_merge_offset))) {
/* new stripes doesn't need to migrate sub files in dir
* split, neither for target stripes in dir merge if hash type
- * is CRUSH.
+ * is CRUSH or CRUSH2.
*/
rc = mdt_restripe_migrate_finish(info, stripe, lmv);
RETURN(rc);
int mdt_restriper_start(struct mdt_device *mdt)
{
struct mdt_dir_restriper *restriper = &mdt->mdt_restriper;
- kernel_cap_t kcap = cap_combine(CAP_FS_SET, CAP_NFSD_SET);
struct task_struct *task;
struct mdt_thread_info *info;
struct lu_ucred *uc;
uc->uc_fsgid = 0;
uc->uc_suppgids[0] = -1;
uc->uc_suppgids[1] = -1;
- uc->uc_cap = kcap.cap[0];
+ uc->uc_cap = cap_combine(CAP_FS_SET, CAP_NFSD_SET);
uc->uc_umask = 0644;
uc->uc_ginfo = NULL;
uc->uc_identity = NULL;
+ /* do not let rbac interfere with restriper internal processing */
+ uc->uc_rbac_file_perms = 1;
+ uc->uc_rbac_dne_ops = 1;
+ uc->uc_rbac_quota_ops = 1;
+ uc->uc_rbac_byfid_ops = 1;
+ uc->uc_rbac_chlg_ops = 1;
+ uc->uc_rbac_fscrypt_admin = 1;
task = kthread_create(mdt_restriper_main, info, "mdt_restriper_%03d",
mdt_seq_site(mdt)->ss_node_id);