Adds a check to avoid to use FUSE filesystem.

This commit is contained in:
Andrea Mazzoleni 2013-08-25 22:39:58 +02:00
parent 181c8e71cf
commit 1e4bc72098
5 changed files with 84 additions and 3 deletions

22
state.c
View file

@ -113,6 +113,26 @@ static void state_config_check(struct snapraid_state* state, const char* path)
#endif
if (!state->opt.force_device) {
int ret;
ret = fstype(disk->dir);
if (ret < 0) {
fprintf(stderr, "Error accessing disk '%s' to get the filesystem type. %s.\n", disk->dir, strerror(errno));
exit(EXIT_FAILURE);
}
if (ret == FSTYPE_FUSE) {
fprintf(stderr, "Disk '%s' has a filesystem managed by FUSE.\n", disk->dir);
fprintf(stderr, "FUSE doesn't support persistent inodes, and it cannot be\n");
fprintf(stderr, "used safely with SnapRAID.\n");
/* in "fix" we allow to continue anyway */
if (strcmp(state->command, "fix") == 0) {
fprintf(stderr, "You can '%s' anyway, using 'snapraid --force-device %s'.\n", state->command, state->command);
}
exit(EXIT_FAILURE);
}
for(j=i->next;j!=0;j=j->next) {
struct snapraid_disk* other = j->data;
if (disk->device == other->device) {
@ -675,6 +695,8 @@ static void state_map(struct snapraid_state* state)
/* removes all the mapping without a disk */
/* this happens when a disk is removed from the configuration file */
/* From SnapRAID 4.0 mappings are automatically removed if a disk is not used */
/* when saving the content file, but we keep this code to import older content files. */
for(i=state->maplist;i!=0;) {
struct snapraid_map* map = i->data;
struct snapraid_disk* disk;