From 5e8b74908e8d5f0a63ba411241684b4b81dd2fc9 Mon Sep 17 00:00:00 2001 From: shaver Date: Wed, 15 Oct 2003 00:17:02 +0000 Subject: [PATCH] b=1067: permit mounting of clients when OSTs are missing. Use --inactive on the lconf line to specify which OST(s) are to be skipped. Don't do this on the MDS right now, though! r=phik,robert --- lustre/ptlrpc/ptlrpc_lib.c | 79 ++++++++++++++++++++++++++-------------------- 1 file changed, 45 insertions(+), 34 deletions(-) diff --git a/lustre/ptlrpc/ptlrpc_lib.c b/lustre/ptlrpc/ptlrpc_lib.c index 8adb823..7f1853f 100644 --- a/lustre/ptlrpc/ptlrpc_lib.c +++ b/lustre/ptlrpc/ptlrpc_lib.c @@ -44,6 +44,10 @@ int client_obd_setup(struct obd_device *obddev, obd_count len, void *buf) struct obd_uuid server_uuid; int rq_portal, rp_portal, connect_op; char *name = obddev->obd_type->typ_name; + char *mgmt_name = lcfg->lcfg_inlbuf3; + int rc; + struct obd_device *mgmt_obd; + mgmtcli_register_for_events_t register_f; ENTRY; /* In a more perfect world, we would hang a ptlrpc_client off of @@ -124,7 +128,8 @@ int client_obd_setup(struct obd_device *obddev, obd_count len, void *buf) imp->imp_connect_op = connect_op; imp->imp_generation = 0; INIT_LIST_HEAD(&imp->imp_pinger_chain); - memcpy(imp->imp_target_uuid.uuid, lcfg->lcfg_inlbuf1, lcfg->lcfg_inllen1); + memcpy(imp->imp_target_uuid.uuid, lcfg->lcfg_inlbuf1, + lcfg->lcfg_inllen1); class_import_put(imp); cli->cl_import = imp; @@ -132,44 +137,50 @@ int client_obd_setup(struct obd_device *obddev, obd_count len, void *buf) cli->cl_max_mds_cookiesize = sizeof(struct llog_cookie); cli->cl_sandev = to_kdev_t(0); - obddev->obd_logops = &llogd_client_ops; - /* Register with management client if we need to. */ - if (lcfg->lcfg_inllen3 > 0) { - char *mgmt_name = lcfg->lcfg_inlbuf3; - int rc; - struct obd_device *mgmt_obd; - mgmtcli_register_for_events_t register_f; - - CDEBUG(D_HA, "%s registering with %s for events about %s\n", - obddev->obd_name, mgmt_name, server_uuid.uuid); - - mgmt_obd = class_name2obd(mgmt_name); - if (!mgmt_obd) { - CERROR("can't find mgmtcli %s to register\n", - mgmt_name); - class_destroy_import(imp); - RETURN(-ENOENT); - } + if (lcfg->lcfg_inllen3 == 0) + RETURN(0); + + if (!strcmp(lcfg->lcfg_inlbuf3, "inactive")) { + CDEBUG(D_HA, "marking %s %s->%s as inactive\n", + name, obddev->obd_name, imp->imp_target_uuid.uuid); + imp->imp_invalid = 1; - register_f = inter_module_get("mgmtcli_register_for_events"); - if (!register_f) { - CERROR("can't i_m_g mgmtcli_register_for_events\n"); - class_destroy_import(imp); - RETURN(-ENOSYS); - } + if (lcfg->lcfg_inllen4 == 0) + RETURN(0); - rc = register_f(mgmt_obd, obddev, &imp->imp_target_uuid); - inter_module_put("mgmtcli_register_for_events"); - - if (!rc) - cli->cl_mgmtcli_obd = mgmt_obd; - - RETURN(rc); + mgmt_name = lcfg->lcfg_inlbuf4; + } else { + mgmt_name = lcfg->lcfg_inlbuf3; } - - RETURN(0); + + /* Register with management client if we need to. */ + CDEBUG(D_HA, "%s registering with %s for events about %s\n", + obddev->obd_name, mgmt_name, server_uuid.uuid); + + mgmt_obd = class_name2obd(mgmt_name); + if (!mgmt_obd) { + CERROR("can't find mgmtcli %s to register\n", + mgmt_name); + class_destroy_import(imp); + RETURN(-ENOENT); + } + + register_f = inter_module_get("mgmtcli_register_for_events"); + if (!register_f) { + CERROR("can't i_m_g mgmtcli_register_for_events\n"); + class_destroy_import(imp); + RETURN(-ENOSYS); + } + + rc = register_f(mgmt_obd, obddev, &imp->imp_target_uuid); + inter_module_put("mgmtcli_register_for_events"); + + if (!rc) + cli->cl_mgmtcli_obd = mgmt_obd; + + RETURN(rc); } int client_obd_cleanup(struct obd_device *obddev, int flags) -- 1.8.3.1