}
rc = 0;
CDEBUG(D_MGS, "MDT index is %u\n", index);
- set_bit(index, fsdb->fsdb_mdt_index_map);
- fsdb->fsdb_mdt_count ++;
- }
+ if (!test_bit(index, fsdb->fsdb_mdt_index_map)) {
+ set_bit(index, fsdb->fsdb_mdt_index_map);
+ fsdb->fsdb_mdt_count++;
+ }
+ }
/**
* figure out the old config. fsdb_gen = 0 means old log
if (strcmp(fsname, MGSSELF_NAME) == 0) {
set_bit(FSDB_MGS_SELF, &fsdb->fsdb_flags);
fsdb->fsdb_mgs = mgs;
+ if (logname_is_barrier(fsname))
+ goto add;
} else {
OBD_ALLOC(fsdb->fsdb_mdt_index_map, INDEX_MAP_SIZE);
if (!fsdb->fsdb_mdt_index_map) {
GOTO(err, rc = -ENOMEM);
}
+ if (logname_is_barrier(fsname))
+ goto add;
+
rc = name_create(&fsdb->fsdb_clilov, fsname, "-clilov");
if (rc)
GOTO(err, rc);
GOTO(err, rc);
}
+add:
/* One ref is for the fsdb on the list.
* The other ref is for the caller. */
atomic_set(&fsdb->fsdb_ref, 2);
lproc_mgs_del_live(mgs, fsdb);
/* deinitialize fsr */
- mgs_ir_fini_fs(mgs, fsdb);
+ if (fsdb->fsdb_mgs)
+ mgs_ir_fini_fs(mgs, fsdb);
if (fsdb->fsdb_ost_index_map)
OBD_FREE(fsdb->fsdb_ost_index_map, INDEX_MAP_SIZE);
if (rc == -1)
GOTO(out_up, rc = -ERANGE);
mti->mti_stripe_index = rc;
- if (mti->mti_flags & LDD_F_SV_TYPE_MDT)
- fsdb->fsdb_mdt_count ++;
}
/* the last index(0xffff) is reserved for default value. */
CDEBUG(D_MGS, "Server %s updating index %d\n",
mti->mti_svname, mti->mti_stripe_index);
GOTO(out_up, rc = EALREADY);
- }
- }
+ }
+ } else {
+ set_bit(mti->mti_stripe_index, imap);
+ if (mti->mti_flags & LDD_F_SV_TYPE_MDT)
+ fsdb->fsdb_mdt_count++;
+ }
set_bit(mti->mti_stripe_index, imap);
clear_bit(FSDB_LOG_EMPTY, &fsdb->fsdb_flags);
{
struct list_head log_list;
struct mgs_direntry *dirent, *n;
- int rc, len = strlen(fsname);
+ char barrier_name[20] = {};
char *suffix;
+ int rc, len = strlen(fsname);
ENTRY;
/* Find all the logs in the CONFIGS directory */
RETURN(rc);
mutex_lock(&mgs->mgs_mutex);
+ snprintf(barrier_name, sizeof(barrier_name) - 1, "%s-%s",
+ fsname, BARRIER_FILENAME);
+ /* Delete the barrier fsdb */
+ mgs_remove_fsdb_by_name(mgs, barrier_name);
/* Delete the fs db */
mgs_remove_fsdb_by_name(mgs, fsname);
mutex_unlock(&mgs->mgs_mutex);