X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Fobdclass%2Fobd_config.c;h=34c5711d68fd8cb00d912596b0b2917fe8027135;hp=898cfe718966739e95a17cccd12f14edb7f4e956;hb=939a742d5093c1a79cc9c08496d181597d28f243;hpb=881e4d68346be5623c4045dad0d6a50d4954f6fb diff --git a/lustre/obdclass/obd_config.c b/lustre/obdclass/obd_config.c index 898cfe7..34c5711 100644 --- a/lustre/obdclass/obd_config.c +++ b/lustre/obdclass/obd_config.c @@ -15,11 +15,7 @@ * * You should have received a copy of the GNU General Public License * version 2 along with this program; If not, see - * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf - * - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, - * CA 95054 USA or visit www.sun.com if you need additional information or - * have any questions. + * http://www.gnu.org/licenses/gpl-2.0.html * * GPL HEADER END */ @@ -27,7 +23,7 @@ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. * - * Copyright (c) 2011, 2015, Intel Corporation. + * Copyright (c) 2011, 2016, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ @@ -398,7 +394,7 @@ int class_attach(struct lustre_cfg *lcfg) /* XXX belongs in setup not attach */ init_rwsem(&obd->obd_observer_link_sem); /* recovery data */ - cfs_init_timer(&obd->obd_recovery_timer); + init_timer(&obd->obd_recovery_timer); spin_lock_init(&obd->obd_recovery_task_lock); init_waitqueue_head(&obd->obd_next_transno_waitq); init_waitqueue_head(&obd->obd_evict_inprogress_waitq); @@ -674,7 +670,7 @@ int class_cleanup(struct obd_device *obd, struct lustre_cfg *lcfg) by other things as well, so don't count on it. */ CDEBUG(D_IOCTL, "%s: forcing exports to disconnect: %d\n", obd->obd_name, atomic_read(&obd->obd_refcount) - 3); - dump_exports(obd, 0); + dump_exports(obd, 0, D_HA); class_disconnect_exports(obd); } @@ -1100,8 +1096,8 @@ static int process_param2_config(struct lustre_cfg *lcfg) [2] = param, [3] = NULL }; - struct timeval start; - struct timeval end; + ktime_t start; + ktime_t end; int rc; ENTRY; @@ -1111,18 +1107,18 @@ static int process_param2_config(struct lustre_cfg *lcfg) RETURN(-EINVAL); } - do_gettimeofday(&start); + start = ktime_get(); rc = call_usermodehelper(argv[0], argv, NULL, UMH_WAIT_PROC); - do_gettimeofday(&end); + end = ktime_get(); if (rc < 0) { CERROR("lctl: error invoking upcall %s %s %s: rc = %d; " "time %ldus\n", argv[0], argv[1], argv[2], rc, - cfs_timeval_sub(&end, &start, NULL)); + (long)ktime_us_delta(end, start)); } else { CDEBUG(D_HA, "lctl: invoked upcall %s %s %s, time %ldus\n", argv[0], argv[1], argv[2], - cfs_timeval_sub(&end, &start, NULL)); + (long)ktime_us_delta(end, start)); rc = 0; } @@ -1154,7 +1150,7 @@ int class_process_config(struct lustre_cfg *lcfg) GOTO(out, err); } case LCFG_ADD_UUID: { - CDEBUG(D_IOCTL, "adding mapping from uuid %s to nid "LPX64 + CDEBUG(D_IOCTL, "adding mapping from uuid %s to nid %#llx" " (%s)\n", lustre_cfg_string(lcfg, 1), lcfg->lcfg_nid, libcfs_nid2str(lcfg->lcfg_nid)); @@ -1587,6 +1583,7 @@ int class_config_llog_handler(const struct lu_env *env, lcfg->lcfg_command = LCFG_LOV_ADD_INA; } + lustre_cfg_bufs_reset(&bufs, NULL); lustre_cfg_bufs_init(&bufs, lcfg); if (cfg->cfg_instance && @@ -1629,6 +1626,48 @@ int class_config_llog_handler(const struct lu_env *env, cfg->cfg_obdname); } + /* Add net info to setup command + * if given on command line. + * So config log will be: + * [0]: client name + * [1]: client UUID + * [2]: server UUID + * [3]: inactive-on-startup + * [4]: restrictive net + */ + if (cfg && cfg->cfg_sb && s2lsi(cfg->cfg_sb) && + !IS_SERVER(s2lsi(cfg->cfg_sb))) { + struct lustre_sb_info *lsi = s2lsi(cfg->cfg_sb); + char *nidnet = lsi->lsi_lmd->lmd_nidnet; + + if (lcfg->lcfg_command == LCFG_SETUP && + lcfg->lcfg_bufcount != 2 && nidnet) { + CDEBUG(D_CONFIG, "Adding net %s info to setup " + "command for client %s\n", nidnet, + lustre_cfg_string(lcfg, 0)); + lustre_cfg_bufs_set_string(&bufs, 4, nidnet); + } + } + + /* Skip add_conn command if uuid is + * not on restricted net */ + if (cfg && cfg->cfg_sb && s2lsi(cfg->cfg_sb) && + !IS_SERVER(s2lsi(cfg->cfg_sb))) { + struct lustre_sb_info *lsi = s2lsi(cfg->cfg_sb); + char *uuid_str = lustre_cfg_string(lcfg, 1); + + if (lcfg->lcfg_command == LCFG_ADD_CONN && + lsi->lsi_lmd->lmd_nidnet && + LNET_NIDNET(libcfs_str2nid(uuid_str)) != + libcfs_str2net(lsi->lsi_lmd->lmd_nidnet)) { + CDEBUG(D_CONFIG, "skipping add_conn for %s\n", + uuid_str); + rc = 0; + /* No processing! */ + break; + } + } + lcfg_new = lustre_cfg_new(lcfg->lcfg_command, &bufs); if (lcfg_new == NULL) GOTO(out, rc = -ENOMEM); @@ -1636,8 +1675,8 @@ int class_config_llog_handler(const struct lu_env *env, lcfg_new->lcfg_num = lcfg->lcfg_num; lcfg_new->lcfg_flags = lcfg->lcfg_flags; - /* XXX Hack to try to remain binary compatible with - * pre-newconfig logs */ + /* XXX Hack to try to remain binary compatible with + * pre-newconfig logs */ if (lcfg->lcfg_nal != 0 && /* pre-newconfig log? */ (lcfg->lcfg_nid >> 32) == 0) { __u32 addr = (__u32)(lcfg->lcfg_nid & 0xffffffff); @@ -1662,7 +1701,7 @@ int class_config_llog_handler(const struct lu_env *env, } default: CERROR("Unknown llog record type %#x encountered\n", - rec->lrh_type); + rec->lrh_type); break; } out: @@ -1678,10 +1717,12 @@ EXPORT_SYMBOL(class_config_llog_handler); int class_config_parse_llog(const struct lu_env *env, struct llog_ctxt *ctxt, char *name, struct config_llog_instance *cfg) { - struct llog_process_cat_data cd = {0, 0}; - struct llog_handle *llh; - llog_cb_t callback; - int rc; + struct llog_process_cat_data cd = { + .lpcd_first_idx = 0, + }; + struct llog_handle *llh; + llog_cb_t callback; + int rc; ENTRY; CDEBUG(D_INFO, "looking up llog %s\n", name); @@ -1807,7 +1848,7 @@ int class_config_yaml_output(struct llog_rec_hdr *rec, char *buf, int size) char nidstr[LNET_NIDSTR_SIZE]; libcfs_nid2str_r(lcfg->lcfg_nid, nidstr, sizeof(nidstr)); - ptr += snprintf(ptr, end - ptr, ", nid: %s("LPX64")", + ptr += snprintf(ptr, end - ptr, ", nid: %s(%#llx)", nidstr, lcfg->lcfg_nid); } @@ -1859,7 +1900,7 @@ static int class_config_parse_rec(struct llog_rec_hdr *rec, char *buf, int size) char nidstr[LNET_NIDSTR_SIZE]; libcfs_nid2str_r(lcfg->lcfg_nid, nidstr, sizeof(nidstr)); - ptr += snprintf(ptr, end-ptr, "nid=%s("LPX64")\n ", + ptr += snprintf(ptr, end-ptr, "nid=%s(%#llx)\n ", nidstr, lcfg->lcfg_nid); }