mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 19:01:57 -04:00
Checks parity UUID before proceding.
This commit is contained in:
parent
af4ec2286f
commit
87e6497665
2 changed files with 18 additions and 5 deletions
2
HISTORY
2
HISTORY
|
|
@ -19,6 +19,8 @@ SnapRAID HISTORY
|
|||
* Prints the time spent waiting for each disk also in 'scrub'.
|
||||
* The CPU usage, speed and ETA estimations are now based on the last 100
|
||||
seconds rather than from the start.
|
||||
* Keeps track of the UUID of the parity disks to check them before
|
||||
operating.
|
||||
* Windows binary built with gcc 4.8.1 using the MXE cross compiler 2.23.
|
||||
|
||||
6.3 2014/7
|
||||
|
|
|
|||
|
|
@ -1026,6 +1026,7 @@ static void state_map(struct snapraid_state* state)
|
|||
if (state->no_conf)
|
||||
return;
|
||||
|
||||
/* counter for the number of UUID mismatches */
|
||||
uuid_mismatch = 0;
|
||||
|
||||
/* checks if mapping match the disk uuid */
|
||||
|
|
@ -1088,11 +1089,21 @@ static void state_map(struct snapraid_state* state)
|
|||
continue;
|
||||
}
|
||||
|
||||
/* update the uuid in the mapping */
|
||||
/* at now we don't enforce uuid for parity */
|
||||
/* as the user is expected to have a different file name */
|
||||
/* for each parity file */
|
||||
pathcpy(state->parity[l].uuid, sizeof(state->parity[l].uuid), uuid);
|
||||
/* if the uuid is changed */
|
||||
if (strcmp(uuid, state->parity[l].uuid) != 0) {
|
||||
/* if the previous uuid is available */
|
||||
if (state->parity[l].uuid[0] != 0) {
|
||||
/* count the number of uuid change */
|
||||
++uuid_mismatch;
|
||||
fprintf(stderr, "UUID change for parity '%s' from '%s' to '%s'\n", lev_config_name(l), state->parity[l].uuid, uuid);
|
||||
}
|
||||
|
||||
/* update the uuid */
|
||||
pathcpy(state->parity[l].uuid, sizeof(state->parity[l].uuid), uuid);
|
||||
|
||||
/* write the new state with the new uuid */
|
||||
state->need_write = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue