Whamcloud - gitweb
LU-4134 obdclass: obd_device improvement
[fs/lustre-release.git] / lustre / obdclass / obd_mount.c
index 362d8c1..b8d3b76 100644 (file)
@@ -219,7 +219,7 @@ int lustre_start_mgc(struct super_block *sb)
         struct lustre_sb_info *lsi = s2lsi(sb);
         struct obd_device *obd;
         struct obd_export *exp;
-        struct obd_uuid *uuid;
+       struct obd_uuid *uuid = NULL;
         class_uuid_t uuidc;
         lnet_nid_t nid;
        char nidstr[LNET_NIDSTR_SIZE];
@@ -408,7 +408,6 @@ int lustre_start_mgc(struct super_block *sb)
         rc = lustre_start_simple(mgcname, LUSTRE_MGC_NAME,
                                 (char *)uuid->uuid, LUSTRE_MGS_OBDNAME,
                                 niduuid, NULL, NULL);
-        OBD_FREE_PTR(uuid);
         if (rc)
                 GOTO(out_free, rc);
 
@@ -469,7 +468,7 @@ int lustre_start_mgc(struct super_block *sb)
             lsi->lsi_lmd->lmd_flags & LMD_FLG_NOIR)
                 data->ocd_connect_flags &= ~OBD_CONNECT_IMP_RECOV;
         data->ocd_version = LUSTRE_VERSION_CODE;
-        rc = obd_connect(NULL, &exp, obd, &(obd->obd_uuid), data, NULL);
+       rc = obd_connect(NULL, &exp, obd, uuid, data, NULL);
         if (rc) {
                 CERROR("connect failed %d\n", rc);
                 GOTO(out, rc);
@@ -484,6 +483,8 @@ out:
 out_free:
        mutex_unlock(&mgc_start_lock);
 
+       if (uuid)
+               OBD_FREE_PTR(uuid);
         if (data)
                 OBD_FREE_PTR(data);
         if (mgcname)