Whamcloud - gitweb
LU-14090 mgs: no local logs flag
[fs/lustre-release.git] / lustre / obdclass / obd_mount_server.c
index 5b5cb20..374ec8b 100644 (file)
@@ -140,6 +140,7 @@ static int server_deregister_mount(const char *name)
        OBD_FREE(lmi, sizeof(*lmi));
        mutex_unlock(&lustre_mount_info_lock);
 
+       OBD_RACE(OBD_FAIL_MDS_LLOG_UMOUNT_RACE);
        RETURN(0);
 }
 
@@ -419,7 +420,7 @@ int lustre_register_lwp_item(const char *lwpname, struct obd_export **exp,
                        RETURN(-ENOMEM);
                }
                memcpy(uuid->uuid, lwpname, strlen(lwpname));
-               *exp = cfs_hash_lookup(lwp->obd_uuid_hash, uuid);
+               *exp = obd_uuid_lookup(lwp, uuid);
                OBD_FREE_PTR(uuid);
        }
 
@@ -476,8 +477,7 @@ void lustre_deregister_lwp_item(struct obd_export **exp)
                CDEBUG(D_MOUNT, "lri reference count %u, repeat: %d\n",
                       atomic_read(&lri->lri_ref), repeat);
                repeat++;
-               set_current_state(TASK_INTERRUPTIBLE);
-               schedule_timeout(cfs_time_seconds(1));
+               schedule_timeout_interruptible(cfs_time_seconds(1));
        }
        lustre_put_lwp_item(lri);
 }
@@ -881,6 +881,20 @@ static int client_lwp_config_process(const struct lu_env *env,
                if (!is_mdc_device(devname))
                        break;
 
+               if (!(cfg->cfg_flags & CFG_F_MARKER)) {
+                       CDEBUG(D_CONFIG, "Skipping add_conn for %s, rec %d\n",
+                              devname, rec->lrh_index);
+                       break;
+               }
+
+               /* add_conn should follow by add_uuid. This
+                * guarantee lwp device was created
+                */
+               if (!(cfg->cfg_flags & CFG_F_SKIP)) {
+                       CWARN("Error at config for %s rec %d, add_conn should follow by add_uuid\n",
+                             devname, rec->lrh_index);
+                       break;
+               }
                ptr = strrchr(devname, '-');
                if (ptr == NULL)
                        break;
@@ -1101,7 +1115,7 @@ static int server_stop_servers(int lsiflags)
        LASSERTF(type, "Server flags %d, obd %s\n", lsiflags,
                 obd ? obd->obd_name : "NULL");
 
-       type_last = (type->typ_refcnt == 1);
+       type_last = (atomic_read(&type->typ_refcnt) == 1);
 
        class_put_type(type);
        if (obd != NULL && type_last) {
@@ -1147,7 +1161,7 @@ static int server_lsi2mti(struct lustre_sb_info *lsi,
 
        mti->mti_nid_count = 0;
        while (LNetGetId(i++, &id) != -ENOENT) {
-               if (LNET_NETTYP(LNET_NIDNET(id.nid)) == LOLND)
+               if (id.nid == LNET_NID_LO_0)
                        continue;
 
                /* server use --servicenode param, only allow specified
@@ -1251,9 +1265,8 @@ again:
                        if ((rc == -ESHUTDOWN || rc == -EIO) && ++tried < 5) {
                                /* The connection with MGS is not established.
                                 * Try again after 2 seconds. Interruptable. */
-                               set_current_state(TASK_INTERRUPTIBLE);
-                               schedule_timeout(cfs_time_seconds(2));
-                               set_current_state(TASK_RUNNING);
+                               schedule_timeout_interruptible(
+                                       cfs_time_seconds(2));
                                if (!signal_pending(current))
                                        goto again;
                        }
@@ -1367,6 +1380,10 @@ static int server_start_targets(struct super_block *sb)
        /* hold a type reference and put it at server_stop_servers */
        type = class_get_type(IS_MDT(lsi) ?
                              LUSTRE_MDT_NAME : LUSTRE_OST_NAME);
+       if (!type) {
+               mutex_unlock(&server_start_lock);
+               GOTO(out_stop_service, rc = -ENODEV);
+       }
        lsi->lsi_server_started = 1;
        mutex_unlock(&server_start_lock);
        if (OBD_FAIL_PRECHECK(OBD_FAIL_OBD_STOP_MDS_RACE) &&
@@ -1454,10 +1471,15 @@ static int server_start_targets(struct super_block *sb)
 
        /* abort recovery only on the complete stack:
         * many devices can be involved */
-       if ((lsi->lsi_lmd->lmd_flags & LMD_FLG_ABORT_RECOV) &&
+       if ((lsi->lsi_lmd->lmd_flags &
+            (LMD_FLG_ABORT_RECOV | LMD_FLG_ABORT_RECOV_MDT)) &&
            (OBP(obd, iocontrol))) {
+               struct obd_ioctl_data karg = {
+                       .ioc_type = lsi->lsi_lmd->lmd_flags,
+               };
+
                obd_iocontrol(OBD_IOC_ABORT_RECOVERY, obd->obd_self_export, 0,
-                             NULL, NULL);
+                             &karg, NULL);
        }
 
 out_mgc:
@@ -1531,6 +1553,8 @@ static int lsi_prepare(struct lustre_sb_info *lsi)
         */
        lsi->lsi_flags |= (lsi->lsi_lmd->lmd_flags & LMD_FLG_WRITECONF) ?
                LDD_F_WRITECONF : 0;
+       lsi->lsi_flags |= (lsi->lsi_lmd->lmd_flags & LMD_FLG_NO_LOCAL_LOGS) ?
+               LDD_F_NO_LOCAL_LOGS : 0;
        lsi->lsi_flags |= (lsi->lsi_lmd->lmd_flags & LMD_FLG_VIRGIN) ?
                LDD_F_VIRGIN : 0;
        lsi->lsi_flags |= (lsi->lsi_lmd->lmd_flags & LMD_FLG_UPDATE) ?
@@ -1707,23 +1731,13 @@ static int server_statfs(struct dentry *dentry, struct kstatfs *buf)
        RETURN(0);
 }
 
-#ifdef HAVE_SUPEROPS_USE_DENTRY
 int server_show_options(struct seq_file *seq, struct dentry *dentry)
-#else
-int server_show_options(struct seq_file *seq, struct vfsmount *vfs)
-#endif
 {
        struct lustre_sb_info *lsi;
        struct lustre_mount_data *lmd;
 
-#ifdef HAVE_SUPEROPS_USE_DENTRY
        LASSERT(seq != NULL && dentry != NULL);
        lsi = s2lsi(dentry->d_sb);
-#else
-       LASSERT(seq != NULL && vfs != NULL);
-       lsi = s2lsi(vfs->mnt_sb);
-#endif
-
        lmd = lsi->lsi_lmd;
        seq_printf(seq, ",svname=%s", lmd->lmd_profile);
 
@@ -1767,7 +1781,7 @@ int server_show_options(struct seq_file *seq, struct vfsmount *vfs)
 /** The operations we support directly on the superblock:
  * mount, umount, and df.
  */
-static struct super_operations server_ops = {
+static const struct super_operations server_ops = {
        .put_super      = server_put_super,
        .umount_begin   = server_umount_begin, /* umount -f */
        .statfs         = server_statfs,
@@ -2036,6 +2050,7 @@ out_mnt:
        server_put_super(sb);
        return rc;
 }
+EXPORT_SYMBOL(server_fill_super);
 
 /*
  * Calculate timeout value for a target.