Whamcloud - gitweb
LU-718 mds: new MDS layer.
[fs/lustre-release.git] / lustre / obdclass / obd_mount.c
index fb270ea..6359717 100644 (file)
@@ -1445,11 +1445,10 @@ static int server_stop_servers(int lsiflags)
         /* Either an MDT or an OST or neither  */
         /* if this was an MDT, and there are no more MDT's, clean up the MDS */
        if ((lsiflags & LDD_F_SV_TYPE_MDT) &&
-            (obd = class_name2obd(LUSTRE_MDS_OBDNAME))) {
-                /*FIXME pre-rename, should eventually be LUSTRE_MDT_NAME*/
-                type = class_search_type(LUSTRE_MDS_NAME);
-        }
-        /* if this was an OST, and there are no more OST's, clean up the OSS */
+           (obd = class_name2obd(LUSTRE_MDS_OBDNAME))) {
+               type = class_search_type(LUSTRE_MDT_NAME);
+       }
+       /* if this was an OST, and there are no more OST's, clean up the OSS */
        if ((lsiflags & LDD_F_SV_TYPE_OST) &&
             (obd = class_name2obd(LUSTRE_OSS_OBDNAME))) {
                 type = class_search_type(LUSTRE_OST_NAME);
@@ -1784,27 +1783,23 @@ static int server_start_targets(struct super_block *sb, struct vfsmount *mnt)
 
        CDEBUG(D_MOUNT, "starting target %s\n", lsi->lsi_svname);
 
-#if 0
-        /* If we're an MDT, make sure the global MDS is running */
-        if (lsi->lsi_ldd->ldd_flags & LDD_F_SV_TYPE_MDT) {
-                /* make sure the MDS is started */
+       if (IS_MDT(lsi)) {
+               /* make sure the MDS is started */
                mutex_lock(&server_start_lock);
-                obd = class_name2obd(LUSTRE_MDS_OBDNAME);
-                if (!obd) {
-                        rc = lustre_start_simple(LUSTRE_MDS_OBDNAME,
-                    /* FIXME pre-rename, should eventually be LUSTRE_MDS_NAME */
-                                                 LUSTRE_MDT_NAME,
-                                                 LUSTRE_MDS_OBDNAME"_uuid",
-                                                 0, 0);
-                        if (rc) {
+               obd = class_name2obd(LUSTRE_MDS_OBDNAME);
+               if (!obd) {
+                       rc = lustre_start_simple(LUSTRE_MDS_OBDNAME,
+                                                LUSTRE_MDS_NAME,
+                                                LUSTRE_MDS_OBDNAME"_uuid",
+                                                0, 0, 0, 0);
+                       if (rc) {
                                mutex_unlock(&server_start_lock);
-                                CERROR("failed to start MDS: %d\n", rc);
-                                RETURN(rc);
-                        }
-                }
+                               CERROR("failed to start MDS: %d\n", rc);
+                               RETURN(rc);
+                       }
+               }
                mutex_unlock(&server_start_lock);
-        }
-#endif
+       }
 
         /* If we're an OST, make sure the global OSS is running */
        if (IS_OST(lsi)) {
@@ -1830,7 +1825,7 @@ static int server_start_targets(struct super_block *sb, struct vfsmount *mnt)
        if (lsi->lsi_srv_mnt) {
                rc = server_mgc_set_fs(lsi->lsi_mgc, sb);
                if (rc)
-                       RETURN(rc);
+                       GOTO(out_stop_service, rc);
        }
 
         /* Register with MGS */
@@ -1913,6 +1908,10 @@ out_mgc:
        if (lsi->lsi_srv_mnt)
                server_mgc_clear_fs(lsi->lsi_mgc);
 
+out_stop_service:
+       if (rc != 0)
+               server_stop_servers(lsi->lsi_flags);
+
         RETURN(rc);
 }
 
@@ -2135,7 +2134,7 @@ static void server_put_super(struct super_block *sb)
                obd = class_name2obd(lsi->lsi_svname);
                 if (obd) {
                         CDEBUG(D_MOUNT, "stopping %s\n", obd->obd_name);
-                        if (lsi->lsi_flags & LSI_UMOUNT_FAILOVER)
+                       if (lsiflags & LSI_UMOUNT_FAILOVER)
                                 obd->obd_fail = 1;
                         /* We can't seem to give an error return code
                          * to .put_super, so we better make sure we clean up! */