Check that the parity was fully allocated

We must check if any remaining size is left to be
allocated.
This commit is contained in:
Andrea Mazzoleni 2016-09-28 18:55:03 +02:00
parent a4c813bf8d
commit 422d642591
2 changed files with 7 additions and 1 deletions

View file

@ -577,6 +577,12 @@ int parity_chsize(struct snapraid_parity_handle* handle, struct snapraid_parity*
}
}
/* if we cannot allocate all the space */
if (size != 0) {
log_fatal("Failed to allocate all the required parity space. You miss %" PRIu64 " bytes.\n", size);
return -1;
}
/* now copy the new size in the parity data */
if (is_modified)
*is_modified = 0;

View file

@ -1518,7 +1518,7 @@ int state_sync(struct snapraid_state* state, block_off_t blockstart, block_off_t
data_off_t out_size;
parity_size(&parity_handle[l], &out_size);
parity_overflow(state, out_size);
log_fatal("WARNING! Without an accessible %s file, it isn't possible to sync.\n", lev_name(l));
log_fatal("WARNING! Without an unsable %s file, it isn't possible to sync.\n", lev_name(l));
exit(EXIT_FAILURE);
/* LCOV_EXCL_STOP */
}