#include <obd_class.h>
#include <lustre_dlm.h>
+#include <lprocfs_status.h>
#include <lustre_log.h>
#include <lustre_fsfilt.h>
#include <lustre_disk.h>
+#include "mgc_internal.h"
static int mgc_name2resid(char *name, int len, 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 */
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)
{
/* Only for the last mgc */
class_del_profiles();
+ lprocfs_obd_cleanup(obd);
ptlrpcd_decref();
rc = client_obd_cleanup(obd);
static int mgc_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
{
+ struct lprocfs_static_vars lvars;
int rc;
ENTRY;
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) {
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)
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);
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))
}
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);
switch (event) {
case IMP_EVENT_DISCON:
/* MGC imports should not wait for recovery */
- ptlrpc_invalidate_import(imp);
break;
case IMP_EVENT_INACTIVE:
break;
}
case IMP_EVENT_ACTIVE:
LCONSOLE_WARN("%s: Reactivating import\n", obd->obd_name);
+ /* Clearing obd_no_recov allows us to continue pinging */
+ obd->obd_no_recov = 0;
break;
case IMP_EVENT_OCD:
break;
"\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