RETURN(rc);
}
+/* mount opt is the third thing in client logs */
+static int mgs_write_log_mount_opt(const struct lu_env *env,
+ struct mgs_device *mgs, struct fs_db *fsdb,
+ char *logname)
+{
+ struct llog_handle *llh = NULL;
+ int rc = 0;
+
+ ENTRY;
+
+ CDEBUG(D_MGS, "Writing mount options log for %s\n", logname);
+
+ rc = record_start_log(env, mgs, &llh, logname);
+ if (rc)
+ RETURN(rc);
+
+ rc = record_marker(env, llh, fsdb, CM_START, logname, "mount opts");
+ if (rc)
+ GOTO(out_end, rc);
+ rc = record_mount_opt(env, llh, logname, fsdb->fsdb_clilov,
+ fsdb->fsdb_clilmv);
+ if (rc)
+ GOTO(out_end, rc);
+ rc = record_marker(env, llh, fsdb, CM_END, logname, "mount opts");
+ if (rc)
+ GOTO(out_end, rc);
+out_end:
+ record_end_log(env, &llh);
+ RETURN(rc);
+}
+
/* lmv is the second thing for client logs */
/* copied from mgs_write_log_lov. Please refer to that. */
static int mgs_write_log_lmv(const struct lu_env *env,
fsdb->fsdb_clilmv);
if (rc)
GOTO(out_free, rc);
+ rc = mgs_write_log_mount_opt(env, mgs, fsdb, cliname);
+ if (rc)
+ GOTO(out_free, rc);
}
/*
#11 L setup 0:MDC_uml1_mdsA_MNT_client 1:mdsA_UUID 2:uml1_UUID
#12 L add_uuid nid=uml2@tcp(0x20000c0a80202) 0: 1:uml2_UUID
#13 L add_conn 0:MDC_uml1_mdsA_MNT_client 1:uml2_UUID
- #14 L mount_option 0: 1:client 2:lov1 3:MDC_uml1_mdsA_MNT_client
*/
/* copy client info about lov/lmv */
if (rc)
GOTO(out_free, rc);
- /* add mountopts */
rc = record_start_log(env, mgs, &llh, cliname);
if (rc)
GOTO(out_free, rc);
- rc = record_marker(env, llh, fsdb, CM_START, cliname, "mount opts");
- if (rc)
- GOTO(out_end, rc);
- rc = record_mount_opt(env, llh, cliname, fsdb->fsdb_clilov,
- fsdb->fsdb_clilmv);
- if (rc)
- GOTO(out_end, rc);
- rc = record_marker(env, llh, fsdb, CM_END, cliname, "mount opts");
- if (rc)
- GOTO(out_end, rc);
-
/* for_all_existing_mdt except current one */
for (i = 0; i < INDEX_MAP_SIZE * 8; i++) {
if (i != mti->mti_stripe_index &&
fsdb->fsdb_clilmv);
if (rc)
GOTO(out_free, rc);
+ rc = mgs_write_log_mount_opt(env, mgs, fsdb, logname);
+ if (rc)
+ GOTO(out_free, rc);
}
rc = mgs_write_log_osc_to_lov(env, mgs, fsdb, mti, logname, "",
fsdb->fsdb_clilov, LUSTRE_SP_CLI, flags);
static LIST_HEAD(lustre_profile_list);
static DEFINE_SPINLOCK(lustre_profile_list_lock);
-struct lustre_profile *class_get_profile(const char *prof)
+static struct lustre_profile *class_get_profile_nolock(const char *prof)
{
struct lustre_profile *lprof;
ENTRY;
- spin_lock(&lustre_profile_list_lock);
list_for_each_entry(lprof, &lustre_profile_list, lp_list) {
- if (!strcmp(lprof->lp_profile, prof)) {
+ if (strcmp(lprof->lp_profile, prof) == 0) {
lprof->lp_refs++;
- spin_unlock(&lustre_profile_list_lock);
RETURN(lprof);
}
}
- spin_unlock(&lustre_profile_list_lock);
RETURN(NULL);
}
+
+struct lustre_profile *class_get_profile(const char *prof)
+{
+ struct lustre_profile *lprof;
+
+ ENTRY;
+ spin_lock(&lustre_profile_list_lock);
+ lprof = class_get_profile_nolock(prof);
+ spin_unlock(&lustre_profile_list_lock);
+ RETURN(lprof);
+}
EXPORT_SYMBOL(class_get_profile);
/**
CDEBUG(D_CONFIG, "Del profile %s\n", prof);
- lprof = class_get_profile(prof);
+ spin_lock(&lustre_profile_list_lock);
+ lprof = class_get_profile_nolock(prof);
if (lprof) {
- spin_lock(&lustre_profile_list_lock);
/* because get profile increments the ref counter */
lprof->lp_refs--;
list_del(&lprof->lp_list);
spin_unlock(&lustre_profile_list_lock);
class_put_profile(lprof);
+ } else {
+ spin_unlock(&lustre_profile_list_lock);
}
EXIT;
}