Whamcloud - gitweb
fixed:
authorhuanghua <huanghua>
Wed, 12 Jul 2006 02:59:10 +0000 (02:59 +0000)
committerhuanghua <huanghua>
Wed, 12 Jul 2006 02:59:10 +0000 (02:59 +0000)
(1) in obd_setup(), cleanup lu_context after use;
(2) in mdt_init0(), move the temporary ns_name into mdt_thread_info to avoid
stack comsuption.

lustre/include/obd_class.h
lustre/mdt/mdt_handler.c
lustre/mdt/mdt_internal.h

index 5f6b113..cc7ce1f 100644 (file)
@@ -360,8 +360,9 @@ static inline int obd_setup(struct obd_device *obd, struct lustre_cfg *cfg)
                 rc = lu_context_init(&ctx);
                 if (rc == 0) {
                         lu_context_enter(&ctx);
-
                         d = ldt->ldt_ops->ldto_device_alloc(&ctx, ldt, cfg);
+                        lu_context_exit(&ctx);
+                        lu_context_fini(&ctx);
                         if (!IS_ERR(d)) {
                                 obd->obd_lu_dev = d;
                                 d->ld_obd = obd;
index f44898a..fd8dd34 100644 (file)
@@ -2098,14 +2098,17 @@ static void mdt_fini(const struct lu_context *ctx, struct mdt_device *m)
 static int mdt_init0(const struct lu_context *ctx, struct mdt_device *m,
                      struct lu_device_type *t, struct lustre_cfg *cfg)
 {
-        int rc;
-        struct lu_site *s;
-        char   ns_name[48];
-        const char *dev = lustre_cfg_string(cfg, 0);
-        const char *num = lustre_cfg_string(cfg, 2);
-        struct obd_device *obd;
+        struct mdt_thread_info *info;
+        struct obd_device      *obd;
+        const char             *dev = lustre_cfg_string(cfg, 0);
+        const char             *num = lustre_cfg_string(cfg, 2);
+        struct lu_site         *s;
+        int                     rc;
         ENTRY;
 
+        info = lu_context_key_get(ctx, &mdt_thread_key);
+        LASSERT(info != NULL);
+
         obd = class_name2obd(dev);
         
         spin_lock_init(&m->mdt_transno_lock);
@@ -2153,8 +2156,10 @@ static int mdt_init0(const struct lu_context *ctx, struct mdt_device *m,
         if (rc)
                 GOTO(err_fini_fld, rc);
 
-        snprintf(ns_name, sizeof ns_name, LUSTRE_MDT0_NAME"-%p", m);
-        m->mdt_namespace = ldlm_namespace_new(ns_name, LDLM_NAMESPACE_SERVER);
+        snprintf(info->mti_u.ns_name, sizeof info->mti_u.ns_name,
+                 LUSTRE_MDT0_NAME"-%p", m);
+        m->mdt_namespace = ldlm_namespace_new(info->mti_u.ns_name, 
+                                              LDLM_NAMESPACE_SERVER);
         if (m->mdt_namespace == NULL)
                 GOTO(err_fini_seq, rc = -ENOMEM);
 
index 32184e0..c979009 100644 (file)
@@ -244,6 +244,7 @@ struct mdt_thread_info {
         struct ldlm_res_id         mti_res_id;
         union {
                 struct obd_uuid    uuid;
+                char               ns_name[48];
         } mti_u;
 };