mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 10:51:54 -04:00
Opens filtered out files in read-only mode.
This commit is contained in:
parent
4c058d25e2
commit
e0acbda4bd
2 changed files with 14 additions and 4 deletions
2
TODO
2
TODO
|
|
@ -12,8 +12,6 @@ This 'init' will work also without a content file, and parity files.
|
|||
Instead 'sync' will require all of them.
|
||||
This will also help when running with the parity filesystem unmounted.
|
||||
|
||||
* Filtered out files should be opened in read-only mode.
|
||||
|
||||
* Adds a log option, to save log files with the date in the name. This could
|
||||
help to keep track of what happens during automated operations.
|
||||
We must keep the log to stdout/err, and only save a copy to the log file.
|
||||
|
|
|
|||
16
check.c
16
check.c
|
|
@ -602,7 +602,8 @@ static int state_check_process(struct snapraid_state* state, int check, int fix,
|
|||
}
|
||||
}
|
||||
|
||||
if (fix) {
|
||||
/* if fixing, and the file is not excluded, we must open for writing */
|
||||
if (fix && !file_flag_has(block_file_get(block), FILE_IS_EXCLUDED)) {
|
||||
/* if fixing, create the file, open for writing and resize if required */
|
||||
ret = handle_create(&handle[j], block_file_get(block));
|
||||
if (ret == -1) {
|
||||
|
|
@ -627,7 +628,7 @@ static int state_check_process(struct snapraid_state* state, int check, int fix,
|
|||
++recovered_error;
|
||||
}
|
||||
} else {
|
||||
/* if checking or hashing, open the file for reading */
|
||||
/* if checking or hashing, open the file only for reading */
|
||||
ret = handle_open(&handle[j], block_file_get(block));
|
||||
if (ret == -1) {
|
||||
/* save the failed block for the check/fix */
|
||||
|
|
@ -914,6 +915,17 @@ static int state_check_process(struct snapraid_state* state, int check, int fix,
|
|||
continue;
|
||||
}
|
||||
|
||||
/* if the file is excluded, we have nothing to fix */
|
||||
/* note that this check is required, because if the file is excluded */
|
||||
/* it's also possible to have it not opened, */
|
||||
/* and have the handle[j].file pointing to NULL. */
|
||||
/* A typical case is if the file is missing, */
|
||||
/* and the read-only open failed before. */
|
||||
if (file_flag_has(block_file_get(block), FILE_IS_EXCLUDED)) {
|
||||
/* nothing to do */
|
||||
continue;
|
||||
}
|
||||
|
||||
/* if it isn't the last block in the file */
|
||||
if (!block_is_last(block)) {
|
||||
/* nothing to do */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue