Whamcloud - gitweb
LU-5287 export: hold exp_lock when modify exp_flags
[fs/lustre-release.git] / lustre / mdt / mdt_handler.c
index f64795f..f244e61 100644 (file)
@@ -683,13 +683,17 @@ int mdt_attr_get_complex(struct mdt_thread_info *info,
        const struct lu_env *env = info->mti_env;
        struct md_object    *next = mdt_object_child(o);
        struct lu_buf       *buf = &info->mti_buf;
-       u32                  mode = lu_object_attr(&next->mo_lu);
        int                  need = ma->ma_need;
        int                  rc = 0, rc2;
+       u32                  mode;
        ENTRY;
 
        ma->ma_valid = 0;
 
+       if (mdt_object_exists(o) == 0)
+               GOTO(out, rc = -ENOENT);
+       mode = lu_object_attr(&next->mo_lu);
+
        if (need & MA_INODE) {
                ma->ma_need = MA_INODE;
                rc = mo_attr_get(env, next, ma);
@@ -1126,7 +1130,7 @@ static int mdt_getattr(struct tgt_session_info *tsi)
        }
 
        if (rc < 0)
-               GOTO(out_shrink, rc);
+               GOTO(out, rc = err_serious(rc));
 
        req_capsule_set_size(pill, &RMF_MDT_MD, RCL_SERVER, rc);
 
@@ -1191,7 +1195,7 @@ static int mdt_swap_layouts(struct tgt_session_info *tsi)
        info = tsi2mdt_info(tsi);
 
        if (info->mti_dlm_req != NULL)
-               ldlm_request_cancel(req, info->mti_dlm_req, 0);
+               ldlm_request_cancel(req, info->mti_dlm_req, 0, LATF_SKIP);
 
        if (req_capsule_get_size(info->mti_pill, &RMF_CAPA1, RCL_CLIENT))
                mdt_set_capainfo(info, 0, &info->mti_body->mbo_fid1,
@@ -1319,7 +1323,6 @@ static int mdt_getattr_name_lock(struct mdt_thread_info *info,
         struct mdt_body        *reqbody   = NULL;
         struct mdt_object      *parent    = info->mti_object;
         struct mdt_object      *child;
-        struct md_object       *next      = mdt_object_child(parent);
         struct lu_fid          *child_fid = &info->mti_tmp_fid1;
         struct lu_name         *lname     = NULL;
         struct mdt_lock_handle *lhp       = NULL;
@@ -1334,7 +1337,8 @@ static int mdt_getattr_name_lock(struct mdt_thread_info *info,
        LASSERT(ergo(is_resent,
                     lustre_msg_get_flags(req->rq_reqmsg) & MSG_RESENT));
 
-       LASSERT(parent != NULL);
+       if (parent == NULL)
+               RETURN(-ENOENT);
 
        if (info->mti_cross_ref) {
                /* Only getattr on the child. Parent is on another node. */
@@ -1347,7 +1351,7 @@ static int mdt_getattr_name_lock(struct mdt_thread_info *info,
 
                rc = mdt_check_resent_lock(info, child, lhc);
                if (rc < 0) {
-                       RETURN(-EPROTO);
+                       RETURN(rc);
                } else if (rc > 0) {
                        mdt_lock_handle_init(lhc);
                        mdt_lock_reg_init(lhc, LCK_PR);
@@ -1443,8 +1447,8 @@ static int mdt_getattr_name_lock(struct mdt_thread_info *info,
 
                 /* step 2: lookup child's fid by name */
                 fid_zero(child_fid);
-                rc = mdo_lookup(info->mti_env, next, lname, child_fid,
-                                &info->mti_spec);
+               rc = mdo_lookup(info->mti_env, mdt_object_child(parent), lname,
+                               child_fid, &info->mti_spec);
                if (rc == -ENOENT)
                        mdt_set_disposition(info, ldlm_rep, DISP_LOOKUP_NEG);
 
@@ -1899,19 +1903,20 @@ static int mdt_device_sync(const struct lu_env *env, struct mdt_device *mdt)
 /* this should sync this object */
 static int mdt_object_sync(struct mdt_thread_info *info)
 {
-        struct md_object *next;
-        int rc;
-        ENTRY;
+       struct md_object *next;
+       int rc;
+       ENTRY;
 
-        if (!mdt_object_exists(info->mti_object)) {
-                CWARN("Non existing object  "DFID"!\n",
-                      PFID(mdt_object_fid(info->mti_object)));
-                RETURN(-ESTALE);
-        }
-        next = mdt_object_child(info->mti_object);
-        rc = mo_object_sync(info->mti_env, next);
+       if (!mdt_object_exists(info->mti_object)) {
+               CWARN("%s: non existing object "DFID": rc = %d\n",
+                     mdt_obd_name(info->mti_mdt),
+                     PFID(mdt_object_fid(info->mti_object)), -ESTALE);
+               RETURN(-ESTALE);
+       }
+       next = mdt_object_child(info->mti_object);
+       rc = mo_object_sync(info->mti_env, next);
 
-        RETURN(rc);
+       RETURN(rc);
 }
 
 static int mdt_sync(struct tgt_session_info *tsi)
@@ -2195,12 +2200,13 @@ struct mdt_object *mdt_object_find(const struct lu_env *env,
 static void mdt_device_commit_async(const struct lu_env *env,
                                     struct mdt_device *mdt)
 {
-        struct dt_device *dt = mdt->mdt_bottom;
-        int rc;
+       struct dt_device *dt = mdt->mdt_bottom;
+       int rc;
 
-        rc = dt->dd_ops->dt_commit_async(env, dt);
-        if (unlikely(rc != 0))
-                CWARN("async commit start failed with rc = %d", rc);
+       rc = dt->dd_ops->dt_commit_async(env, dt);
+       if (unlikely(rc != 0))
+               CWARN("%s: async commit start failed: rc = %d\n",
+                     mdt_obd_name(mdt), rc);
 }
 
 /**
@@ -2275,10 +2281,11 @@ int mdt_blocking_ast(struct ldlm_lock *lock, struct ldlm_lock_desc *desc,
         if (lock->l_req_mode == LCK_COS && lock->l_blocking_lock != NULL) {
                 struct lu_env env;
 
-                rc = lu_env_init(&env, LCT_LOCAL);
-                if (unlikely(rc != 0))
-                        CWARN("lu_env initialization failed with rc = %d,"
-                              "cannot start asynchronous commit\n", rc);
+               rc = lu_env_init(&env, LCT_LOCAL);
+               if (unlikely(rc != 0))
+                       CWARN("%s: lu_env initialization failed, cannot "
+                             "start asynchronous commit: rc = %d\n",
+                             obd->obd_name, rc);
                 else
                         mdt_device_commit_async(&env, mdt);
                 lu_env_fini(&env);
@@ -2322,8 +2329,14 @@ int mdt_check_resent_lock(struct mdt_thread_info *info,
 
                lock = ldlm_handle2lock(&lhc->mlh_reg_lh);
                LASSERT(lustre_msg_get_flags(req->rq_reqmsg) & MSG_RESENT);
-               LASSERTF(lock != NULL, "Invalid lock handle "LPX64"\n",
-                        lhc->mlh_reg_lh.cookie);
+               if (lock == NULL) {
+                       /* Lock is pinned by ldlm_handle_enqueue0() as it is
+                        * a resend case, however, it could be already destroyed
+                        * due to client eviction or a raced cancel RPC. */
+                       LDLM_DEBUG_NOLOCK("Invalid lock handle "LPX64"\n",
+                                         lhc->mlh_reg_lh.cookie);
+                       RETURN(-ESTALE);
+               }
 
                if (!fid_res_name_eq(mdt_object_fid(mo),
                                     &lock->l_resource->lr_name)) {
@@ -2431,8 +2444,8 @@ static int mdt_object_local_lock(struct mdt_thread_info *info,
                                          policy, res_id, dlmflags,
                                          info->mti_exp == NULL ? NULL :
                                          &info->mti_exp->exp_handle.h_cookie);
-                        if (unlikely(rc))
-                                RETURN(rc);
+                       if (unlikely(rc != 0))
+                               GOTO(out_unlock, rc);
                 }
 
                 /*
@@ -2453,15 +2466,15 @@ static int mdt_object_local_lock(struct mdt_thread_info *info,
                          res_id, LDLM_FL_LOCAL_ONLY | dlmflags,
                          info->mti_exp == NULL ? NULL :
                          &info->mti_exp->exp_handle.h_cookie);
-        if (rc)
-                mdt_object_unlock(info, o, lh, 1);
-        else if (unlikely(OBD_FAIL_PRECHECK(OBD_FAIL_MDS_PDO_LOCK)) &&
-                 lh->mlh_pdo_hash != 0 &&
-                 (lh->mlh_reg_mode == LCK_PW || lh->mlh_reg_mode == LCK_EX)) {
-                OBD_FAIL_TIMEOUT(OBD_FAIL_MDS_PDO_LOCK, 15);
-        }
+out_unlock:
+       if (rc != 0)
+               mdt_object_unlock(info, o, lh, 1);
+       else if (unlikely(OBD_FAIL_PRECHECK(OBD_FAIL_MDS_PDO_LOCK)) &&
+                  lh->mlh_pdo_hash != 0 &&
+                  (lh->mlh_reg_mode == LCK_PW || lh->mlh_reg_mode == LCK_EX))
+               OBD_FAIL_TIMEOUT(OBD_FAIL_MDS_PDO_LOCK, 15);
 
-        RETURN(rc);
+       RETURN(rc);
 }
 
 static int
@@ -2875,6 +2888,11 @@ static int mdt_tgt_connect(struct tgt_session_info *tsi)
 
        ENTRY;
 
+       if (OBD_FAIL_CHECK(OBD_FAIL_TGT_DELAY_CONDITIONAL) &&
+           cfs_fail_val ==
+           tsi2mdt_info(tsi)->mti_mdt->mdt_seq_site.ss_node_id)
+               schedule_timeout_and_set_state(TASK_UNINTERRUPTIBLE, HZ * 3);
+
        rc = tgt_connect(tsi);
        if (rc != 0)
                RETURN(rc);
@@ -3336,7 +3354,7 @@ static int mdt_intent_reint(enum mdt_it_code opcode,
 
        /* the open lock or the lock for cross-ref object should be
         * returned to the client */
-       if (rc == -EREMOTE || mdt_get_disposition(rep, DISP_OPEN_LOCK)) {
+       if (rc == -MDT_EREMOTE_OPEN || mdt_get_disposition(rep, DISP_OPEN_LOCK)) {
                LASSERT(lustre_handle_is_used(&lhc->mlh_reg_lh));
                rep->lock_policy_res2 = 0;
                rc = mdt_intent_lock_replace(info, lockp, lhc, flags);
@@ -3431,17 +3449,16 @@ static int mdt_intent_code(long itcode)
 static int mdt_intent_opc(long itopc, struct mdt_thread_info *info,
                          struct ldlm_lock **lockp, __u64 flags)
 {
-        struct req_capsule   *pill;
-        struct mdt_it_flavor *flv;
-        int opc;
-        int rc;
-        ENTRY;
-
-        opc = mdt_intent_code(itopc);
-        if (opc < 0)
-                RETURN(-EINVAL);
+       struct req_capsule      *pill = info->mti_pill;
+       struct ptlrpc_request   *req = mdt_info_req(info);
+       struct mdt_it_flavor    *flv;
+       int opc;
+       int rc;
+       ENTRY;
 
-        pill = info->mti_pill;
+       opc = mdt_intent_code(itopc);
+       if (opc < 0)
+               RETURN(-EINVAL);
 
        if (opc == MDT_IT_QUOTA) {
                struct lu_device *qmt = info->mti_mdt->mdt_qmt_dev;
@@ -3457,33 +3474,33 @@ static int mdt_intent_opc(long itopc, struct mdt_thread_info *info,
                RETURN(rc);
        }
 
-       flv  = &mdt_it_flavor[opc];
-        if (flv->it_fmt != NULL)
-                req_capsule_extend(pill, flv->it_fmt);
+       flv = &mdt_it_flavor[opc];
+       if (flv->it_fmt != NULL)
+               req_capsule_extend(pill, flv->it_fmt);
 
-        rc = mdt_unpack_req_pack_rep(info, flv->it_flags);
-        if (rc == 0) {
-                struct ptlrpc_request *req = mdt_info_req(info);
-               if (flv->it_flags & MUTABOR &&
-                   exp_connect_flags(req->rq_export) & OBD_CONNECT_RDONLY)
-                       RETURN(-EROFS);
-        }
-        if (rc == 0 && flv->it_act != NULL) {
+       rc = mdt_unpack_req_pack_rep(info, flv->it_flags);
+       if (rc < 0)
+               RETURN(rc);
+
+       if (flv->it_flags & MUTABOR &&
+           exp_connect_flags(req->rq_export) & OBD_CONNECT_RDONLY)
+               RETURN(-EROFS);
+
+       if (flv->it_act != NULL) {
                struct ldlm_reply *rep;
 
                /* execute policy */
                rc = flv->it_act(opc, info, lockp, flags);
 
                /* Check whether the reply has been packed successfully. */
-               if (mdt_info_req(info)->rq_repmsg != NULL) {
+               if (req->rq_repmsg != NULL) {
                        rep = req_capsule_server_get(info->mti_pill,
                                                     &RMF_DLM_REP);
                        rep->lock_policy_res2 =
                                ptlrpc_status_hton(rep->lock_policy_res2);
                }
-       } else {
-               rc = -EPROTO;
        }
+
        RETURN(rc);
 }
 
@@ -3807,7 +3824,7 @@ static void mdt_stack_pre_fini(const struct lu_env *env,
        lustre_cfg_bufs_set_string(bufs, 1, NULL);
        lcfg = lustre_cfg_new(LCFG_PRE_CLEANUP, bufs);
        if (!lcfg) {
-               CERROR("%s:Cannot alloc lcfg!\n", mdt_obd_name(m));
+               CERROR("%s: cannot alloc lcfg\n", mdt_obd_name(m));
                return;
        }
        top->ld_ops->ldo_process_config(env, top, lcfg);
@@ -3980,7 +3997,7 @@ static int mdt_stack_init(const struct lu_env *env, struct mdt_device *mdt,
        if (!obd) {
                CERROR("Can not find obd %s (%s in config)\n",
                       MDD_OBD_NAME, lustre_cfg_string(cfg, 0));
-               GOTO(class_detach, rc = -EINVAL);
+               GOTO(lcfg_cleanup, rc = -EINVAL);
        }
 
        lustre_cfg_free(lcfg);
@@ -4108,7 +4125,7 @@ static int mdt_quota_init(const struct lu_env *env, struct mdt_device *mdt,
        if (!obd) {
                CERROR("Can not find obd %s (%s in config)\n", qmtname,
                       lustre_cfg_string(cfg, 0));
-               GOTO(class_detach, rc = -EINVAL);
+               GOTO(lcfg_cleanup, rc = -EINVAL);
        }
 
        lustre_cfg_free(lcfg);
@@ -4682,13 +4699,13 @@ static int mdt_process_config(const struct lu_env *env,
                        }
                }
 
-               rc = class_process_proc_seq_param(PARAM_MDT, obd->obd_vars,
-                                                       cfg, obd);
+               rc = class_process_proc_param(PARAM_MDT, obd->obd_vars,
+                                             cfg, obd);
                if (rc > 0 || rc == -ENOSYS) {
                        /* is it an HSM var ? */
-                       rc = class_process_proc_seq_param(PARAM_HSM,
-                                                       hsm_cdt_get_proc_vars(),
-                                                       cfg, obd);
+                       rc = class_process_proc_param(PARAM_HSM,
+                                                     hsm_cdt_get_proc_vars(),
+                                                     cfg, obd);
                        if (rc > 0 || rc == -ENOSYS)
                                /* we don't understand; pass it on */
                                rc = next->ld_ops->ldo_process_config(env, next,
@@ -4898,12 +4915,14 @@ static int mdt_connect_internal(struct obd_export *exp,
        data->ocd_connect_flags &= MDT_CONNECT_SUPPORTED;
        data->ocd_ibits_known &= MDS_INODELOCK_FULL;
 
-       /* If no known bits (which should not happen, probably,
-          as everybody should support LOOKUP and UPDATE bits at least)
-          revert to compat mode with plain locks. */
-       if (!data->ocd_ibits_known &&
-           data->ocd_connect_flags & OBD_CONNECT_IBITS)
-               data->ocd_connect_flags &= ~OBD_CONNECT_IBITS;
+       if (!(data->ocd_connect_flags & OBD_CONNECT_MDS_MDS) &&
+           !(data->ocd_connect_flags & OBD_CONNECT_IBITS)) {
+               CWARN("%s: client %s does not support ibits lock, either "
+                     "very old or an invalid client: flags "LPX64"\n",
+                     mdt_obd_name(mdt), exp->exp_client_uuid.uuid,
+                     data->ocd_connect_flags);
+               return -EBADE;
+       }
 
        if (!mdt->mdt_opts.mo_acl)
                data->ocd_connect_flags &= ~OBD_CONNECT_ACL;
@@ -5027,7 +5046,9 @@ static int mdt_obd_connect(const struct lu_env *env,
                         mdt_export_stats_init(obd, lexp, localdata);
 
                /* For phase I, sync for cross-ref operation. */
+               spin_lock(&lexp->exp_lock);
                lexp->exp_keep_sync = 1;
+               spin_unlock(&lexp->exp_lock);
         }
 
         if (rc != 0) {
@@ -5086,25 +5107,26 @@ static int mdt_ctxt_add_dirty_flag(struct lu_env *env,
 
 static int mdt_export_cleanup(struct obd_export *exp)
 {
-        struct mdt_export_data *med = &exp->exp_mdt_data;
-        struct obd_device      *obd = exp->exp_obd;
-        struct mdt_device      *mdt;
-        struct mdt_thread_info *info;
-        struct lu_env           env;
-        CFS_LIST_HEAD(closing_list);
-        struct mdt_file_data *mfd, *n;
-        int rc = 0;
-        ENTRY;
+       struct list_head         closing_list;
+       struct mdt_export_data  *med = &exp->exp_mdt_data;
+       struct obd_device       *obd = exp->exp_obd;
+       struct mdt_device       *mdt;
+       struct mdt_thread_info  *info;
+       struct lu_env            env;
+       struct mdt_file_data    *mfd, *n;
+       int rc = 0;
+       ENTRY;
 
+       INIT_LIST_HEAD(&closing_list);
        spin_lock(&med->med_open_lock);
-       while (!cfs_list_empty(&med->med_open_head)) {
-               cfs_list_t *tmp = med->med_open_head.next;
-               mfd = cfs_list_entry(tmp, struct mdt_file_data, mfd_list);
+       while (!list_empty(&med->med_open_head)) {
+               struct list_head *tmp = med->med_open_head.next;
+               mfd = list_entry(tmp, struct mdt_file_data, mfd_list);
 
                /* Remove mfd handle so it can't be found again.
                 * We are consuming the mfd_list reference here. */
                class_handle_unhash(&mfd->mfd_handle);
-               cfs_list_move_tail(&mfd->mfd_list, &closing_list);
+               list_move_tail(&mfd->mfd_list, &closing_list);
        }
        spin_unlock(&med->med_open_lock);
         mdt = mdt_dev(obd->obd_lu_dev);
@@ -5121,12 +5143,13 @@ static int mdt_export_cleanup(struct obd_export *exp)
         info->mti_mdt = mdt;
         info->mti_exp = exp;
 
-        if (!cfs_list_empty(&closing_list)) {
-                struct md_attr *ma = &info->mti_attr;
+       if (!list_empty(&closing_list)) {
+               struct md_attr *ma = &info->mti_attr;
 
-                /* Close any open files (which may also cause orphan unlinking). */
-                cfs_list_for_each_entry_safe(mfd, n, &closing_list, mfd_list) {
-                        cfs_list_del_init(&mfd->mfd_list);
+               /* Close any open files (which may also cause orphan
+                * unlinking). */
+               list_for_each_entry_safe(mfd, n, &closing_list, mfd_list) {
+                       list_del_init(&mfd->mfd_list);
                        ma->ma_need = ma->ma_valid = 0;
 
                        /* This file is being closed due to an eviction, it
@@ -5172,23 +5195,23 @@ static int mdt_obd_disconnect(struct obd_export *exp)
         LASSERT(exp);
         class_export_get(exp);
 
-        rc = server_disconnect_export(exp);
-        if (rc != 0)
-                CDEBUG(D_IOCTL, "server disconnect error: %d\n", rc);
+       rc = server_disconnect_export(exp);
+       if (rc != 0)
+               CDEBUG(D_IOCTL, "server disconnect error: rc = %d\n", rc);
 
-        rc = mdt_export_cleanup(exp);
-        class_export_put(exp);
-        RETURN(rc);
+       rc = mdt_export_cleanup(exp);
+       class_export_put(exp);
+       RETURN(rc);
 }
 
 /* FIXME: Can we avoid using these two interfaces? */
 static int mdt_init_export(struct obd_export *exp)
 {
-        struct mdt_export_data *med = &exp->exp_mdt_data;
-        int                     rc;
-        ENTRY;
+       struct mdt_export_data *med = &exp->exp_mdt_data;
+       int                     rc;
+       ENTRY;
 
-        CFS_INIT_LIST_HEAD(&med->med_open_head);
+       INIT_LIST_HEAD(&med->med_open_head);
        spin_lock_init(&med->med_open_lock);
        mutex_init(&med->med_idmap_mutex);
        med->med_idmap = NULL;
@@ -5233,13 +5256,13 @@ static int mdt_destroy_export(struct obd_export *exp)
                                      &exp->exp_client_uuid)))
                 RETURN(0);
 
-        ldlm_destroy_export(exp);
-        tgt_client_free(exp);
+       ldlm_destroy_export(exp);
+       tgt_client_free(exp);
 
-        LASSERT(cfs_list_empty(&exp->exp_outstanding_replies));
-        LASSERT(cfs_list_empty(&exp->exp_mdt_data.med_open_head));
+       LASSERT(list_empty(&exp->exp_outstanding_replies));
+       LASSERT(list_empty(&exp->exp_mdt_data.med_open_head));
 
-        RETURN(0);
+       RETURN(0);
 }
 
 /** The maximum depth that fid2path() will search.
@@ -5491,7 +5514,7 @@ static int mdt_fid2path(struct mdt_thread_info *info,
 
        if (rc < 0) {
                mdt_object_put(info->mti_env, obj);
-               CDEBUG(D_IOCTL, "nonlocal object "DFID": %d\n",
+               CDEBUG(D_IOCTL, "nonlocal object "DFID": rc = %d\n",
                       PFID(&fp->gf_fid), rc);
                RETURN(rc);
        }
@@ -5539,7 +5562,7 @@ int mdt_get_info(struct tgt_session_info *tsi)
 
        key = req_capsule_client_get(tsi->tsi_pill, &RMF_GETINFO_KEY);
        if (key == NULL) {
-               CDEBUG(D_IOCTL, "No GETINFO key");
+               CDEBUG(D_IOCTL, "No GETINFO key\n");
                RETURN(err_serious(-EFAULT));
        }
        keylen = req_capsule_get_size(tsi->tsi_pill, &RMF_GETINFO_KEY,
@@ -5547,7 +5570,8 @@ int mdt_get_info(struct tgt_session_info *tsi)
 
        vallen = req_capsule_client_get(tsi->tsi_pill, &RMF_GETINFO_VALLEN);
        if (vallen == NULL) {
-               CDEBUG(D_IOCTL, "Unable to get RMF_GETINFO_VALLEN buffer");
+               CDEBUG(D_IOCTL, "%s: cannot get RMF_GETINFO_VALLEN buffer\n",
+                               tgt_name(tsi->tsi_tgt));
                RETURN(err_serious(-EFAULT));
        }
 
@@ -5559,7 +5583,8 @@ int mdt_get_info(struct tgt_session_info *tsi)
 
        valout = req_capsule_server_get(tsi->tsi_pill, &RMF_GETINFO_VAL);
        if (valout == NULL) {
-               CDEBUG(D_IOCTL, "Unable to get get-info RPC out buffer");
+               CDEBUG(D_IOCTL, "%s: cannot get get-info RPC out buffer\n",
+                               tgt_name(tsi->tsi_tgt));
                RETURN(err_serious(-EFAULT));
        }
 
@@ -5873,13 +5898,13 @@ void mdt_enable_cos(struct mdt_device *mdt, int val)
 
         mdt->mdt_opts.mo_cos = !!val;
         rc = lu_env_init(&env, LCT_LOCAL);
-        if (unlikely(rc != 0)) {
-                CWARN("lu_env initialization failed with rc = %d,"
-                      "cannot sync\n", rc);
-                return;
-        }
-        mdt_device_sync(&env, mdt);
-        lu_env_fini(&env);
+       if (unlikely(rc != 0)) {
+               CWARN("%s: lu_env initialization failed, cannot "
+                     "sync: rc = %d\n", mdt_obd_name(mdt), rc);
+               return;
+       }
+       mdt_device_sync(&env, mdt);
+       lu_env_fini(&env);
 }
 
 /**
@@ -5924,9 +5949,6 @@ static int __init mdt_mod_init(void)
                GOTO(lu_fini, rc);
 
        rc = class_register_type(&mdt_obd_device_ops, NULL, true, NULL,
-#ifndef HAVE_ONLY_PROCFS_SEQ
-                                NULL,
-#endif
                                 LUSTRE_MDT_NAME, &mdt_device_type);
        if (rc)
                GOTO(mds_fini, rc);