Whamcloud - gitweb
LU-1303 osd: zfs-osd should initialize local objects on MDS
[fs/lustre-release.git] / lustre / obdclass / obd_mount.c
index 33ef09d..2ca91e9 100644 (file)
@@ -121,9 +121,7 @@ static int server_register_mount(const char *name, struct super_block *sb,
 
         cfs_mutex_unlock(&lustre_mount_info_lock);
 
-        CDEBUG(D_MOUNT, "reg_mnt %p from %s, vfscount=%d\n",
-              lmi->lmi_mnt, name,
-              lmi->lmi_mnt ? mnt_get_count(lmi->lmi_mnt) : -1);
+       CDEBUG(D_MOUNT, "reg_mnt %p from %s\n", lmi->lmi_mnt, name);
 
         RETURN(0);
 }
@@ -142,9 +140,7 @@ static int server_deregister_mount(const char *name)
                 RETURN(-ENOENT);
         }
 
-        CDEBUG(D_MOUNT, "dereg_mnt %p from %s, vfscount=%d\n",
-              lmi->lmi_mnt, name,
-              lmi->lmi_mnt ? mnt_get_count(lmi->lmi_mnt) : -1);
+       CDEBUG(D_MOUNT, "dereg_mnt %p from %s\n", lmi->lmi_mnt, name);
 
         OBD_FREE(lmi->lmi_name, strlen(lmi->lmi_name) + 1);
         cfs_list_del(&lmi->lmi_list_chain);
@@ -174,9 +170,8 @@ struct lustre_mount_info *server_get_mount(const char *name)
 
         cfs_atomic_inc(&lsi->lsi_mounts);
 
-        CDEBUG(D_MOUNT, "get_mnt %p from %s, refs=%d, vfscount=%d\n",
-               lmi->lmi_mnt, name, cfs_atomic_read(&lsi->lsi_mounts),
-              lmi->lmi_mnt ? mnt_get_count(lmi->lmi_mnt) - 1 : -1);
+       CDEBUG(D_MOUNT, "get_mnt %p from %s, refs=%d\n", lmi->lmi_mnt,
+              name, cfs_atomic_read(&lsi->lsi_mounts));
 
         RETURN(lmi);
 }
@@ -209,7 +204,6 @@ int server_put_mount(const char *name, struct vfsmount *mnt)
 {
         struct lustre_mount_info *lmi;
         struct lustre_sb_info *lsi;
-       int count = 0;
         ENTRY;
 
         cfs_mutex_lock(&lustre_mount_info_lock);
@@ -221,16 +215,12 @@ int server_put_mount(const char *name, struct vfsmount *mnt)
         }
         lsi = s2lsi(lmi->lmi_sb);
 
-        CDEBUG(D_MOUNT, "put_mnt %p from %s, refs=%d, vfscount=%d\n",
-               lmi->lmi_mnt, name, cfs_atomic_read(&lsi->lsi_mounts), count);
+       CDEBUG(D_MOUNT, "put_mnt %p from %s, refs=%d\n",
+              lmi->lmi_mnt, name, cfs_atomic_read(&lsi->lsi_mounts));
 
-        if (lustre_put_lsi(lmi->lmi_sb)) {
-                CDEBUG(D_MOUNT, "Last put of mnt %p from %s, vfscount=%d\n",
-                       lmi->lmi_mnt, name, count);
-                /* last mount is the One True Mount */
-                if (count > 1)
-                        CERROR("%s: mount busy, vfscount=%d!\n", name, count);
-        }
+       if (lustre_put_lsi(lmi->lmi_sb))
+               CDEBUG(D_MOUNT, "Last put of mnt %p from %s\n",
+                      lmi->lmi_mnt, name);
 
         /* this obd should never need the mount again */
         server_deregister_mount(name);
@@ -399,7 +389,6 @@ static int server_start_mgs(struct super_block *sb)
         struct lustre_mount_info *lmi;
         int    rc = 0;
         ENTRY;
-        LASSERT(mnt);
 
         /* It is impossible to have more than 1 MGS per node, since
            MGC wouldn't know which to connect to */
@@ -417,7 +406,8 @@ static int server_start_mgs(struct super_block *sb)
 
         if (!rc) {
                 rc = lustre_start_simple(LUSTRE_MGS_OBDNAME, LUSTRE_MGS_NAME,
-                                        LUSTRE_MGS_OBDNAME, 0, 0, 0, 0);
+                                        LUSTRE_MGS_OBDNAME, 0, 0,
+                                        lsi->lsi_osd_obdname, 0);
                 /* Do NOT call server_deregister_mount() here. This leads to
                  * inability cleanup cleanly and free lsi and other stuff when
                  * mgs calls server_put_mount() in error handling case. -umka */
@@ -645,7 +635,7 @@ static int lustre_start_mgc(struct super_block *sb)
                 /* New failover node */
                 sprintf(niduuid, "%s_%x", mgcname, i);
                 j = 0;
-                while (class_parse_nid(ptr, &nid, &ptr) == 0) {
+               while (class_parse_nid_quiet(ptr, &nid, &ptr) == 0) {
                         j++;
                         rc = do_lcfg(mgcname, nid,
                                      LCFG_ADD_UUID, niduuid, 0,0,0);
@@ -691,8 +681,14 @@ static int lustre_start_mgc(struct super_block *sb)
 
        /* 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 |
-                                 OBD_CONNECT_MNE_SWAB;
+                                 OBD_CONNECT_FULL20 | OBD_CONNECT_IMP_RECOV;
+
+#if LUSTRE_VERSION_CODE < OBD_OCD_VERSION(3, 2, 50, 0)
+       data->ocd_connect_flags |= OBD_CONNECT_MNE_SWAB;
+#else
+#warning "LU-1644: Remove old OBD_CONNECT_MNE_SWAB fixup and imp_need_mne_swab"
+#endif
+
         if (lmd_is_client(lsi->lsi_lmd) &&
             lsi->lsi_lmd->lmd_flags & LMD_FLG_NOIR)
                 data->ocd_connect_flags &= ~OBD_CONNECT_IMP_RECOV;
@@ -1140,6 +1136,8 @@ static int server_start_targets(struct super_block *sb, struct vfsmount *mnt)
         struct obd_device *obd;
         struct lustre_sb_info *lsi = s2lsi(sb);
         struct config_llog_instance cfg;
+       struct lu_env env;
+       struct lu_device *dev;
         int rc;
         ENTRY;
 
@@ -1230,12 +1228,6 @@ out_mgc:
                         RETURN(-ENXIO);
                 }
 
-                if ((lsi->lsi_lmd->lmd_flags & LMD_FLG_ABORT_RECOV) &&
-                    (OBP(obd, iocontrol))) {
-                        obd_iocontrol(OBD_IOC_ABORT_RECOVERY,
-                                      obd->obd_self_export, 0, NULL, NULL);
-                }
-
                 server_notify_target(sb, obd);
 
                 /* calculate recovery timeout, do it after lustre_process_log */
@@ -1243,6 +1235,34 @@ out_mgc:
 
                 /* log has been fully processed */
                 obd_notify(obd, NULL, OBD_NOTIFY_CONFIG, (void *)CONFIG_LOG);
+
+               /* log has been fully processed, let clients connect */
+               dev = obd->obd_lu_dev;
+               if (dev && dev->ld_ops->ldo_prepare) {
+                       rc = lu_env_init(&env, dev->ld_type->ldt_ctx_tags);
+                       if (rc == 0) {
+                               struct lu_context  session_ctx;
+
+                               lu_context_init(&session_ctx, LCT_SESSION);
+                               session_ctx.lc_thread = NULL;
+                               lu_context_enter(&session_ctx);
+                               env.le_ses = &session_ctx;
+
+                               dev->ld_ops->ldo_prepare(&env, NULL, dev);
+
+                               lu_env_fini(&env);
+                               lu_context_exit(&session_ctx);
+                               lu_context_fini(&session_ctx);
+                       }
+               }
+
+               /* abort recovery only on the complete stack:
+                * many devices can be involved */
+               if ((lsi->lsi_lmd->lmd_flags & LMD_FLG_ABORT_RECOV) &&
+                   (OBP(obd, iocontrol))) {
+                       obd_iocontrol(OBD_IOC_ABORT_RECOVERY,
+                                     obd->obd_self_export, 0, NULL, NULL);
+               }
         }
 
         RETURN(rc);
@@ -2005,7 +2025,7 @@ static int lmd_parse_mgs(struct lustre_mount_data *lmd, char **ptr)
        int   oldlen = 0;
 
        /* Find end of nidlist */
-       while (class_parse_nid(tail, &nid, &tail) == 0) {}
+       while (class_parse_nid_quiet(tail, &nid, &tail) == 0) {}
        length = tail - *ptr;
        if (length == 0) {
                LCONSOLE_ERROR_MSG(0x159, "Can't parse NID '%s'\n", *ptr);