+int ll_process_config_update(struct ll_sb_info *sbi, int clean)
+{
+ struct obd_export *mdc_exp = sbi->ll_mdc_exp;
+ struct lustre_mount_data *lmd = sbi->ll_lmd;
+ struct llog_ctxt *ctxt;
+ struct config_llog_instance cfg;
+ char *profile = lmd->lmd_profile, *name = NULL;
+ int rc, namelen = 0, version;
+ ENTRY;
+
+ if (profile == NULL)
+ RETURN(0);
+ if (lmd == NULL) {
+ CERROR("Client not mounted with zero-conf; cannot process "
+ "update log.\n");
+ RETURN(0);
+ }
+
+ rc = ldlm_cli_cancel_unused(mdc_exp->exp_obd->obd_namespace, NULL,
+ LDLM_FL_CONFIG_CHANGE, NULL);
+ if (rc != 0)
+ CWARN("ldlm_cli_cancel_unused(mdc): %d\n", rc);
+
+ rc = obd_cancel_unused(sbi->ll_osc_exp, NULL, LDLM_FL_CONFIG_CHANGE,
+ NULL);
+ if (rc != 0)
+ CWARN("obd_cancel_unused(lov): %d\n", rc);
+
+ cfg.cfg_instance = sbi->ll_instance;
+ cfg.cfg_uuid = sbi->ll_sb_uuid;
+ cfg.cfg_local_nid = lmd->lmd_local_nid;
+
+ namelen = strlen(profile) + 20; /* -clean-######### */
+ OBD_ALLOC(name, namelen);
+ if (name == NULL)
+ RETURN(-ENOMEM);
+
+ if (clean) {
+ version = sbi->ll_config_version - 1;
+ sprintf(name, "%s-clean-%d", profile, version);
+ } else {
+ version = sbi->ll_config_version + 1;
+ sprintf(name, "%s-%d", profile, version);
+ }
+
+ CWARN("Applying configuration log %s\n", name);
+
+ ctxt = llog_get_context(&mdc_exp->exp_obd->obd_llogs,
+ LLOG_CONFIG_REPL_CTXT);
+ rc = class_config_process_llog(ctxt, name, &cfg);
+ if (rc == 0)
+ sbi->ll_config_version = version;
+ CWARN("Finished applying configuration log %s: %d\n", name, rc);
+
+ if (rc == 0 && clean == 0) {
+ struct lov_desc desc;
+ int rc, valsize;
+ valsize = sizeof(desc);
+ rc = obd_get_info(sbi->ll_osc_exp, strlen("lovdesc") + 1,
+ "lovdesc", &valsize, &desc);
+
+ rc = obd_init_ea_size(mdc_exp,
+ obd_size_diskmd(sbi->ll_osc_exp, NULL),
+ (desc.ld_tgt_count *
+ sizeof(struct llog_cookie)));
+ }
+ OBD_FREE(name, namelen);
+ RETURN(rc);
+}