Fix regression in handling of incompressible chunks.
Attempt to properly signal exit on decompression error (not working yet).
This commit is contained in:
parent
7ef20ec5be
commit
4360c5581f
1 changed files with 17 additions and 4 deletions
19
pcompress.c
19
pcompress.c
|
@ -355,8 +355,6 @@ preproc_compress(pc_ctx_t *pctx, compress_func_ptr cmp_func, void *src, uint64_t
|
||||||
get_mb_s(srclen, strt, en)));
|
get_mb_s(srclen, strt, en)));
|
||||||
} else {
|
} else {
|
||||||
DEBUG_STAT_EN(fprintf(stderr, "Chunk did not compress.\n"));
|
DEBUG_STAT_EN(fprintf(stderr, "Chunk did not compress.\n"));
|
||||||
memcpy(dest+1, src, srclen);
|
|
||||||
*dstlen = srclen + 1;
|
|
||||||
/*
|
/*
|
||||||
* If compression failed but one of the pre-processing succeeded then
|
* If compression failed but one of the pre-processing succeeded then
|
||||||
* type flags will be non-zero. In that case we still indicate a success
|
* type flags will be non-zero. In that case we still indicate a success
|
||||||
|
@ -364,8 +362,17 @@ preproc_compress(pc_ctx_t *pctx, compress_func_ptr cmp_func, void *src, uint64_t
|
||||||
* type flags will indicate that compression was not done and the
|
* type flags will indicate that compression was not done and the
|
||||||
* decompress routine will not be called.
|
* decompress routine will not be called.
|
||||||
*/
|
*/
|
||||||
if (type > 0)
|
if (type > 0) {
|
||||||
|
memcpy(dest+1, src, srclen);
|
||||||
|
*dstlen = srclen + 1;
|
||||||
result = 0;
|
result = 0;
|
||||||
|
} else {
|
||||||
|
/*
|
||||||
|
* Not Compressed and not preprocessed. Ensure that we signal
|
||||||
|
* error upstream, so this is handled correctly.
|
||||||
|
*/
|
||||||
|
result = -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return (result);
|
return (result);
|
||||||
}
|
}
|
||||||
|
@ -500,6 +507,9 @@ perform_decompress(void *dat)
|
||||||
pctx = tdat->pctx;
|
pctx = tdat->pctx;
|
||||||
redo:
|
redo:
|
||||||
Sem_Wait(&tdat->start_sem);
|
Sem_Wait(&tdat->start_sem);
|
||||||
|
if (pctx->main_cancel)
|
||||||
|
return (NULL);
|
||||||
|
|
||||||
if (unlikely(tdat->cancel)) {
|
if (unlikely(tdat->cancel)) {
|
||||||
tdat->len_cmp = 0;
|
tdat->len_cmp = 0;
|
||||||
Sem_Post(&tdat->cmp_done_sem);
|
Sem_Post(&tdat->cmp_done_sem);
|
||||||
|
@ -752,12 +762,15 @@ redo:
|
||||||
tdat->len_cmp = 0;
|
tdat->len_cmp = 0;
|
||||||
log_msg(LOG_ERR, 0, "ERROR: Chunk %d, checksums do not match.", tdat->id);
|
log_msg(LOG_ERR, 0, "ERROR: Chunk %d, checksums do not match.", tdat->id);
|
||||||
pctx->t_errored = 1;
|
pctx->t_errored = 1;
|
||||||
|
pctx->main_cancel = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cont:
|
cont:
|
||||||
Sem_Post(&tdat->cmp_done_sem);
|
Sem_Post(&tdat->cmp_done_sem);
|
||||||
|
if (!pctx->t_errored)
|
||||||
goto redo;
|
goto redo;
|
||||||
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue