X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fmgs%2Fmgs_llog.c;h=98a11081bdfb1bf01402516598fc4b276074076f;hb=2d617260aaa5f778ab8dcb006e2a827f4b8f8567;hp=a710617d1e8eae8e86d20ae7b8816b0d3ce2223f;hpb=3e3b02239a78ba748954bc0b6c5fabeb7eed8523;p=fs%2Flustre-release.git diff --git a/lustre/mgs/mgs_llog.c b/lustre/mgs/mgs_llog.c index a710617..98a1108 100644 --- a/lustre/mgs/mgs_llog.c +++ b/lustre/mgs/mgs_llog.c @@ -136,10 +136,10 @@ struct mgs_fsdb_handler_data */ /* It might be better to have a separate db file, instead of parsing the info out of the client log. This is slow and potentially error-prone. */ -static int mgs_fsdb_handler(struct llog_handle *llh, struct llog_rec_hdr *rec, - void *data) +static int mgs_fsdb_handler(const struct lu_env *env, struct llog_handle *llh, + struct llog_rec_hdr *rec, void *data) { - struct mgs_fsdb_handler_data *d = (struct mgs_fsdb_handler_data *) data; + struct mgs_fsdb_handler_data *d = data; struct fs_db *fsdb = d->fsdb; int cfg_len = rec->lrh_len; char *cfg_buf = (char*) (rec + 1); @@ -275,21 +275,22 @@ static int mgs_get_fsdb_from_llog(struct obd_device *obd, struct fs_db *fsdb) name_create(&logname, fsdb->fsdb_name, "-client"); cfs_mutex_lock(&fsdb->fsdb_mutex); push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); - rc = llog_create(ctxt, &loghandle, NULL, logname); - if (rc) - GOTO(out_pop, rc); + rc = llog_create(NULL, ctxt, &loghandle, NULL, logname); + if (rc) + GOTO(out_pop, rc); - rc = llog_init_handle(loghandle, LLOG_F_IS_PLAIN, NULL); + rc = llog_init_handle(NULL, loghandle, LLOG_F_IS_PLAIN, NULL); if (rc) GOTO(out_close, rc); if (llog_get_size(loghandle) <= 1) cfs_set_bit(FSDB_LOG_EMPTY, &fsdb->fsdb_flags); - rc = llog_process(loghandle, mgs_fsdb_handler, (void *) &d, NULL); - CDEBUG(D_INFO, "get_db = %d\n", rc); + rc = llog_process(NULL, loghandle, mgs_fsdb_handler, (void *) &d, + NULL); + CDEBUG(D_INFO, "get_db = %d\n", rc); out_close: - rc2 = llog_close(loghandle); + rc2 = llog_close(NULL, loghandle); if (!rc) rc = rc2; out_pop: @@ -613,10 +614,11 @@ struct mgs_modify_lookup { int mml_modified; }; -static int mgs_modify_handler(struct llog_handle *llh, struct llog_rec_hdr *rec, - void *data) +static int mgs_modify_handler(const struct lu_env *env, + struct llog_handle *llh, + struct llog_rec_hdr *rec, void *data) { - struct mgs_modify_lookup *mml = (struct mgs_modify_lookup *)data; + struct mgs_modify_lookup *mml = data; struct cfg_marker *marker; struct lustre_cfg *lcfg = (struct lustre_cfg *)(rec + 1); int cfg_len = rec->lrh_len - sizeof(struct llog_rec_hdr) - @@ -655,8 +657,8 @@ static int mgs_modify_handler(struct llog_handle *llh, struct llog_rec_hdr *rec, /* Header and tail are added back to lrh_len in llog_lvfs_write_rec */ rec->lrh_len = cfg_len; - rc = llog_write_rec(llh, rec, NULL, 0, (void *)lcfg, - rec->lrh_index); + rc = llog_write_rec(NULL, llh, rec, NULL, 0, (void *)lcfg, + rec->lrh_index); if (!rc) mml->mml_modified++; } @@ -683,11 +685,11 @@ static int mgs_modify(struct obd_device *obd, struct fs_db *fsdb, ctxt = llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT); LASSERT(ctxt != NULL); - rc = llog_create(ctxt, &loghandle, NULL, logname); + rc = llog_create(NULL, ctxt, &loghandle, NULL, logname); if (rc) GOTO(out_pop, rc); - rc = llog_init_handle(loghandle, LLOG_F_IS_PLAIN, NULL); + rc = llog_init_handle(NULL, loghandle, LLOG_F_IS_PLAIN, NULL); if (rc) GOTO(out_close, rc); @@ -703,13 +705,14 @@ static int mgs_modify(struct obd_device *obd, struct fs_db *fsdb, mml->mml_marker.cm_flags = flags; mml->mml_marker.cm_canceltime = flags ? cfs_time_current_sec() : 0; mml->mml_modified = 0; - rc = llog_process(loghandle, mgs_modify_handler, (void *)mml, NULL); + rc = llog_process(NULL, loghandle, mgs_modify_handler, (void *)mml, + NULL); if (!rc && !mml->mml_modified) rc = -ENODEV; OBD_FREE_PTR(mml); out_close: - rc2 = llog_close(loghandle); + rc2 = llog_close(NULL, loghandle); if (!rc) rc = rc2; out_pop: @@ -742,7 +745,7 @@ static int record_lcfg(struct obd_device *obd, struct llog_handle *llh, push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); /* idx = -1 means append */ - rc = llog_write_rec(llh, &rec, NULL, 0, (void *)lcfg, -1); + rc = llog_write_rec(NULL, llh, &rec, NULL, 0, (void *)lcfg, -1); pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); if (rc) CERROR("failed %d\n", rc); @@ -924,11 +927,11 @@ static int record_start_log(struct obd_device *obd, GOTO(out, rc = -ENODEV); push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); - rc = llog_create(ctxt, llh, NULL, name); - if (rc == 0) - llog_init_handle(*llh, LLOG_F_IS_PLAIN, &cfg_uuid); - else - *llh = NULL; + rc = llog_create(NULL, ctxt, llh, NULL, name); + if (rc == 0) + llog_init_handle(NULL, *llh, LLOG_F_IS_PLAIN, &cfg_uuid); + else + *llh = NULL; pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); llog_ctxt_put(ctxt); @@ -947,7 +950,7 @@ static int record_end_log(struct obd_device *obd, struct llog_handle **llh) push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); - rc = llog_close(*llh); + rc = llog_close(NULL, *llh); *llh = NULL; pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); @@ -964,11 +967,11 @@ static int mgs_log_is_empty(struct obd_device *obd, char *name) ctxt = llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT); LASSERT(ctxt != NULL); push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); - rc = llog_create(ctxt, &llh, NULL, name); + rc = llog_create(NULL, ctxt, &llh, NULL, name); if (rc == 0) { - llog_init_handle(llh, LLOG_F_IS_PLAIN, NULL); - rc = llog_get_size(llh); - llog_close(llh); + llog_init_handle(NULL, llh, LLOG_F_IS_PLAIN, NULL); + rc = llog_get_size(llh); + llog_close(NULL, llh); } pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); llog_ctxt_put(ctxt); @@ -1085,9 +1088,9 @@ static int mgs_write_log_osc_to_lov(struct obd_device *obd, struct fs_db *fsdb, static void name_create_mdt_and_lov(char **logname, char **lovname, struct fs_db *fsdb, int i); -static int mgs_steal_llog_handler(struct llog_handle *llh, - struct llog_rec_hdr *rec, - void *data) +static int mgs_steal_llog_handler(const struct lu_env *env, + struct llog_handle *llh, + struct llog_rec_hdr *rec, void *data) { struct obd_device * obd; struct mgs_target_info *mti, *tmti; @@ -1259,18 +1262,19 @@ static int mgs_steal_llog_for_mdt_from_client(struct obd_device *obd, push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); - rc = llog_create(ctxt, &loghandle, NULL, client_name); + rc = llog_create(NULL, ctxt, &loghandle, NULL, client_name); if (rc) GOTO(out_pop, rc); - rc = llog_init_handle(loghandle, LLOG_F_IS_PLAIN, NULL); + rc = llog_init_handle(NULL, loghandle, LLOG_F_IS_PLAIN, NULL); if (rc) GOTO(out_close, rc); - rc = llog_process(loghandle, mgs_steal_llog_handler, (void *)comp, NULL); + rc = llog_process(NULL, loghandle, mgs_steal_llog_handler, + (void *)comp, NULL); CDEBUG(D_MGS, "steal llog re = %d\n", rc); out_close: - rc2 = llog_close(loghandle); + rc2 = llog_close(NULL, loghandle); if (!rc) rc = rc2; out_pop: @@ -2045,6 +2049,20 @@ static int mgs_write_log_sys(struct obd_device *obd, struct fs_db *fsdb, rc = mgs_write_log_direct_all(obd, fsdb, mti, *tmp == '\0' ? NULL : lcfg, mti->mti_fsname, sys); + if (rc == 0 && *tmp != '\0') { + switch (cmd) { + case LCFG_SET_TIMEOUT: + if (!obd_timeout_set || lcfg->lcfg_num > obd_timeout) + class_process_config(lcfg); + break; + case LCFG_SET_LDLM_TIMEOUT: + if (!ldlm_timeout_set || lcfg->lcfg_num > ldlm_timeout) + class_process_config(lcfg); + break; + default: + break; + } + } *ptr = sep; lustre_cfg_free(lcfg); return rc; @@ -2278,11 +2296,11 @@ struct mgs_srpc_read_data { int msrd_skip; }; -static int mgs_srpc_read_handler(struct llog_handle *llh, - struct llog_rec_hdr *rec, - void *data) +static int mgs_srpc_read_handler(const struct lu_env *env, + struct llog_handle *llh, + struct llog_rec_hdr *rec, void *data) { - struct mgs_srpc_read_data *msrd = (struct mgs_srpc_read_data *) data; + struct mgs_srpc_read_data *msrd = data; struct cfg_marker *marker; struct lustre_cfg *lcfg = (struct lustre_cfg *)(rec + 1); char *svname, *param; @@ -2366,11 +2384,11 @@ int mgs_get_fsdb_srpc_from_llog(struct obd_device *obd, push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); - rc = llog_create(ctxt, &llh, NULL, logname); + rc = llog_create(NULL, ctxt, &llh, NULL, logname); if (rc) GOTO(out_pop, rc); - rc = llog_init_handle(llh, LLOG_F_IS_PLAIN, NULL); + rc = llog_init_handle(NULL, llh, LLOG_F_IS_PLAIN, NULL); if (rc) GOTO(out_close, rc); @@ -2380,10 +2398,11 @@ int mgs_get_fsdb_srpc_from_llog(struct obd_device *obd, msrd.msrd_fsdb = fsdb; msrd.msrd_skip = 0; - rc = llog_process(llh, mgs_srpc_read_handler, (void *) &msrd, NULL); + rc = llog_process(NULL, llh, mgs_srpc_read_handler, (void *) &msrd, + NULL); out_close: - llog_close(llh); + llog_close(NULL, llh); out_pop: pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); out: @@ -2882,10 +2901,10 @@ int mgs_erase_log(struct obd_device *obd, char *name) LASSERT(ctxt != NULL); push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL); - rc = llog_create(ctxt, &llh, NULL, name); - if (rc == 0) { - llog_init_handle(llh, LLOG_F_IS_PLAIN, NULL); - rc = llog_destroy(llh); + rc = llog_create(NULL, ctxt, &llh, NULL, name); + if (rc == 0) { + llog_init_handle(NULL, llh, LLOG_F_IS_PLAIN, NULL); + rc = llog_destroy(NULL, llh); llog_free_handle(llh); } pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);