Whamcloud - gitweb
LU-12800 mdd: do not cache atributes on mdd_parent_fid
[fs/lustre-release.git] / lustre / mdd / mdd_dir.c
index df65484..e3a80bb 100644 (file)
@@ -92,7 +92,7 @@ __mdd_lookup(const struct lu_env *env, struct md_object *pobj,
        }
 
        rc = mdd_permission_internal_locked(env, mdd_obj, pattr, mask,
-                                           MOR_TGT_PARENT);
+                                           DT_TGT_PARENT);
        if (rc)
                RETURN(rc);
 
@@ -234,6 +234,9 @@ static inline int mdd_parent_fid(const struct lu_env *env,
        if (rc != 0)
                GOTO(lookup, rc);
 
+       /* the obj is not locked, don't cache attributes */
+       mdd_invalidate(env, &obj->mod_obj);
+
        LASSERT(ldata.ld_leh != NULL);
        /* Directory should only have 1 parent */
        if (ldata.ld_leh->leh_reccount > 1)
@@ -454,7 +457,7 @@ int mdd_may_create(const struct lu_env *env, struct mdd_object *pobj,
        if (check_perm)
                rc = mdd_permission_internal_locked(env, pobj, pattr,
                                                    MAY_WRITE | MAY_EXEC,
-                                                   MOR_TGT_PARENT);
+                                                   DT_TGT_PARENT);
        RETURN(rc);
 }
 
@@ -475,7 +478,7 @@ int mdd_may_unlink(const struct lu_env *env, struct mdd_object *pobj,
 
        rc = mdd_permission_internal_locked(env, pobj, pattr,
                                            MAY_WRITE | MAY_EXEC,
-                                           MOR_TGT_PARENT);
+                                           DT_TGT_PARENT);
        if (rc != 0)
                RETURN(rc);
 
@@ -529,7 +532,7 @@ static int mdd_may_delete_entry(const struct lu_env *env,
                int rc;
                rc = mdd_permission_internal_locked(env, pobj, pattr,
                                            MAY_WRITE | MAY_EXEC,
-                                           MOR_TGT_PARENT);
+                                           DT_TGT_PARENT);
                if (rc)
                        RETURN(rc);
        }
@@ -695,7 +698,7 @@ static int __mdd_index_insert(const struct lu_env *env, struct mdd_object *pobj,
 
        rc = __mdd_index_insert_only(env, pobj, lf, type, name, handle);
        if (rc == 0 && S_ISDIR(type)) {
-               mdd_write_lock(env, pobj, MOR_TGT_PARENT);
+               mdd_write_lock(env, pobj, DT_TGT_PARENT);
                mdo_ref_add(env, pobj, handle);
                mdd_write_unlock(env, pobj);
        }
@@ -708,17 +711,17 @@ static int __mdd_index_delete(const struct lu_env *env, struct mdd_object *pobj,
                              const char *name, int is_dir,
                              struct thandle *handle)
 {
-        int               rc;
-        ENTRY;
+       int rc;
+       ENTRY;
 
        rc = __mdd_index_delete_only(env, pobj, name, handle);
-        if (rc == 0 && is_dir) {
-                mdd_write_lock(env, pobj, MOR_TGT_PARENT);
-                mdo_ref_del(env, pobj, handle);
-                mdd_write_unlock(env, pobj);
-        }
+       if (rc == 0 && is_dir) {
+               mdd_write_lock(env, pobj, DT_TGT_PARENT);
+               mdo_ref_del(env, pobj, handle);
+               mdd_write_unlock(env, pobj);
+       }
 
-        RETURN(rc);
+       RETURN(rc);
 }
 
 static int mdd_llog_record_calc_size(const struct lu_env *env,
@@ -784,6 +787,47 @@ out_put:
        return rc;
 }
 
+int mdd_changelog_write_rec(const struct lu_env *env,
+                           struct llog_handle *loghandle,
+                           struct llog_rec_hdr *r,
+                           struct llog_cookie *cookie,
+                           int idx, struct thandle *th)
+{
+       int rc;
+
+       if (r->lrh_type == CHANGELOG_REC) {
+               struct mdd_device *mdd;
+               struct llog_changelog_rec *rec;
+
+               mdd = lu2mdd_dev(loghandle->lgh_ctxt->loc_obd->obd_lu_dev);
+               rec = container_of0(r, struct llog_changelog_rec, cr_hdr);
+
+               spin_lock(&mdd->mdd_cl.mc_lock);
+               rec->cr.cr_index = mdd->mdd_cl.mc_index + 1;
+               spin_unlock(&mdd->mdd_cl.mc_lock);
+
+               rc = llog_osd_ops.lop_write_rec(env, loghandle, r,
+                                               cookie, idx, th);
+
+               /*
+                * if current llog is full, we will generate a new
+                * llog, and since it's actually not an error, let's
+                * avoid increasing index so that userspace apps
+                * should not see a gap in the changelog sequence
+                */
+               if (!(rc == -ENOSPC && llog_is_full(loghandle))) {
+                       spin_lock(&mdd->mdd_cl.mc_lock);
+                       ++mdd->mdd_cl.mc_index;
+                       spin_unlock(&mdd->mdd_cl.mc_lock);
+               }
+       } else {
+               rc = llog_osd_ops.lop_write_rec(env, loghandle, r,
+                                               cookie, idx, th);
+       }
+
+       return rc;
+}
+
 /** Add a changelog entry \a rec to the changelog llog
  * \param mdd
  * \param rec
@@ -806,13 +850,6 @@ int mdd_changelog_store(const struct lu_env *env, struct mdd_device *mdd,
        rec->cr_hdr.lrh_type = CHANGELOG_REC;
        rec->cr.cr_time = cl_time();
 
-       spin_lock(&mdd->mdd_cl.mc_lock);
-       /* NB: I suppose it's possible llog_add adds out of order wrt cr_index,
-        * but as long as the MDD transactions are ordered correctly for e.g.
-        * rename conflicts, I don't think this should matter. */
-       rec->cr.cr_index = ++mdd->mdd_cl.mc_index;
-       spin_unlock(&mdd->mdd_cl.mc_lock);
-
        ctxt = llog_get_context(obd, LLOG_CHANGELOG_ORIG_CTXT);
        if (ctxt == NULL)
                return -ENXIO;
@@ -821,6 +858,7 @@ int mdd_changelog_store(const struct lu_env *env, struct mdd_device *mdd,
        if (IS_ERR(llog_th))
                GOTO(out_put, rc = PTR_ERR(llog_th));
 
+       OBD_FAIL_TIMEOUT(OBD_FAIL_MDS_CHANGELOG_REORDER, cfs_fail_val);
        /* nested journal transaction */
        rc = llog_add(env, ctxt->loc_handle, &rec->cr_hdr, NULL, llog_th);
 
@@ -1397,7 +1435,7 @@ static int mdd_link(const struct lu_env *env, struct md_object *tgt_obj,
         if (rc)
                 GOTO(stop, rc);
 
-       mdd_write_lock(env, mdd_sobj, MOR_TGT_CHILD);
+       mdd_write_lock(env, mdd_sobj, DT_TGT_CHILD);
        rc = mdd_link_sanity_check(env, mdd_tobj, tattr, lname, mdd_sobj,
                                   cattr);
        if (rc)
@@ -1456,9 +1494,6 @@ static int mdd_mark_orphan_object(const struct lu_env *env,
        struct lu_attr *attr = MDD_ENV_VAR(env, la_for_start);
        int rc;
 
-       if (!S_ISDIR(mdd_object_type(obj)))
-               return 0;
-
        attr->la_valid = LA_FLAGS;
        attr->la_flags = LUSTRE_ORPHAN_FL;
 
@@ -1716,7 +1751,7 @@ static int mdd_unlink(const struct lu_env *env, struct md_object *pobj,
                GOTO(stop, rc);
 
        if (likely(mdd_cobj != NULL))
-               mdd_write_lock(env, mdd_cobj, MOR_TGT_CHILD);
+               mdd_write_lock(env, mdd_cobj, DT_TGT_CHILD);
 
        if (likely(no_name == 0) && !OBD_FAIL_CHECK(OBD_FAIL_LFSCK_DANGLING2)) {
                rc = __mdd_index_delete(env, mdd_pobj, name, is_dir, handle);
@@ -2109,6 +2144,7 @@ static int mdd_declare_create_object(const struct lu_env *env,
                                     const struct md_op_spec *spec,
                                     struct lu_buf *def_acl_buf,
                                     struct lu_buf *acl_buf,
+                                    struct lu_buf *hsm_buf,
                                     struct dt_allocation_hint *hint)
 {
        const struct lu_buf *buf;
@@ -2119,7 +2155,7 @@ static int mdd_declare_create_object(const struct lu_env *env,
        if (rc)
                GOTO(out, rc);
 
-#ifdef CONFIG_FS_POSIX_ACL
+#ifdef CONFIG_LUSTRE_FS_POSIX_ACL
        if (def_acl_buf && def_acl_buf->lb_len > 0 && S_ISDIR(attr->la_mode)) {
                /* if dir, then can inherit default ACl */
                rc = mdo_declare_xattr_set(env, c, def_acl_buf,
@@ -2155,6 +2191,14 @@ static int mdd_declare_create_object(const struct lu_env *env,
                                           0, handle);
                if (rc)
                        GOTO(out, rc);
+
+               if (spec->sp_cr_flags & MDS_OPEN_PCC) {
+                       rc = mdo_declare_xattr_set(env, c, hsm_buf,
+                                                  XATTR_NAME_HSM,
+                                                  0, handle);
+                       if (rc)
+                               GOTO(out, rc);
+               }
        }
 
        if (S_ISLNK(attr->la_mode)) {
@@ -2191,12 +2235,13 @@ static int mdd_declare_create(const struct lu_env *env, struct mdd_device *mdd,
                              struct linkea_data *ldata,
                              struct lu_buf *def_acl_buf,
                              struct lu_buf *acl_buf,
+                             struct lu_buf *hsm_buf,
                              struct dt_allocation_hint *hint)
 {
        int rc;
 
        rc = mdd_declare_create_object(env, mdd, p, c, attr, handle, spec,
-                                      def_acl_buf, acl_buf, hint);
+                                      def_acl_buf, acl_buf, hsm_buf, hint);
        if (rc)
                GOTO(out, rc);
 
@@ -2255,7 +2300,7 @@ static int mdd_acl_init(const struct lu_env *env, struct mdd_object *pobj,
                RETURN(0);
        }
 
-       mdd_read_lock(env, pobj, MOR_TGT_PARENT);
+       mdd_read_lock(env, pobj, DT_TGT_PARENT);
        rc = mdo_xattr_get(env, pobj, def_acl_buf,
                           XATTR_NAME_ACL_DEFAULT);
        mdd_read_unlock(env, pobj);
@@ -2291,13 +2336,14 @@ static int mdd_create_object(const struct lu_env *env, struct mdd_object *pobj,
                             struct mdd_object *son, struct lu_attr *attr,
                             struct md_op_spec *spec, struct lu_buf *acl_buf,
                             struct lu_buf *def_acl_buf,
+                            struct lu_buf *hsm_buf,
                             struct dt_allocation_hint *hint,
                             struct thandle *handle)
 {
        const struct lu_buf *buf;
        int rc;
 
-       mdd_write_lock(env, son, MOR_TGT_CHILD);
+       mdd_write_lock(env, son, DT_TGT_CHILD);
        rc = mdd_create_object_internal(env, NULL, son, attr, handle, spec,
                                        hint);
        if (rc)
@@ -2339,7 +2385,20 @@ static int mdd_create_object(const struct lu_env *env, struct mdd_object *pobj,
                        GOTO(err_destroy, rc);
        }
 
-#ifdef CONFIG_FS_POSIX_ACL
+       if (S_ISREG(attr->la_mode) && spec->sp_cr_flags & MDS_OPEN_PCC) {
+               struct md_hsm mh;
+
+               memset(&mh, 0, sizeof(mh));
+               mh.mh_flags = HS_EXISTS | HS_ARCHIVED | HS_RELEASED;
+               mh.mh_arch_id = spec->sp_archive_id;
+               lustre_hsm2buf(hsm_buf->lb_buf, &mh);
+               rc = mdo_xattr_set(env, son, hsm_buf, XATTR_NAME_HSM,
+                                  0, handle);
+               if (rc != 0)
+                       GOTO(err_destroy, rc);
+       }
+
+#ifdef CONFIG_LUSTRE_FS_POSIX_ACL
        if (def_acl_buf != NULL && def_acl_buf->lb_len > 0 &&
            S_ISDIR(attr->la_mode)) {
                /* set default acl */
@@ -2487,7 +2546,7 @@ stop:
  * \retval             0 on success
  * \retval             negative errno on failure
  */
-static int mdd_create(const struct lu_env *env, struct md_object *pobj,
+int mdd_create(const struct lu_env *env, struct md_object *pobj,
                      const struct lu_name *lname, struct md_object *child,
                      struct md_op_spec *spec, struct md_attr *ma)
 {
@@ -2501,6 +2560,7 @@ static int mdd_create(const struct lu_env *env, struct md_object *pobj,
        struct lu_attr          *pattr = &info->mti_pattr;
        struct lu_buf           acl_buf;
        struct lu_buf           def_acl_buf;
+       struct lu_buf           hsm_buf;
        struct linkea_data      *ldata = &info->mti_link_data;
        const char              *name = lname->ln_name;
        struct dt_allocation_hint *hint = &mdd_env_info(env)->mti_hint;
@@ -2562,9 +2622,18 @@ static int mdd_create(const struct lu_env *env, struct md_object *pobj,
                                        lname, 1, 0, ldata);
        }
 
+       if (spec->sp_cr_flags & MDS_OPEN_PCC) {
+               LASSERT(spec->sp_cr_flags & MDS_OPEN_HAS_EA);
+
+               memset(&hsm_buf, 0, sizeof(hsm_buf));
+               lu_buf_alloc(&hsm_buf, sizeof(struct hsm_attrs));
+               if (hsm_buf.lb_buf == NULL)
+                       GOTO(out_stop, rc = -ENOMEM);
+       }
+
        rc = mdd_declare_create(env, mdd, mdd_pobj, son, lname, attr,
                                handle, spec, ldata, &def_acl_buf, &acl_buf,
-                               hint);
+                               &hsm_buf, hint);
        if (rc)
                GOTO(out_stop, rc);
 
@@ -2573,12 +2642,12 @@ static int mdd_create(const struct lu_env *env, struct md_object *pobj,
                GOTO(out_stop, rc);
 
        rc = mdd_create_object(env, mdd_pobj, son, attr, spec, &acl_buf,
-                              &def_acl_buf, hint, handle);
+                              &def_acl_buf, &hsm_buf, hint, handle);
        if (rc != 0)
                GOTO(out_stop, rc);
 
        if (unlikely(spec->sp_cr_flags & MDS_OPEN_VOLATILE)) {
-               mdd_write_lock(env, son, MOR_TGT_CHILD);
+               mdd_write_lock(env, son, DT_TGT_CHILD);
                son->mod_flags |= VOLATILE_OBJ;
                rc = mdd_orphan_insert(env, son, handle);
                GOTO(out_volatile, rc);
@@ -2612,7 +2681,7 @@ err_insert:
                        goto out_stop;
 
 err_created:
-               mdd_write_lock(env, son, MOR_TGT_CHILD);
+               mdd_write_lock(env, son, DT_TGT_CHILD);
                if (S_ISDIR(attr->la_mode)) {
                        /* Drop the reference, no need to delete "."/"..",
                         * because the object is to be destroyed directly. */
@@ -2664,6 +2733,9 @@ out_free:
                /* if we vmalloced a large buffer drop it */
                lu_buf_free(ldata->ld_buf);
 
+       if (spec->sp_cr_flags & MDS_OPEN_PCC)
+               lu_buf_free(&hsm_buf);
+
        /* The child object shouldn't be cached anymore */
        if (rc)
                set_bit(LU_OBJECT_HEARD_BANSHEE,
@@ -3026,7 +3098,7 @@ static int mdd_rename(const struct lu_env *env,
                GOTO(fixup_tpobj, rc);
 
        /* Update the linkEA for the source object */
-       mdd_write_lock(env, mdd_sobj, MOR_SRC_CHILD);
+       mdd_write_lock(env, mdd_sobj, DT_SRC_CHILD);
        rc = mdd_links_rename(env, mdd_sobj, mdo2fid(mdd_spobj), lsname,
                              mdo2fid(mdd_tpobj), ltname, handle, ldata,
                              0, 0);
@@ -3045,7 +3117,7 @@ static int mdd_rename(const struct lu_env *env,
          * it must be local one.
          */
         if (tobj && mdd_object_exists(mdd_tobj)) {
-                mdd_write_lock(env, mdd_tobj, MOR_TGT_CHILD);
+               mdd_write_lock(env, mdd_tobj, DT_TGT_CHILD);
                tobj_locked = 1;
                 if (mdd_is_dead_obj(mdd_tobj)) {
                         /* shld not be dead, something is wrong */
@@ -3216,7 +3288,7 @@ static int mdd_migrate_sanity_check(const struct lu_env *env,
        ENTRY;
 
        if (!mdd_object_remote(sobj)) {
-               mdd_read_lock(env, sobj, MOR_SRC_CHILD);
+               mdd_read_lock(env, sobj, DT_SRC_CHILD);
                if (sobj->mod_count > 0) {
                        CDEBUG(D_INFO, "%s: "DFID" is opened, count %d\n",
                               mdd2obd_dev(mdd)->obd_name, PFID(mdo2fid(sobj)),
@@ -3300,7 +3372,7 @@ static int mdd_dir_delete_stripe(const struct lu_env *env,
        if (index < del_offset)
                RETURN(0);
 
-       mdd_write_lock(env, stripe, MOR_SRC_CHILD);
+       mdd_write_lock(env, stripe, DT_SRC_CHILD);
        rc = __mdd_index_delete_only(env, stripe, dotdot, handle);
        if (rc)
                GOTO(out, rc);
@@ -3391,7 +3463,7 @@ static int mdd_dir_destroy_stripe(const struct lu_env *env,
                RETURN(rc);
        }
 
-       mdd_write_lock(env, stripe, MOR_SRC_CHILD);
+       mdd_write_lock(env, stripe, DT_SRC_CHILD);
        rc = mdo_ref_del(env, stripe, handle);
        if (!rc)
                rc = mdo_destroy(env, stripe, handle);
@@ -3478,6 +3550,7 @@ static int mdd_iterate_xattrs(const struct lu_env *env,
        struct mdd_thread_info *info = mdd_env_info(env);
        char *xname;
        struct lu_buf list_xbuf;
+       struct lu_buf cbxbuf;
        struct lu_buf xbuf = { NULL };
        int list_xsize;
        int xlen;
@@ -3534,14 +3607,15 @@ static int mdd_iterate_xattrs(const struct lu_env *env,
                if (rc < 0)
                        GOTO(out, rc);
 
+               cbxbuf = xbuf;
 repeat:
-               rc = cb(env, tobj, &xbuf, xname, 0, handle);
+               rc = cb(env, tobj, &cbxbuf, xname, 0, handle);
                if (unlikely(rc == -ENOSPC &&
                             strcmp(xname, XATTR_NAME_LINK) == 0)) {
                        rc = linkea_overflow_shrink(
-                                       (struct linkea_data *)(xbuf.lb_buf));
+                                       (struct linkea_data *)(cbxbuf.lb_buf));
                        if (likely(rc > 0)) {
-                               xbuf.lb_len = rc;
+                               cbxbuf.lb_len = rc;
                                goto repeat;
                        }
                }
@@ -3648,7 +3722,7 @@ static int mdd_update_link(const struct lu_env *env,
                RETURN(-ENOENT);
        }
 
-       mdd_write_lock(env, pobj, MOR_TGT_PARENT);
+       mdd_write_lock(env, pobj, DT_TGT_PARENT);
        rc = __mdd_index_delete_only(env, pobj, lname->ln_name, handle);
        if (!rc)
                rc = __mdd_index_insert_only(env, pobj, mdo2fid(tobj),
@@ -3659,13 +3733,13 @@ static int mdd_update_link(const struct lu_env *env,
        if (rc)
                RETURN(rc);
 
-       mdd_write_lock(env, tobj, MOR_TGT_CHILD);
+       mdd_write_lock(env, tobj, DT_TGT_CHILD);
        rc = mdo_ref_add(env, tobj, handle);
        mdd_write_unlock(env, tobj);
        if (rc)
                RETURN(rc);
 
-       mdd_write_lock(env, sobj, MOR_SRC_CHILD);
+       mdd_write_lock(env, sobj, DT_SRC_CHILD);
        rc = mdo_ref_del(env, sobj, handle);
        mdd_write_unlock(env, sobj);
 
@@ -3847,7 +3921,7 @@ static int mdd_dir_layout_delete(const struct lu_env *env,
 
        ENTRY;
 
-       mdd_write_lock(env, obj, MOR_SRC_PARENT);
+       mdd_write_lock(env, obj, DT_SRC_PARENT);
        if (!lmv_buf->lb_buf)
                /* normal dir */
                rc = __mdd_index_delete_only(env, obj, dotdot, handle);
@@ -3905,7 +3979,7 @@ static int mdd_declare_migrate_create(const struct lu_env *env,
 
        rc = mdd_declare_create(env, mdo2mdd(&tpobj->mod_obj), tpobj, tobj,
                                lname, attr, handle, spec, ldata, NULL, NULL,
-                               hint);
+                               NULL, hint);
        if (rc)
                return rc;
 
@@ -4053,7 +4127,7 @@ static int mdd_migrate_create(const struct lu_env *env,
                 * stripes again.
                 */
                if (sbuf->lb_buf) {
-                       mdd_write_lock(env, sobj, MOR_SRC_CHILD);
+                       mdd_write_lock(env, sobj, DT_SRC_CHILD);
                        rc = mdo_xattr_del(env, sobj, XATTR_NAME_LMV, handle);
                        mdd_write_unlock(env, sobj);
                        if (rc)
@@ -4064,12 +4138,12 @@ static int mdd_migrate_create(const struct lu_env *env,
        /* don't set nlink from sobj */
        attr->la_valid &= ~LA_NLINK;
 
-       rc = mdd_create_object(env, tpobj, tobj, attr, spec, NULL, NULL, hint,
-                               handle);
+       rc = mdd_create_object(env, tpobj, tobj, attr, spec, NULL, NULL, NULL,
+                              hint, handle);
        if (rc)
                RETURN(rc);
 
-       mdd_write_lock(env, tobj, MOR_TGT_CHILD);
+       mdd_write_lock(env, tobj, DT_TGT_CHILD);
        rc = mdd_iterate_xattrs(env, sobj, tobj, true, handle, mdo_xattr_set);
        mdd_write_unlock(env, tobj);
        if (rc)
@@ -4088,7 +4162,7 @@ static int mdd_migrate_create(const struct lu_env *env,
                        RETURN(rc);
 
                /* delete LOV to avoid deleting OST objs when destroying sobj */
-               mdd_write_lock(env, sobj, MOR_SRC_CHILD);
+               mdd_write_lock(env, sobj, DT_SRC_CHILD);
                rc = mdo_xattr_del(env, sobj, XATTR_NAME_LOV, handle);
                mdd_write_unlock(env, sobj);
                if (rc)
@@ -4217,7 +4291,7 @@ static int mdd_migrate_update(const struct lu_env *env,
 
        la->la_ctime = la->la_mtime = ma->ma_attr.la_ctime;
        la->la_valid = LA_CTIME | LA_MTIME;
-       mdd_write_lock(env, spobj, MOR_SRC_PARENT);
+       mdd_write_lock(env, spobj, DT_SRC_PARENT);
        rc = mdd_update_time(env, spobj, spattr, la, handle);
        mdd_write_unlock(env, spobj);
        if (rc)
@@ -4225,7 +4299,7 @@ static int mdd_migrate_update(const struct lu_env *env,
 
        if (tpobj != spobj) {
                la->la_valid = LA_CTIME | LA_MTIME;
-               mdd_write_lock(env, tpobj, MOR_TGT_PARENT);
+               mdd_write_lock(env, tpobj, DT_TGT_PARENT);
                rc = mdd_update_time(env, tpobj, tpattr, la, handle);
                mdd_write_unlock(env, tpobj);
                if (rc)
@@ -4250,7 +4324,7 @@ static int mdd_migrate_update(const struct lu_env *env,
         *  message, this won't cause any inconsistency or trouble.
         */
        if (do_create && do_destroy) {
-               mdd_write_lock(env, sobj, MOR_SRC_CHILD);
+               mdd_write_lock(env, sobj, DT_SRC_CHILD);
                mdo_ref_del(env, sobj, handle);
                rc = mdo_destroy(env, sobj, handle);
                mdd_write_unlock(env, sobj);
@@ -4695,7 +4769,7 @@ static int __mdd_dir_layout_shrink(const struct lu_env *env,
                lmu->lum_stripe_count = cpu_to_le32(1);
 
                /* delete LMV to avoid deleting stripes again upon destroy */
-               mdd_write_lock(env, obj, MOR_SRC_CHILD);
+               mdd_write_lock(env, obj, DT_SRC_CHILD);
                rc = mdo_xattr_del(env, obj, XATTR_NAME_LMV, handle);
                mdd_write_unlock(env, obj);
                if (rc)
@@ -4703,7 +4777,7 @@ static int __mdd_dir_layout_shrink(const struct lu_env *env,
        }
 
        /* destroy stripes after lmu_stripe_count */
-       mdd_write_lock(env, obj, MOR_SRC_PARENT);
+       mdd_write_lock(env, obj, DT_SRC_PARENT);
        rc = mdd_dir_iterate_stripes(env, obj, lmv_buf, &shrink_buf, handle,
                                     mdd_dir_destroy_stripe);
        mdd_write_unlock(env, obj);
@@ -4727,8 +4801,8 @@ static int __mdd_dir_layout_shrink(const struct lu_env *env,
        LASSERT(pobj);
        LASSERT(stripe);
 
-       mdd_write_lock(env, pobj, MOR_SRC_PARENT);
-       mdd_write_lock(env, obj, MOR_SRC_CHILD);
+       mdd_write_lock(env, pobj, DT_SRC_PARENT);
+       mdd_write_lock(env, obj, DT_SRC_CHILD);
 
        /* insert dotdot to stripe which points to parent */
        rc = __mdd_index_insert_only(env, stripe, mdo2fid(pobj), S_IFDIR,