Whamcloud - gitweb
LU-3105 osd: remove capa related stuff from servers
[fs/lustre-release.git] / lustre / mdt / mdt_handler.c
index a0af42e..5124770 100644 (file)
@@ -284,24 +284,6 @@ static int mdt_getstatus(struct tgt_session_info *tsi)
        repbody->mbo_fid1 = mdt->mdt_md_root_fid;
        repbody->mbo_valid |= OBD_MD_FLID;
 
-       if (tsi->tsi_tgt->lut_mds_capa &&
-           exp_connect_flags(info->mti_exp) & OBD_CONNECT_MDS_CAPA) {
-               struct mdt_object       *root;
-               struct lustre_capa      *capa;
-
-               root = mdt_object_find(info->mti_env, mdt, &repbody->mbo_fid1);
-               if (IS_ERR(root))
-                       GOTO(out, rc = PTR_ERR(root));
-
-                capa = req_capsule_server_get(info->mti_pill, &RMF_CAPA1);
-                LASSERT(capa);
-                capa->lc_opc = CAPA_OPC_MDS_DEFAULT;
-                rc = mo_capa_get(info->mti_env, mdt_object_child(root), capa,
-                                 0);
-                mdt_object_put(info->mti_env, root);
-                if (rc == 0)
-                       repbody->mbo_valid |= OBD_MD_FLMDSCAPA;
-        }
        EXIT;
 out:
        mdt_thread_info_fini(info);
@@ -1047,20 +1029,6 @@ static int mdt_getattr_internal(struct mdt_thread_info *info,
                rc = mdt_pack_acl2body(info, repbody, o, nodemap);
 #endif
 
-       if (reqbody->mbo_valid & OBD_MD_FLMDSCAPA &&
-           info->mti_mdt->mdt_lut.lut_mds_capa &&
-           exp_connect_flags(info->mti_exp) & OBD_CONNECT_MDS_CAPA) {
-                struct lustre_capa *capa;
-
-                capa = req_capsule_server_get(pill, &RMF_CAPA1);
-                LASSERT(capa);
-                capa->lc_opc = CAPA_OPC_MDS_DEFAULT;
-                rc = mo_capa_get(env, next, capa, 0);
-                if (rc)
-                        RETURN(rc);
-               repbody->mbo_valid |= OBD_MD_FLMDSCAPA;
-        }
-
 out:
         if (rc == 0)
                mdt_counter_incr(req, LPROC_MDT_GETATTR);
@@ -1068,38 +1036,6 @@ out:
         RETURN(rc);
 }
 
-static int mdt_renew_capa(struct mdt_thread_info *info)
-{
-        struct mdt_object  *obj = info->mti_object;
-        struct mdt_body    *body;
-        struct lustre_capa *capa, *c;
-        int rc;
-        ENTRY;
-
-        /* if object doesn't exist, or server has disabled capability,
-         * return directly, client will find body->valid OBD_MD_FLOSSCAPA
-         * flag not set.
-         */
-       if (!obj || !info->mti_mdt->mdt_lut.lut_oss_capa ||
-           !(exp_connect_flags(info->mti_exp) & OBD_CONNECT_OSS_CAPA))
-               RETURN(0);
-
-        body = req_capsule_server_get(info->mti_pill, &RMF_MDT_BODY);
-        LASSERT(body != NULL);
-
-        c = req_capsule_client_get(info->mti_pill, &RMF_CAPA1);
-        LASSERT(c);
-
-        capa = req_capsule_server_get(info->mti_pill, &RMF_CAPA2);
-        LASSERT(capa);
-
-        *capa = *c;
-        rc = mo_capa_get(info->mti_env, mdt_object_child(obj), capa, 1);
-        if (rc == 0)
-               body->mbo_valid |= OBD_MD_FLOSSCAPA;
-        RETURN(rc);
-}
-
 static int mdt_getattr(struct tgt_session_info *tsi)
 {
        struct mdt_thread_info  *info = tsi2mdt_info(tsi);
@@ -1112,15 +1048,6 @@ static int mdt_getattr(struct tgt_session_info *tsi)
 
         reqbody = req_capsule_client_get(pill, &RMF_MDT_BODY);
         LASSERT(reqbody);
-
-       if (reqbody->mbo_valid & OBD_MD_FLOSSCAPA) {
-                rc = req_capsule_server_pack(pill);
-                if (unlikely(rc))
-                        RETURN(err_serious(rc));
-                rc = mdt_renew_capa(info);
-                GOTO(out_shrink, rc);
-        }
-
         LASSERT(obj != NULL);
        LASSERT(lu_object_assert_exists(&obj->mot_obj));
 
@@ -1173,11 +1100,6 @@ static int mdt_getattr(struct tgt_session_info *tsi)
 
        info->mti_cross_ref = !!(reqbody->mbo_valid & OBD_MD_FLCROSSREF);
 
-       /*
-        * Don't check capability at all, because rename might getattr for
-        * remote obj, and at that time no capability is available.
-        */
-       mdt_set_capainfo(info, 1, &reqbody->mbo_fid1, BYPASS_CAPA);
        rc = mdt_getattr_internal(info, obj, 0);
        if (reqbody->mbo_valid & OBD_MD_FLRMTPERM)
                 mdt_exit_ucred(info);
@@ -1244,16 +1166,6 @@ static int mdt_swap_layouts(struct tgt_session_info *tsi)
        if (info->mti_dlm_req != NULL)
                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,
-                                req_capsule_client_get(info->mti_pill,
-                                                       &RMF_CAPA1));
-
-       if (req_capsule_get_size(info->mti_pill, &RMF_CAPA2, RCL_CLIENT))
-               mdt_set_capainfo(info, 1, &info->mti_body->mbo_fid2,
-                                req_capsule_client_get(info->mti_pill,
-                                                       &RMF_CAPA2));
-
        o1 = info->mti_object;
        o = o2 = mdt_object_find(info->mti_env, info->mti_mdt,
                                &info->mti_body->mbo_fid2);
@@ -1419,7 +1331,6 @@ static int mdt_getattr_name_lock(struct mdt_thread_info *info,
                        RETURN(-ENOENT);
                }
 
-               mdt_set_capainfo(info, 0, mdt_object_fid(child), BYPASS_CAPA);
                rc = mdt_getattr_internal(info, child, 0);
                if (unlikely(rc != 0))
                        mdt_object_unlock(info, child, lhc, 1);
@@ -1601,7 +1512,6 @@ static int mdt_getattr_name_lock(struct mdt_thread_info *info,
         lock = ldlm_handle2lock(&lhc->mlh_reg_lh);
 
         /* finally, we can get attr for child. */
-        mdt_set_capainfo(info, 1, child_fid, BYPASS_CAPA);
         rc = mdt_getattr_internal(info, child, ma_need);
         if (unlikely(rc != 0)) {
                 mdt_object_unlock(info, child, lhc, 1);
@@ -2752,27 +2662,11 @@ static int mdt_body_unpack(struct mdt_thread_info *info, __u32 flags)
                 RETURN(-EINVAL);
         }
 
-        /*
-         * Do not get size or any capa fields before we check that request
-         * contains capa actually. There are some requests which do not, for
-         * instance MDS_IS_SUBDIR.
-         */
-        if (req_capsule_has_field(pill, &RMF_CAPA1, RCL_CLIENT) &&
-            req_capsule_get_size(pill, &RMF_CAPA1, RCL_CLIENT))
-               mdt_set_capainfo(info, 0, &body->mbo_fid1,
-                                req_capsule_client_get(pill, &RMF_CAPA1));
-
        obj = mdt_object_find(env, info->mti_mdt, &body->mbo_fid1);
        if (!IS_ERR(obj)) {
-               if ((flags & HABEO_CORPUS) &&
-                   !mdt_object_exists(obj)) {
+               if ((flags & HABEO_CORPUS) && !mdt_object_exists(obj)) {
                        mdt_object_put(env, obj);
-                       /* for capability renew ENOENT will be handled in
-                        * mdt_renew_capa */
-                       if (body->mbo_valid & OBD_MD_FLOSSCAPA)
-                                rc = 0;
-                        else
-                                rc = -ENOENT;
+                       rc = -ENOENT;
                 } else {
                         info->mti_object = obj;
                         rc = 0;
@@ -2808,17 +2702,6 @@ static int mdt_unpack_req_pack_rep(struct mdt_thread_info *info, __u32 flags)
         RETURN(rc);
 }
 
-static int mdt_init_capa_ctxt(const struct lu_env *env, struct mdt_device *m)
-{
-       struct md_device *next = m->mdt_child;
-
-       return next->md_ops->mdo_init_capa_ctxt(env, next,
-                                               m->mdt_lut.lut_mds_capa,
-                                               m->mdt_capa_timeout,
-                                               m->mdt_capa_alg,
-                                               m->mdt_capa_keys);
-}
-
 void mdt_lock_handle_init(struct mdt_lock_handle *lh)
 {
         lh->mlh_type = MDT_NUL_LOCK;
@@ -2901,28 +2784,14 @@ void mdt_thread_info_fini(struct mdt_thread_info *info)
 struct mdt_thread_info *tsi2mdt_info(struct tgt_session_info *tsi)
 {
        struct mdt_thread_info  *mti;
-       struct lustre_capa      *lc;
 
        mti = mdt_th_info(tsi->tsi_env);
        LASSERT(mti != NULL);
 
        mdt_thread_info_init(tgt_ses_req(tsi), mti);
        if (tsi->tsi_corpus != NULL) {
-               struct req_capsule *pill = tsi->tsi_pill;
-
                mti->mti_object = mdt_obj(tsi->tsi_corpus);
                lu_object_get(tsi->tsi_corpus);
-
-               /*
-                * XXX: must be part of tgt_mdt_body_unpack but moved here
-                * due to mdt_set_capainfo().
-                */
-               if (req_capsule_has_field(pill, &RMF_CAPA1, RCL_CLIENT) &&
-                   req_capsule_get_size(pill, &RMF_CAPA1, RCL_CLIENT) > 0) {
-                       lc = req_capsule_client_get(pill, &RMF_CAPA1);
-                       mdt_set_capainfo(mti, 0, &tsi->tsi_mdt_body->mbo_fid1,
-                                        lc);
-               }
        }
        mti->mti_body = tsi->tsi_mdt_body;
        mti->mti_dlm_req = tsi->tsi_dlm_req;
@@ -4408,10 +4277,6 @@ static void mdt_fini(const struct lu_env *env, struct mdt_device *m)
         mdt_seq_fini(env, m);
         mdt_fld_fini(env, m);
 
-        next->md_ops->mdo_init_capa_ctxt(env, next, 0, 0, 0, NULL);
-        cfs_timer_disarm(&m->mdt_ck_timer);
-        mdt_ck_thread_stop(m);
-
        /*
         * Finish the stack
         */
@@ -4483,9 +4348,6 @@ static int mdt_init0(const struct lu_env *env, struct mdt_device *m,
                obd->u.obt.obt_magic = OBT_MAGIC;
        }
 
-        m->mdt_capa_timeout = CAPA_TIMEOUT;
-        m->mdt_capa_alg = CAPA_HMAC_ALG_SHA1;
-        m->mdt_ck_timeout = CAPA_KEY_TIMEOUT;
        m->mdt_squash.rsi_uid = 0;
        m->mdt_squash.rsi_gid = 0;
        INIT_LIST_HEAD(&m->mdt_squash.rsi_nosquash_nids);
@@ -4556,8 +4418,6 @@ static int mdt_init0(const struct lu_env *env, struct mdt_device *m,
         /* set obd_namespace for compatibility with old code */
         obd->obd_namespace = m->mdt_namespace;
 
-        cfs_timer_init(&m->mdt_ck_timer, mdt_ck_timer_callback, m);
-
        rc = mdt_hsm_cdt_init(m);
        if (rc != 0) {
                CERROR("%s: error initializing coordinator, rc %d\n",
@@ -4565,15 +4425,11 @@ static int mdt_init0(const struct lu_env *env, struct mdt_device *m,
                 GOTO(err_free_ns, rc);
        }
 
-        rc = mdt_ck_thread_start(m);
-        if (rc)
-                GOTO(err_free_hsm, rc);
-
        rc = tgt_init(env, &m->mdt_lut, obd, m->mdt_bottom, mdt_common_slice,
                      OBD_FAIL_MDS_ALL_REQUEST_NET,
                      OBD_FAIL_MDS_ALL_REPLY_NET);
        if (rc)
-               GOTO(err_capa, rc);
+               GOTO(err_free_hsm, rc);
 
        rc = mdt_fs_setup(env, m, obd, lsi);
        if (rc)
@@ -4635,8 +4491,6 @@ static int mdt_init0(const struct lu_env *env, struct mdt_device *m,
         * when the whole stack is complete and ready
         * to serve the requests */
 
-        mdt_init_capa_ctxt(env, m);
-
         /* Reduce the initial timeout on an MDS because it doesn't need such
          * a long timeout as an OST does. Adaptive timeouts will adjust this
          * value appropriately. */
@@ -4654,9 +4508,6 @@ err_fs_cleanup:
        mdt_fs_cleanup(env, m);
 err_tgt:
        tgt_fini(env, &m->mdt_lut);
-err_capa:
-       cfs_timer_disarm(&m->mdt_ck_timer);
-       mdt_ck_thread_stop(m);
 err_free_hsm:
        mdt_hsm_cdt_fini(m);
 err_free_ns: