class_export_put(cld->cld_mgcexp);
OBD_FREE(cld->cld_logname, strlen(cld->cld_logname) + 1);
- if (cld->cld_cfg.cfg_instance != NULL)
- OBD_FREE(cld->cld_cfg.cfg_instance,
- strlen(cld->cld_cfg.cfg_instance) + 1);
OBD_FREE(cld, sizeof(*cld));
} else {
cfs_spin_unlock(&config_list_lock);
{
struct config_llog_data *cld;
char *logid = logname;
- int match_instance = 0;
ENTRY;
- if (cfg && cfg->cfg_instance) {
- match_instance++;
+ if (cfg)
logid = cfg->cfg_instance;
- }
+
if (!logid) {
CERROR("No log specified\n");
RETURN(ERR_PTR(-EINVAL));
cfs_spin_lock(&config_list_lock);
cfs_list_for_each_entry(cld, &config_llog_list, cld_list_chain) {
- if (match_instance && cld->cld_cfg.cfg_instance &&
- strcmp(logid, cld->cld_cfg.cfg_instance) == 0)
- goto out_found;
- if (!match_instance &&
- strcmp(logid, cld->cld_logname) == 0)
+ char *name = cld->cld_logname;
+ if (cfg)
+ name = cld->cld_cfg.cfg_instance;
+ if (strcmp(logid, name) == 0)
goto out_found;
}
cfs_spin_unlock(&config_list_lock);
/* Keep the mgc around until we are done */
cld->cld_mgcexp = class_export_get(obd->obd_self_export);
- if (cfg && cfg->cfg_instance != NULL) {
- OBD_ALLOC(cld->cld_cfg.cfg_instance,
- strlen(cfg->cfg_instance) + 1);
- strcpy(cld->cld_cfg.cfg_instance, cfg->cfg_instance);
- }
-
if (is_sptlrpc) {
sptlrpc_conf_log_start(logname);
cld->cld_cfg.cfg_obdname = obd->obd_name;
/* Always wait a few seconds to allow the server who
caused the lock revocation to finish its setup, plus some
random so everyone doesn't try to reconnect at once. */
- lwi_now = LWI_TIMEOUT(3 * CFS_HZ + (ll_rand() & 0xff) * \
+ lwi_now = LWI_TIMEOUT(3 * CFS_HZ + (cfs_rand() & 0xff) * \
(CFS_HZ / 100),
NULL, NULL);
l_wait_event(rq_waitq, rq_state & RQ_STOP, &lwi_now);
LASSERT(rq_state == 0);
rq_state = RQ_RUNNING | (later ? RQ_LATER : RQ_NOW);
cfs_spin_unlock(&config_list_lock);
- rc = cfs_kernel_thread(mgc_requeue_thread, 0,
- CLONE_VM | CLONE_FILES);
+ rc = cfs_create_thread(mgc_requeue_thread, NULL,
+ CFS_DAEMON_FLAGS);
if (rc < 0) {
CERROR("log %s: cannot start requeue thread (%d),"
"no more log updates!\n", cld->cld_logname, rc);
obd->obd_lvfs_ctxt.fs = get_ds();
push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
- dentry = lookup_one_len(MOUNT_CONFIGS_DIR, cfs_fs_pwd(current->fs),
- strlen(MOUNT_CONFIGS_DIR));
+ dentry = ll_lookup_one_len(MOUNT_CONFIGS_DIR, cfs_fs_pwd(current->fs),
+ strlen(MOUNT_CONFIGS_DIR));
pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
if (IS_ERR(dentry)) {
err = PTR_ERR(dentry);
cfs_spin_unlock(&config_list_lock);
cfs_waitq_signal(&rq_waitq);
}
+ obd_cleanup_client_import(obd);
rc = obd_llog_finish(obd, 0);
if (rc != 0)
CERROR("failed to cleanup llogging subsystems\n");
break;
case IMP_EVENT_OCD:
break;
+ case IMP_EVENT_DEACTIVATE:
+ case IMP_EVENT_ACTIVATE:
+ break;
default:
CERROR("Unknown import event %#x\n", event);
LBUG();
struct llog_ctxt *ctxt, *lctxt;
struct lustre_handle lockh;
struct client_obd *cli = &mgc->u.cli;
- struct lvfs_run_ctxt saved;
+ struct lvfs_run_ctxt *saved_ctxt;
struct lustre_sb_info *lsi = NULL;
int rc = 0, rcl, flags = 0, must_pop = 0;
ENTRY;
RETURN(-EINVAL);
}
+ OBD_ALLOC_PTR(saved_ctxt);
+ if (saved_ctxt == NULL) {
+ cfs_mutex_unlock(&cld->cld_lock);
+ RETURN(-ENOMEM);
+ }
+
/* Get the cfg lock on the llog */
rcl = mgc_enqueue(mgc->u.cli.cl_mgc_mgsexp, NULL, LDLM_PLAIN, NULL,
LCK_CR, &flags, NULL, NULL, NULL,
if (lctxt && lsi && (lsi->lsi_flags & LSI_SERVER) &&
(lsi->lsi_srv_mnt == cli->cl_mgc_vfsmnt) &&
!IS_MGS(lsi->lsi_ldd)) {
- push_ctxt(&saved, &mgc->obd_lvfs_ctxt, NULL);
+ push_ctxt(saved_ctxt, &mgc->obd_lvfs_ctxt, NULL);
must_pop++;
if (rcl == 0)
/* Only try to copy log if we have the lock. */
if (ctxt != lctxt)
llog_ctxt_put(lctxt);
if (must_pop)
- pop_ctxt(&saved, &mgc->obd_lvfs_ctxt, NULL);
+ pop_ctxt(saved_ctxt, &mgc->obd_lvfs_ctxt, NULL);
+ OBD_FREE_PTR(saved_ctxt);
/*
* update settings on existing OBDs. doing it inside
* of llog_process_lock so no device is attaching/detaching
static int mgc_process_config(struct obd_device *obd, obd_count len, void *buf)
{
struct lustre_cfg *lcfg = buf;
- int cmd;
+ struct config_llog_instance *cfg = NULL;
+ char *logname;
int rc = 0;
ENTRY;
- switch(cmd = lcfg->lcfg_command) {
+ switch(lcfg->lcfg_command) {
case LCFG_LOV_ADD_OBD: {
/* Overloading this cfg command: register a new target */
struct mgs_target_info *mti;
}
case LCFG_LOG_START: {
struct config_llog_data *cld;
- struct config_llog_instance *cfg;
struct super_block *sb;
- char *logname = lustre_cfg_string(lcfg, 1);
+
+ logname = lustre_cfg_string(lcfg, 1);
cfg = (struct config_llog_instance *)lustre_cfg_buf(lcfg, 2);
sb = *(struct super_block **)lustre_cfg_buf(lcfg, 3);
break;
}
case LCFG_LOG_END: {
- struct config_llog_instance *cfg = NULL;
- char *logname = lustre_cfg_string(lcfg, 1);
+ logname = lustre_cfg_string(lcfg, 1);
+
if (lcfg->lcfg_bufcount >= 2)
cfg = (struct config_llog_instance *)lustre_cfg_buf(
lcfg, 2);