Moves the lock file where the first content file resides.

This commit is contained in:
Andrea Mazzoleni 2014-02-22 08:46:11 +01:00
parent 5c27e62cd2
commit 4b93f3e5ab
3 changed files with 14 additions and 6 deletions

12
state.c
View file

@ -516,12 +516,6 @@ void state_config(struct snapraid_state* state, const char* path, const char* co
state->parity_device[l] = st.st_dev;
/* set lock file if first parity */
if (l == 0) {
pathcpy(state->lockfile, sizeof(state->lockfile), state->parity_path[l]);
pathcat(state->lockfile, sizeof(state->lockfile), ".lock");
}
/* adjust the level */
if (state->level < l + 1)
state->level = l + 1;
@ -640,6 +634,12 @@ void state_config(struct snapraid_state* state, const char* path, const char* co
/* LCOV_EXCL_STOP */
}
/* set the lock file at the first content file */
if (tommy_list_empty(&state->contentlist)) {
pathcpy(state->lockfile, sizeof(state->lockfile), buffer);
pathcat(state->lockfile, sizeof(state->lockfile), ".lock");
}
content = content_alloc(buffer, st.st_dev);
tommy_list_insert_tail(&state->contentlist, &content->node, content);