[Ocfs2-test-devel] [PATCH 1/2] Ocfs2-test: Handling boundary case of verfiy_tests on reflink_test.
Tao Ma
tao.ma at oracle.com
Thu Dec 3 05:52:10 PST 2009
sob for the 2 patches.
Thanks for your test.
Regards,
Tao
Tristan Ye wrote:
> For the newly added destrutive tests(intentional to reproduce bug 1191),
> we verify all chunks in original and reflinked file after destructive reboot
> by glancing writes record in a remote logfile. So the filesize we specify in
> the destructive and verify test should be the same as expected.
>
> This patch handle the case when the filesize were not the same, it avoids a
> short read or segfault when such extreme situation happened.
>
> Signed-off-by: Tristan Ye <tristan.ye at oracle.com>
> ---
> programs/reflink_tests/reflink_test_utils.c | 12 ++++++++++++
> 1 files changed, 12 insertions(+), 0 deletions(-)
>
> diff --git a/programs/reflink_tests/reflink_test_utils.c b/programs/reflink_tests/reflink_test_utils.c
> index a816255..4f314d0 100755
> --- a/programs/reflink_tests/reflink_test_utils.c
> +++ b/programs/reflink_tests/reflink_test_utils.c
> @@ -1597,6 +1597,12 @@ int verify_dest_file(char *log, struct dest_logs d_log, unsigned long chunk_no)
> continue;
> else {
> dwu.d_chunk_no = atol(arg1);
> + if (dwu.d_chunk_no > chunk_no) {
> + fprintf(stderr, "Chunkno grabed from logfile "
> + "exceeds the filesize, you may probably"
> + " specify a too small filesize.\n");
> + return -1;
> + }
> dwu.d_timestamp = atoll(arg2);
> dwu.d_checksum = atoi(arg3);
> dwu.d_char = arg4[0];
> @@ -1638,6 +1644,12 @@ int verify_dest_file(char *log, struct dest_logs d_log, unsigned long chunk_no)
> goto bail;
> }
>
> + if (ret < CHUNK_SIZE) {
> + fprintf(stderr, "Short read happened, you may probably"
> + " set too big filesize for verfiy_test.\n");
> + return -1;
> + }
> +
> /*
> dump_pattern(chunk_pattern, &dwu);
> fprintf(stdout, "#%lu\t%llu\t%d\t%c\n", dwus[i].d_chunk_no,
>
More information about the Ocfs2-test-devel
mailing list