Whamcloud - gitweb
LU-15938 lod: prevent endless retry in recovery thread
[fs/lustre-release.git] / lustre / obdclass / obd_mount.c
index 37165a2..bb4dd25 100644 (file)
@@ -27,7 +27,6 @@
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
  *
  * lustre/obdclass/obd_mount.c
  *
@@ -49,7 +48,7 @@
 #include <lustre_log.h>
 #include <lustre_disk.h>
 #include <uapi/linux/lustre/lustre_param.h>
-#include <libcfs/crypto/llcrypt.h>
+#include <lustre_crypto.h>
 
 /**************** config llog ********************/
 
@@ -240,12 +239,12 @@ int lustre_start_mgc(struct super_block *sb)
                    (class_parse_nid(lsi->lsi_lmd->lmd_mgs, &nid, &ptr) == 0)) {
                        i++;
                } else if (IS_MGS(lsi)) {
-                       struct lnet_process_id id;
+                       struct lnet_processid id;
 
                        while ((rc = LNetGetId(i++, &id)) != -ENOENT) {
-                               if (id.nid == LNET_NID_LO_0)
+                               if (nid_is_lo0(&id.nid))
                                        continue;
-                               nid = id.nid;
+                               nid = lnet_nid_to_nid4(&id.nid);
                                i++;
                                break;
                        }
@@ -348,10 +347,11 @@ int lustre_start_mgc(struct super_block *sb)
                CDEBUG(D_MOUNT, "mgs NIDs %s.\n", ptr);
                if (IS_MGS(lsi)) {
                        /* Use local NIDs (including LO) */
-                       struct lnet_process_id id;
+                       struct lnet_processid id;
 
                        while ((rc = LNetGetId(i++, &id)) != -ENOENT) {
-                               rc = do_lcfg(mgcname, id.nid, LCFG_ADD_UUID,
+                               rc = do_lcfg(mgcname, lnet_nid_to_nid4(&id.nid),
+                                            LCFG_ADD_UUID,
                                             niduuid, NULL, NULL, NULL);
                        }
                } else {
@@ -462,7 +462,9 @@ int lustre_start_mgc(struct super_block *sb)
        data->ocd_connect_flags = OBD_CONNECT_VERSION | OBD_CONNECT_AT |
                                  OBD_CONNECT_FULL20 | OBD_CONNECT_IMP_RECOV |
                                  OBD_CONNECT_LVB_TYPE |
-                                 OBD_CONNECT_BULK_MBITS | OBD_CONNECT_BARRIER;
+                                 OBD_CONNECT_BULK_MBITS | OBD_CONNECT_BARRIER |
+                                 OBD_CONNECT_FLAGS2;
+       data->ocd_connect_flags2 = OBD_CONNECT2_REP_MBITS;
 
        if (lmd_is_client(lsi->lsi_lmd) &&
            lsi->lsi_lmd->lmd_flags & LMD_FLG_NOIR)
@@ -501,8 +503,8 @@ static int lustre_stop_mgc(struct super_block *sb)
 {
        struct lustre_sb_info *lsi = s2lsi(sb);
        struct obd_device *obd;
-       char *niduuid = NULL, *ptr = NULL;
-       int i, rc = 0, len = 0;
+       char niduuid[MAX_OBD_NAME + 6], *ptr = NULL;
+       int i, rc = 0;
 
        ENTRY;
 
@@ -542,24 +544,16 @@ static int lustre_stop_mgc(struct super_block *sb)
        }
 
        /*
-        * Save the obdname for cleaning the nid uuids, which are
-        * obdname_XX
+        * Cache the obdname for cleaning the nid uuids, which are
+        * obdname_XX before calling class_manual_cleanup
         */
-       len = strlen(obd->obd_name) + 6;
-       OBD_ALLOC(niduuid, len);
-       if (niduuid) {
-               strcpy(niduuid, obd->obd_name);
-               ptr = niduuid + strlen(niduuid);
-       }
+       strcpy(niduuid, obd->obd_name);
+       ptr = niduuid + strlen(niduuid);
 
        rc = class_manual_cleanup(obd);
        if (rc)
                GOTO(out, rc);
 
-       /* Clean the nid uuids */
-       if (!niduuid)
-               GOTO(out, rc = -ENOMEM);
-
        for (i = 0; i < lsi->lsi_lmd->lmd_mgs_failnodes; i++) {
                sprintf(ptr, "_%x", i);
                rc = do_lcfg(LUSTRE_MGC_OBDNAME, 0, LCFG_DEL_UUID,
@@ -569,9 +563,6 @@ static int lustre_stop_mgc(struct super_block *sb)
                               niduuid, rc);
        }
 out:
-       if (niduuid)
-               OBD_FREE(niduuid, len);
-
        /* class_import_put will get rid of the additional connections */
        mutex_unlock(&mgc_start_lock);
        RETURN(rc);
@@ -1343,12 +1334,13 @@ int lmd_parse(char *options, struct lustre_mount_data *lmd)
                 * Parse non-ldiskfs options here. Rather than modifying
                 * ldiskfs, we just zero these out here
                 */
-               if (strncmp(s1, "abort_recov", 11) == 0) {
-                       lmd->lmd_flags |= LMD_FLG_ABORT_RECOV;
-                       clear++;
-               } else if (strncmp(s1, "abort_recov_mdt", 15) == 0) {
+               if (!strncmp(s1, "abort_recov_mdt", 15) ||
+                   !strncmp(s1, "abort_recovery_mdt", 18)) {
                        lmd->lmd_flags |= LMD_FLG_ABORT_RECOV_MDT;
                        clear++;
+               } else if (strncmp(s1, "abort_recov", 11) == 0) {
+                       lmd->lmd_flags |= LMD_FLG_ABORT_RECOV;
+                       clear++;
                } else if (strncmp(s1, "recovery_time_soft=", 19) == 0) {
                        lmd->lmd_recovery_time_soft =
                                max_t(int, simple_strtoul(s1 + 19, NULL, 10),
@@ -1395,6 +1387,9 @@ int lmd_parse(char *options, struct lustre_mount_data *lmd)
                } else if (strncmp(s1, "writeconf", 9) == 0) {
                        lmd->lmd_flags |= LMD_FLG_WRITECONF;
                        clear++;
+               } else if (strncmp(s1, "nolocallogs", 11) == 0) {
+                       lmd->lmd_flags |= LMD_FLG_NO_LOCAL_LOGS;
+                       clear++;
                } else if (strncmp(s1, "update", 6) == 0) {
                        lmd->lmd_flags |= LMD_FLG_UPDATE;
                        clear++;
@@ -1582,114 +1577,3 @@ invalid:
        RETURN(-EINVAL);
 }
 EXPORT_SYMBOL(lmd_parse);
-
-#ifdef HAVE_SERVER_SUPPORT
-/**
- * This is the entry point for the mount call into Lustre.
- * This is called when a server target is mounted,
- * and this is where we start setting things up.
- * @param data Mount options (e.g. -o flock,abort_recov)
- */
-static int lustre_tgt_fill_super(struct super_block *sb, void *lmd2_data,
-                                int silent)
-{
-       struct lustre_mount_data *lmd;
-       struct lustre_sb_info *lsi;
-       int rc;
-
-       ENTRY;
-
-       CDEBUG(D_MOUNT|D_VFSTRACE, "VFS Op: sb %p\n", sb);
-
-       lsi = lustre_init_lsi(sb);
-       if (!lsi)
-               RETURN(-ENOMEM);
-       lmd = lsi->lsi_lmd;
-
-       /*
-        * Disable lockdep during mount, because mount locking patterns are
-        * 'special'.
-        */
-       lockdep_off();
-
-       /*
-        * LU-639: the OBD cleanup of last mount may not finish yet, wait here.
-        */
-       obd_zombie_barrier();
-
-       /* Figure out the lmd from the mount options */
-       if (lmd_parse(lmd2_data, lmd)) {
-               lustre_put_lsi(sb);
-               GOTO(out, rc = -EINVAL);
-       }
-
-       if (lmd_is_client(lmd)) {
-               rc = -ENODEV;
-               CERROR("%s: attempting to mount a client with -t lustre_tgt' which is only for server-side mounts: rc = %d\n",
-                      lmd->lmd_dev, rc);
-               lustre_put_lsi(sb);
-               GOTO(out, rc);
-       }
-
-       CDEBUG(D_MOUNT, "Mounting server from %s\n", lmd->lmd_dev);
-       rc = server_fill_super(sb);
-       /*
-        * server_fill_super calls lustre_start_mgc after the mount
-        * because we need the MGS NIDs which are stored on disk.
-        * Plus, we may need to start the MGS first.
-        *
-        * server_fill_super will call server_put_super on failure
-        *
-        * If error happens in fill_super() call, @lsi will be killed there.
-        * This is why we do not put it here.
-        */
-out:
-       if (rc) {
-               CERROR("Unable to mount %s (%d)\n",
-                      s2lsi(sb) ? lmd->lmd_dev : "", rc);
-       } else {
-               CDEBUG(D_SUPER, "Mount %s complete\n",
-                      lmd->lmd_dev);
-       }
-       lockdep_on();
-       return rc;
-}
-
-/***************** FS registration ******************/
-static struct dentry *lustre_tgt_mount(struct file_system_type *fs_type,
-                                      int flags, const char *devname,
-                                      void *data)
-{
-       return mount_nodev(fs_type, flags, data, lustre_tgt_fill_super);
-}
-
-/* Register the "lustre_tgt" fs type.
- *
- * Right now this isn't any different than the normal "lustre" filesystem
- * type, but it is added so that there is some compatibility to allow
- * changing documentation and scripts to start using the "lustre_tgt" type
- * at mount time. That will simplify test interop, and in case of upgrades
- * that change to the new type and then need to roll back for some reason.
- *
- * The long-term goal is to disentangle the client and server mount code.
- */
-static struct file_system_type lustre_tgt_fstype = {
-       .owner          = THIS_MODULE,
-       .name           = "lustre_tgt",
-       .mount          = lustre_tgt_mount,
-       .kill_sb        = kill_anon_super,
-       .fs_flags       = FS_REQUIRES_DEV | FS_RENAME_DOES_D_MOVE,
-};
-MODULE_ALIAS_FS("lustre_tgt");
-
-int lustre_tgt_register_fs(void)
-{
-       return register_filesystem(&lustre_tgt_fstype);
-}
-
-void lustre_tgt_unregister_fs(void)
-{
-       unregister_filesystem(&lustre_tgt_fstype);
-}
-
-#endif /* HAVE_SERVER_SUPPORT */