if (rc == 0 && cld->cld_params != NULL) {
rc = mgc_process_log(obd, cld->cld_params);
if (rc == -ENOENT) {
- CDEBUG(D_MGC, "There is no params"
+ CDEBUG(D_MGC, "There is no params "
"config file yet\n");
rc = 0;
}
struct obd_device *obd;
struct lustre_mount_info *lmi;
struct llog_ctxt *ctxt;
+ struct fs_db *fsdb = NULL;
int rc;
ENTRY;
GOTO(err_llog, rc);
}
+ /* Setup params fsdb and log, so that other servers can make a local
+ * copy successfully when they are mounted. See LU-4783 */
+ rc = mgs_params_fsdb_setup(env, mgs, fsdb);
+ if (rc)
+ /* params fsdb and log can be setup later */
+ CERROR("%s: %s fsdb and log setup failed: rc = %d\n",
+ obd->obd_name, PARAMS_FILENAME, rc);
+
ptlrpc_init_client(LDLM_CB_REQUEST_PORTAL, LDLM_CB_REPLY_PORTAL,
"mgs_ldlm_client", &obd->obd_ldlm_client);
lu_site_purge(env, mgs2lu_dev(mgs)->ld_site, ~0);
RETURN(0);
err_lproc:
+ mgs_params_fsdb_cleanup(env, mgs);
lproc_mgs_cleanup(mgs);
err_llog:
ctxt = llog_get_context(mgs->mgs_obd, LLOG_CONFIG_ORIG_CTXT);
obd_zombie_barrier();
tgt_fini(env, &mgs->mgs_lut);
+ mgs_params_fsdb_cleanup(env, mgs);
mgs_cleanup_fsdb_list(mgs);
lproc_mgs_cleanup(mgs);
int mgs_init_fsdb_list(struct mgs_device *mgs);
int mgs_cleanup_fsdb_list(struct mgs_device *mgs);
-int mgs_find_or_make_fsdb(const struct lu_env *env, struct mgs_device *mgs, char *name,
- struct fs_db **dbh);
+int mgs_params_fsdb_setup(const struct lu_env *env, struct mgs_device *mgs,
+ struct fs_db *fsdb);
+int mgs_params_fsdb_cleanup(const struct lu_env *env, struct mgs_device *mgs);
+int mgs_find_or_make_fsdb(const struct lu_env *env, struct mgs_device *mgs,
+ char *name, struct fs_db **dbh);
struct fs_db *mgs_find_fsdb(struct mgs_device *mgs, char *fsname);
-int mgs_get_fsdb_srpc_from_llog(const struct lu_env *env, struct mgs_device *mgs, struct fs_db *fsdb);
-int mgs_check_index(const struct lu_env *env, struct mgs_device *mgs, struct mgs_target_info *mti);
-int mgs_check_failnid(const struct lu_env *env, struct mgs_device *mgs, struct mgs_target_info *mti);
-int mgs_write_log_target(const struct lu_env *env, struct mgs_device *mgs, struct mgs_target_info *mti,
- struct fs_db *fsdb);
-int mgs_replace_nids(const struct lu_env *env, struct mgs_device *mgs, char *devname, char *nids);
+int mgs_get_fsdb_srpc_from_llog(const struct lu_env *env,
+ struct mgs_device *mgs, struct fs_db *fsdb);
+int mgs_check_index(const struct lu_env *env, struct mgs_device *mgs,
+ struct mgs_target_info *mti);
+int mgs_check_failnid(const struct lu_env *env, struct mgs_device *mgs,
+ struct mgs_target_info *mti);
+int mgs_write_log_target(const struct lu_env *env, struct mgs_device *mgs,
+ struct mgs_target_info *mti, struct fs_db *fsdb);
+int mgs_replace_nids(const struct lu_env *env, struct mgs_device *mgs,
+ char *devname, char *nids);
int mgs_erase_log(const struct lu_env *env, struct mgs_device *mgs,
char *name);
int mgs_erase_logs(const struct lu_env *env, struct mgs_device *mgs,
static struct obd_uuid cfg_uuid = { .uuid = "config_uuid" };
struct llog_ctxt *ctxt;
int rc = 0;
+ ENTRY;
if (*llh)
GOTO(out, rc = -EBUSY);
EXIT;
}
+/* Setup params fsdb and log
+ */
+int mgs_params_fsdb_setup(const struct lu_env *env, struct mgs_device *mgs,
+ struct fs_db *fsdb)
+{
+ struct llog_handle *params_llh = NULL;
+ int rc;
+ ENTRY;
+
+ rc = mgs_find_or_make_fsdb(env, mgs, PARAMS_FILENAME, &fsdb);
+ if (fsdb != NULL) {
+ mutex_lock(&fsdb->fsdb_mutex);
+ rc = record_start_log(env, mgs, ¶ms_llh, PARAMS_FILENAME);
+ if (rc == 0)
+ rc = record_end_log(env, ¶ms_llh);
+ mutex_unlock(&fsdb->fsdb_mutex);
+ }
+
+ RETURN(rc);
+}
+
+/* Cleanup params fsdb and log
+ */
+int mgs_params_fsdb_cleanup(const struct lu_env *env, struct mgs_device *mgs)
+{
+ return mgs_erase_logs(env, mgs, PARAMS_FILENAME);
+}
+
/* Set a permanent (config log) param for a target or fs
* \param lcfg buf0 may contain the device (testfs-MDT0000) name
* buf1 contains the single parameter
}
run_test 75 "The order of --index should be irrelevant"
-test_76() {
+test_76a() {
[[ $(lustre_version_code mgs) -ge $(version_code 2.4.52) ]] ||
{ skip "Need MDS version at least 2.4.52" && return 0; }
setup
error "client_cache_count is not saved after remount"
stopall
}
-run_test 76 "set permanent params set_param -P"
+run_test 76a "set permanent params set_param -P"
+
+test_76b() { # LU-4783
+ [[ $(lustre_version_code mgs) -ge $(version_code 2.5.57) ]] ||
+ { skip "Need MGS version at least 2.5.57" && return 0; }
+ stopall
+ setupall
+ do_facet mgs $LCTL get_param mgs.MGS.live.params ||
+ error "start params log failed"
+ stopall
+}
+run_test 76b "verify params log setup correctly"
test_77() { # LU-3445
local server_version=$(lustre_version_code $SINGLEMDS)