X-Git-Url: https://git.whamcloud.com/gitweb?a=blobdiff_plain;f=lustre%2Fmgc%2Fmgc_request.c;h=e7e05b889f54d937c74335facb42e024e04d4976;hb=de3c3fdf2597ba110a5247e271470b5dd626df75;hp=b4b44ce18eeeeb14e35de2fc8e8ab8627ba8e14b;hpb=5740a97945f1b8c5bf70ba68a829c41c29fb306f;p=fs%2Flustre-release.git diff --git a/lustre/mgc/mgc_request.c b/lustre/mgc/mgc_request.c index b4b44ce..e7e05b8 100644 --- a/lustre/mgc/mgc_request.c +++ b/lustre/mgc/mgc_request.c @@ -41,9 +41,11 @@ #include #include +#include #include #include #include +#include "mgc_internal.h" static int mgc_name2resid(char *name, int len, struct ldlm_res_id *res_id) { @@ -90,7 +92,7 @@ int mgc_logname2resid(char *logname, struct ldlm_res_id *res_id) } /********************** config llog list **********************/ -static struct list_head config_llog_list = LIST_HEAD_INIT(config_llog_list); +static CFS_LIST_HEAD(config_llog_list); static spinlock_t config_list_lock = SPIN_LOCK_UNLOCKED; /* Take a reference to a config log */ @@ -246,6 +248,7 @@ static cfs_waitq_t rq_waitq; static int mgc_process_log(struct obd_device *mgc, struct config_llog_data *cld); +static int mgc_requeue_add(struct config_llog_data *cld, int later); static int mgc_requeue_thread(void *data) { @@ -464,12 +467,12 @@ static int mgc_precleanup(struct obd_device *obd, enum obd_cleanup_stage stage) spin_unlock(&config_list_lock); cfs_waitq_signal(&rq_waitq); } - break; - case OBD_CLEANUP_SELF_EXP: rc = obd_llog_finish(obd, 0); if (rc != 0) CERROR("failed to cleanup llogging subsystems\n"); break; + case OBD_CLEANUP_SELF_EXP: + break; case OBD_CLEANUP_OBD: break; } @@ -490,6 +493,7 @@ static int mgc_cleanup(struct obd_device *obd) /* Only for the last mgc */ class_del_profiles(); + lprocfs_obd_cleanup(obd); ptlrpcd_decref(); rc = client_obd_cleanup(obd); @@ -498,6 +502,7 @@ static int mgc_cleanup(struct obd_device *obd) static int mgc_setup(struct obd_device *obd, struct lustre_cfg *lcfg) { + struct lprocfs_static_vars lvars; int rc; ENTRY; @@ -507,12 +512,15 @@ static int mgc_setup(struct obd_device *obd, struct lustre_cfg *lcfg) if (rc) GOTO(err_decref, rc); - rc = obd_llog_init(obd, OBD_LLOG_GROUP, obd, 0, NULL, NULL); + rc = obd_llog_init(obd, &obd->obd_olg, obd, 0, NULL, NULL); if (rc) { CERROR("failed to setup llogging subsystems\n"); GOTO(err_cleanup, rc); } + lprocfs_mgc_init_vars(&lvars); + lprocfs_obd_setup(obd, lvars.obd_vars); + spin_lock(&config_list_lock); atomic_inc(&mgc_count); if (atomic_read(&mgc_count) == 1) { @@ -520,7 +528,7 @@ static int mgc_setup(struct obd_device *obd, struct lustre_cfg *lcfg) cfs_waitq_init(&rq_waitq); } spin_unlock(&config_list_lock); - + RETURN(rc); err_cleanup: @@ -764,33 +772,6 @@ static int mgc_target_register(struct obd_export *exp, RETURN(rc); } -int mgc_reconnect_import(struct obd_import *imp) -{ - /* Force a new connect attempt */ - ptlrpc_invalidate_import(imp); - /* Do a fresh connect next time by zeroing the handle */ - ptlrpc_disconnect_import(imp, 1); - /* Wait for all invalidate calls to finish */ - if (atomic_read(&imp->imp_inval_count) > 0) { - int rc; - struct l_wait_info lwi = LWI_INTR(LWI_ON_SIGNAL_NOOP, NULL); - rc = l_wait_event(imp->imp_recovery_waitq, - (atomic_read(&imp->imp_inval_count) == 0), - &lwi); - if (rc) - CERROR("Interrupted, inval=%d\n", - atomic_read(&imp->imp_inval_count)); - } - - /* Allow reconnect attempts */ - imp->imp_obd->obd_no_recov = 0; - /* Remove 'invalid' flag */ - ptlrpc_activate_import(imp); - /* Attempt a new connect */ - ptlrpc_recover_import(imp, NULL); - return 0; -} - int mgc_set_info_async(struct obd_export *exp, obd_count keylen, void *key, obd_count vallen, void *val, struct ptlrpc_request_set *set) @@ -829,11 +810,11 @@ int mgc_set_info_async(struct obd_export *exp, obd_count keylen, ptlrpc_import_state_name(imp->imp_state)); /* Resurrect if we previously died */ if (imp->imp_invalid || value > 1) - mgc_reconnect_import(imp); + ptlrpc_reconnect_import(imp); RETURN(0); } /* FIXME move this to mgc_process_config */ - if (KEY_IS("register_target")) { + if (KEY_IS(KEY_REGISTER_TARGET)) { struct mgs_target_info *mti; if (vallen != sizeof(struct mgs_target_info)) RETURN(-EINVAL); @@ -843,7 +824,7 @@ int mgc_set_info_async(struct obd_export *exp, obd_count keylen, rc = mgc_target_register(exp, mti); RETURN(rc); } - if (KEY_IS("set_fs")) { + if (KEY_IS(KEY_SET_FS)) { struct super_block *sb = (struct super_block *)val; struct lustre_sb_info *lsi; if (vallen != sizeof(struct super_block)) @@ -855,7 +836,7 @@ int mgc_set_info_async(struct obd_export *exp, obd_count keylen, } RETURN(rc); } - if (KEY_IS("clear_fs")) { + if (KEY_IS(KEY_CLEAR_FS)) { if (vallen != 0) RETURN(-EINVAL); rc = mgc_fs_cleanup(exp->exp_obd); @@ -887,7 +868,6 @@ static int mgc_import_event(struct obd_device *obd, switch (event) { case IMP_EVENT_DISCON: /* MGC imports should not wait for recovery */ - ptlrpc_invalidate_import(imp); break; case IMP_EVENT_INACTIVE: break; @@ -910,17 +890,15 @@ static int mgc_import_event(struct obd_device *obd, RETURN(rc); } -static int mgc_llog_init(struct obd_device *obd, int group, +static int mgc_llog_init(struct obd_device *obd, struct obd_llog_group *olg, struct obd_device *tgt, int count, struct llog_catid *logid, struct obd_uuid *uuid) { struct llog_ctxt *ctxt; - struct obd_llog_group *olg = &obd->obd_olg; int rc; ENTRY; - LASSERT(group == OBD_LLOG_GROUP); - LASSERT(olg->olg_group == group); + LASSERT(olg == &obd->obd_olg); rc = llog_setup(obd, olg, LLOG_CONFIG_ORIG_CTXT, tgt, 0, NULL, &llog_lvfs_ops); @@ -1103,7 +1081,7 @@ static int mgc_process_log(struct obd_device *mgc, if (cld->cld_stopping) RETURN(0); - OBD_FAIL_TIMEOUT(OBD_FAIL_MGC_PROCESS_LOG, 20); + OBD_FAIL_TIMEOUT(OBD_FAIL_MGC_PAUSE_PROCESS_LOG, 20); lsi = s2lsi(cld->cld_cfg.cfg_sb); @@ -1148,8 +1126,9 @@ static int mgc_process_log(struct obd_device *mgc, "\n", cld->cld_logname); GOTO(out_pop, rc = -ENOTCONN); } - LCONSOLE_WARN("Failed to get MGS log %s, using " - "local copy.\n", cld->cld_logname); + CDEBUG(D_MGC, "Failed to get MGS log %s, using local " + "copy for now, will try to update later.\n", + cld->cld_logname); } /* Now, whether we copied or not, start using the local llog. If we failed to copy, we'll start using whatever the old