Skip to content

Commit

Permalink
Refine split block reconstruction
Browse files Browse the repository at this point in the history
Due to a flaw in 4589f3a the number of unique combinations
could be calculated incorrectly.  This could result in the
random combinations reconstruction being used when it would
have been possible to check all combinations.

This change fixes the unique combinations calculation and
simplifies the reconstruction logic by maintaining a per-
segment list of unique copies.

The vdev_indirect_splits_damage() function was introduced
to validate both the enumeration and random reconstruction
logic with ztest.  It is implemented such it will never
make a known recoverable block unrecoverable.

Reviewed-by: Matthew Ahrens <mahrens@delphix.com>
Reviewed-by: Serapheim Dimitropoulos <serapheim@delphix.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #6900 
Closes #7934
  • Loading branch information
behlendorf authored Oct 1, 2018
1 parent d126145 commit 1258bd7
Show file tree
Hide file tree
Showing 3 changed files with 274 additions and 123 deletions.
10 changes: 9 additions & 1 deletion cmd/ztest/ztest.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ extern int zfs_abd_scatter_enabled;
extern int dmu_object_alloc_chunk_shift;
extern boolean_t zfs_force_some_double_word_sm_entries;
extern unsigned long zio_decompress_fail_fraction;
extern unsigned long zfs_reconstruct_indirect_damage_fraction;

static ztest_shared_opts_t *ztest_shared_opts;
static ztest_shared_opts_t ztest_opts;
Expand Down Expand Up @@ -6479,7 +6480,7 @@ ztest_run_zdb(char *pool)

(void) sprintf(zdb,
"%s -bcc%s%s -G -d -U %s "
"-o zfs_reconstruct_indirect_combinations_max=1000000 %s",
"-o zfs_reconstruct_indirect_combinations_max=65536 %s",
bin,
ztest_opts.zo_verbose >= 3 ? "s" : "",
ztest_opts.zo_verbose >= 4 ? "v" : "",
Expand Down Expand Up @@ -7518,6 +7519,13 @@ main(int argc, char **argv)
*/
zfs_force_some_double_word_sm_entries = B_TRUE;

/*
* Verify that even extensively damaged split blocks with many
* segments can be reconstructed in a reasonable amount of time
* when reconstruction is known to be possible.
*/
zfs_reconstruct_indirect_damage_fraction = 4;

action.sa_handler = sig_handler;
sigemptyset(&action.sa_mask);
action.sa_flags = 0;
Expand Down
2 changes: 1 addition & 1 deletion man/man5/zfs-module-parameters.5
Original file line number Diff line number Diff line change
Expand Up @@ -1965,7 +1965,7 @@ combinations each time the block is accessed. This allows all segment
copies to participate fairly in the reconstruction when all combinations
cannot be checked and prevents repeated use of one bad copy.
.sp
Default value: \fB100\fR.
Default value: \fB256\fR.
.RE

.sp
Expand Down
Loading

0 comments on commit 1258bd7

Please sign in to comment.