Whamcloud - gitweb
LU-10843 mgs: allow snapshot after MGS remount
[fs/lustre-release.git] / lustre / mgs / mgs_llog.c
index 350ab00..d9d110c 100644 (file)
@@ -541,14 +541,15 @@ int mgs_cleanup_fsdb_list(struct mgs_device *mgs)
        return 0;
 }
 
-int mgs_find_or_make_fsdb(const struct lu_env *env, struct mgs_device *mgs,
-                         char *name, struct fs_db **dbh)
+/* The caller must hold mgs->mgs_mutex. */
+int mgs_find_or_make_fsdb_nolock(const struct lu_env *env,
+                               struct mgs_device *mgs,
+                               char *name, struct fs_db **dbh)
 {
        struct fs_db *fsdb;
        int rc = 0;
        ENTRY;
 
-       mutex_lock(&mgs->mgs_mutex);
        fsdb = mgs_find_fsdb(mgs, name);
        if (!fsdb) {
                fsdb = mgs_new_fsdb(env, mgs, name);
@@ -557,7 +558,6 @@ int mgs_find_or_make_fsdb(const struct lu_env *env, struct mgs_device *mgs,
 
                CDEBUG(D_MGS, "Created new db: rc = %d\n", rc);
        }
-       mutex_unlock(&mgs->mgs_mutex);
 
        if (!rc)
                *dbh = fsdb;
@@ -565,6 +565,19 @@ int mgs_find_or_make_fsdb(const struct lu_env *env, struct mgs_device *mgs,
        RETURN(rc);
 }
 
+int mgs_find_or_make_fsdb(const struct lu_env *env, struct mgs_device *mgs,
+                         char *name, struct fs_db **dbh)
+{
+       int rc;
+       ENTRY;
+
+       mutex_lock(&mgs->mgs_mutex);
+       rc = mgs_find_or_make_fsdb_nolock(env, mgs, name, dbh);
+       mutex_unlock(&mgs->mgs_mutex);
+
+       RETURN(rc);
+}
+
 /* 1 = index in use
    0 = index unused
    -1= empty client log */