Whamcloud - gitweb
LU-4200 mgs: fix counting of mgs exports 50/9650/3
authorNathaniel Clark <nathaniel.l.clark@intel.com>
Thu, 13 Mar 2014 19:31:41 +0000 (15:31 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Fri, 21 Mar 2014 14:04:07 +0000 (14:04 +0000)
In only_mgs_is_running iterate over mgs exports and only count
non-self and non MDS-MDS exports.

Signed-off-by: Nathaniel Clark <nathaniel.l.clark@intel.com>
Change-Id: I145d897fe2f222dae5e998de322ea58ac9f75375
Reviewed-on: http://review.whamcloud.com/9650
Tested-by: Jenkins
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Jian Yu <jian.yu@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
lustre/mgs/mgs_llog.c

index 4c546bb..820acba 100644 (file)
@@ -1170,13 +1170,36 @@ static int mgs_parse_devname(char *devname, char *fsname, __u32 *index)
        RETURN(0);
 }
 
        RETURN(0);
 }
 
+/* This is only called during replace_nids */
 static int only_mgs_is_running(struct obd_device *mgs_obd)
 {
        /* TDB: Is global variable with devices count exists? */
        int num_devices = get_devices_count();
 static int only_mgs_is_running(struct obd_device *mgs_obd)
 {
        /* TDB: Is global variable with devices count exists? */
        int num_devices = get_devices_count();
+       int num_exports = 0;
+       struct obd_export *exp;
+
+       spin_lock(&mgs_obd->obd_dev_lock);
+       list_for_each_entry(exp, &mgs_obd->obd_exports, exp_obd_chain) {
+               /* skip self export */
+               if (exp == mgs_obd->obd_self_export)
+                       continue;
+               if (exp_connect_flags(exp) & OBD_CONNECT_MDS_MDS)
+                       continue;
+
+               ++num_exports;
+
+               CERROR("%s: node %s still connected during replace_nids "
+                      "connect_flags:%llx\n",
+                      mgs_obd->obd_name,
+                      libcfs_nid2str(exp->exp_nid_stats->nid),
+                      exp_connect_flags(exp));
+
+       }
+       spin_unlock(&mgs_obd->obd_dev_lock);
+
        /* osd, MGS and MGC + self_export
        /* osd, MGS and MGC + self_export
-          (wc -l /proc/fs/lustre/devices <= 2) && (num_exports <= 2) */
-       return (num_devices <= 3) && (mgs_obd->obd_num_exports <= 2);
+          (wc -l /proc/fs/lustre/devices <= 2) && (non self exports == 0) */
+       return (num_devices <= 3) && (num_exports == 0);
 }
 
 static int name_create_mdt(char **logname, char *fsname, int i)
 }
 
 static int name_create_mdt(char **logname, char *fsname, int i)