Ignores mount points.

This commit is contained in:
Andrea Mazzoleni 2013-06-21 23:57:58 +02:00
parent de25273d1a
commit 6a23acec2f
3 changed files with 16 additions and 19 deletions

View file

@ -12,6 +12,8 @@ SnapRAID HISTORY
* Added a lock file to avoid multiple running instances on the same array.
The file is named as parity file adding the .lock extension.
There is also the undocumented --test-skip-lock to avoid to check it.
* Automatically ignores, with warning, mount points inside the array
directory tree.
3.1 2013/5
==========

9
TODO
View file

@ -5,15 +5,6 @@ This is the list of TODO items for SnapRAID.
- v3.2
* Check the device of all the files and dirs in scan.c to avoid moint points.
} else if (S_ISDIR(st.st_mode)) {
if (st.st_dev!=disk->device) {
printf("Excluding mountpoint directory '%s'\n", path_next);
} else
if (filter_dir(&state->filterlist, disk->name, sub_next) == 0) {
...
}
* Allow to specify the shared path to use to access remote symlink.
* In the import list, uses also all the blocks in the array.

24
scan.c
View file

@ -664,18 +664,22 @@ static int scan_dir(struct snapraid_scan* scan, struct snapraid_state* state, in
}
} else if (S_ISDIR(st.st_mode)) {
if (filter_dir(&state->filterlist, disk->name, sub_next) == 0) {
char sub_dir[PATH_MAX];
if (st.st_dev != disk->device) {
fprintf(stderr, "warning: Ignoring mount point '%s'\n", path_next);
} else {
char sub_dir[PATH_MAX];
/* recurse */
pathslash(path_next, sizeof(path_next));
pathcpy(sub_dir, sizeof(sub_dir), sub_next);
pathslash(sub_dir, sizeof(sub_dir));
if (scan_dir(scan, state, output, disk, path_next, sub_dir) == 0) {
/* scan the directory as empty dir */
scan_emptydir(scan, state, output, disk, sub_next);
/* recurse */
pathslash(path_next, sizeof(path_next));
pathcpy(sub_dir, sizeof(sub_dir), sub_next);
pathslash(sub_dir, sizeof(sub_dir));
if (scan_dir(scan, state, output, disk, path_next, sub_dir) == 0) {
/* scan the directory as empty dir */
scan_emptydir(scan, state, output, disk, sub_next);
}
/* or we processed something internally, or we have added the empty dir */
processed = 1;
}
/* or we processed something internally, or we have added the empty dir */
processed = 1;
} else {
if (state->verbose) {
printf("Excluding directory '%s'\n", path_next);