From: Nathaniel Clark Date: Thu, 13 Mar 2014 19:31:41 +0000 (-0400) Subject: LU-4200 mgs: fix counting of mgs exports X-Git-Tag: 2.5.58~85 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=a8daf3e7b31a44f0b76a406661d59075f11c5bbe LU-4200 mgs: fix counting of mgs exports In only_mgs_is_running iterate over mgs exports and only count non-self and non MDS-MDS exports. Signed-off-by: Nathaniel Clark Change-Id: I145d897fe2f222dae5e998de322ea58ac9f75375 Reviewed-on: http://review.whamcloud.com/9650 Tested-by: Jenkins Reviewed-by: Bob Glossman Tested-by: Maloo Reviewed-by: Jian Yu Reviewed-by: Andreas Dilger --- diff --git a/lustre/mgs/mgs_llog.c b/lustre/mgs/mgs_llog.c index 4c546bb..820acba 100644 --- a/lustre/mgs/mgs_llog.c +++ b/lustre/mgs/mgs_llog.c @@ -1170,13 +1170,36 @@ static int mgs_parse_devname(char *devname, char *fsname, __u32 *index) 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(); + 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 - (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)