Whamcloud - gitweb
LU-4629 obdclass: compile issues with variable not being initialized
[fs/lustre-release.git] / lustre / obdclass / obd_mount.c
index 0f70f44..bfa1c12 100644 (file)
@@ -95,9 +95,11 @@ int lustre_process_log(struct super_block *sb, char *logname,
         lustre_cfg_bufs_set(bufs, 2, cfg, sizeof(*cfg));
         lustre_cfg_bufs_set(bufs, 3, &sb, sizeof(sb));
         lcfg = lustre_cfg_new(LCFG_LOG_START, bufs);
-        rc = obd_process_config(mgc, sizeof(*lcfg), lcfg);
-        lustre_cfg_free(lcfg);
-
+       if (lcfg == NULL)
+               GOTO(out, rc = -ENOMEM);
+       rc = obd_process_config(mgc, sizeof(*lcfg), lcfg);
+       lustre_cfg_free(lcfg);
+out:
         OBD_FREE_PTR(bufs);
 
         if (rc == -EINVAL)
@@ -140,6 +142,8 @@ int lustre_end_log(struct super_block *sb, char *logname,
         if (cfg)
                 lustre_cfg_bufs_set(&bufs, 2, cfg, sizeof(*cfg));
         lcfg = lustre_cfg_new(LCFG_LOG_END, &bufs);
+       if (lcfg == NULL)
+               RETURN(-ENOMEM);
         rc = obd_process_config(mgc, sizeof(*lcfg), lcfg);
         lustre_cfg_free(lcfg);
         RETURN(rc);
@@ -172,6 +176,8 @@ int do_lcfg(char *cfgname, lnet_nid_t nid, int cmd,
                 lustre_cfg_bufs_set_string(&bufs, 4, s4);
 
         lcfg = lustre_cfg_new(cmd, &bufs);
+       if (lcfg == NULL)
+               return -ENOMEM;
         lcfg->lcfg_nid = nid;
         rc = class_process_config(lcfg);
         lustre_cfg_free(lcfg);
@@ -220,7 +226,6 @@ int lustre_start_mgc(struct super_block *sb)
         lnet_nid_t nid;
         char *mgcname = NULL, *niduuid = NULL, *mgssec = NULL;
         char *ptr;
-        int recov_bk;
         int rc = 0, i = 0, j, len;
         ENTRY;
 
@@ -271,6 +276,8 @@ int lustre_start_mgc(struct super_block *sb)
 
         obd = class_name2obd(mgcname);
         if (obd && !obd->obd_stopping) {
+               int recov_bk;
+
                 rc = obd_set_info_async(NULL, obd->obd_self_export,
                                         strlen(KEY_MGSSEC), KEY_MGSSEC,
                                         strlen(mgssec), mgssec, NULL);
@@ -443,16 +450,6 @@ int lustre_start_mgc(struct super_block *sb)
            so we know when we can get rid of the mgc. */
        atomic_set(&obd->u.cli.cl_mgc_refcount, 1);
 
-        /* Try all connections, but only once. */
-        recov_bk = 1;
-        rc = obd_set_info_async(NULL, obd->obd_self_export,
-                                sizeof(KEY_INIT_RECOV_BACKUP),
-                                KEY_INIT_RECOV_BACKUP,
-                                sizeof(recov_bk), &recov_bk, NULL);
-        if (rc)
-                /* nonfatal */
-                CWARN("can't set %s %d\n", KEY_INIT_RECOV_BACKUP, rc);
-
        /* We connect to the MGS at setup, and don't disconnect until cleanup */
        data->ocd_connect_flags = OBD_CONNECT_VERSION | OBD_CONNECT_AT |
                                  OBD_CONNECT_FULL20 | OBD_CONNECT_IMP_RECOV |
@@ -645,10 +642,10 @@ static int lustre_free_lsi(struct super_block *sb)
    e.g. MDT, MGS, and potentially MGC */
 int lustre_put_lsi(struct super_block *sb)
 {
-        struct lustre_sb_info *lsi = s2lsi(sb);
-        ENTRY;
+       struct lustre_sb_info *lsi = s2lsi(sb);
+       ENTRY;
 
-        LASSERT(lsi != NULL);
+       LASSERT(lsi != NULL);
 
        CDEBUG(D_MOUNT, "put %p %d\n", sb, atomic_read(&lsi->lsi_mounts));
        if (atomic_dec_and_test(&lsi->lsi_mounts)) {
@@ -660,10 +657,10 @@ int lustre_put_lsi(struct super_block *sb)
                        /* wait till OSD is gone */
                        obd_zombie_barrier();
                }
-                lustre_free_lsi(sb);
-                RETURN(1);
-        }
-        RETURN(0);
+               lustre_free_lsi(sb);
+               RETURN(1);
+       }
+       RETURN(0);
 }
 
 /*** SERVER NAME ***
@@ -834,8 +831,8 @@ int lustre_common_put_super(struct super_block *sb)
         }
         /* Drop a ref to the mounted disk */
         lustre_put_lsi(sb);
-        lu_types_stop();
-        RETURN(rc);
+
+       RETURN(rc);
 }
 EXPORT_SYMBOL(lustre_common_put_super);
 
@@ -896,7 +893,8 @@ int lustre_check_exclusion(struct super_block *sb, char *svname)
 static int lmd_make_exclusion(struct lustre_mount_data *lmd, const char *ptr)
 {
        const char *s1 = ptr, *s2;
-       __u32 index, *exclude_list;
+       __u32 *exclude_list;
+       __u32 index = 0;
        int rc = 0, devmax;
        ENTRY;
 
@@ -1297,7 +1295,9 @@ int lustre_fill_super(struct super_block *sb, void *data, int silent)
 
         if (lmd_is_client(lmd)) {
                 CDEBUG(D_MOUNT, "Mounting client %s\n", lmd->lmd_profile);
-                if (!client_fill_super) {
+               if (client_fill_super == NULL)
+                       request_module("lustre");
+               if (client_fill_super == NULL) {
                         LCONSOLE_ERROR_MSG(0x165, "Nothing registered for "
                                            "client mount! Is the 'lustre' "
                                            "module loaded?\n");
@@ -1403,6 +1403,7 @@ struct file_system_type lustre_fs_type = {
        .fs_flags     = FS_BINARY_MOUNTDATA | FS_REQUIRES_DEV |
                        FS_HAS_FIEMAP | FS_RENAME_DOES_D_MOVE,
 };
+MODULE_ALIAS_FS("lustre");
 
 int lustre_register_fs(void)
 {