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);
if (le32_to_cpu(lmv->lmv_magic) != LMV_MAGIC_STRIPE)
GOTO(out, rc = -EINVAL);
+ /* race with migrate? */
+ if (lmv_hash_is_migrating(cpu_to_le32(lmv->lmv_hash_type)))
+ GOTO(out, rc = -EBUSY);
+
lmv_stripe_count = le32_to_cpu(lmv->lmv_stripe_count);
/* save stripe to clear 'restriping' flag in the end to avoid
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 &&
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
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 = CFS_CAP_FS_MASK;
+ uc->uc_cap = kcap.cap[0];
uc->uc_umask = 0644;
uc->uc_ginfo = NULL;
uc->uc_identity = NULL;