From 681d1d6c311ac918986e964f65097d556b2acd78 Mon Sep 17 00:00:00 2001 From: Elie De Brauwer Date: Fri, 1 Mar 2013 19:37:37 +0100 Subject: integck.c: Only verify the operation after all datastructures have been updated integck: File Data: integck: Offset: 0 Size: 196 Seed: 5999877 R.Off: 0 integck: Offset: 196 Size: 33 Seed: 4160795 R.Off: 0 integck: Offset: 229 Size: 1252 Seed: 8070052 R.Off: 0 integck: Offset: 1481 Size: 612 Seed: 4160795 R.Off: 1285 integck: Offset: 2093 Size: 6 Seed: 6946586 R.Off: 0 integck: Offset: 2099 Size: 536 Seed: 4160795 R.Off: 1903 integck: Offset: 2635 Size: 1562 Seed: 9845455 R.Off: 0 integck: Offset: 4197 Size: 80 Seed: 702818 R.Off: 0 integck: Offset: 4277 Size: 115 Seed: 9845455 R.Off: 1642 integck: 9 writes integck: ============================================ integck: Write Info: integck: Offset: 826 Size: 357 Seed: 5908448 R.Off: 0 integck: Offset: 4197 Size: 80 Seed: 702818 R.Off: 0 ... And I would expect the file data listing to include at offset 826 something with a size of 357 and a seed of 5908448. Clearly it is not there (which is already extremely confusing). The point is that file_write_info first updates the raw_write, then verifies the data (passing the new write) and only after that updates the write structure. But in file_check_data only the newly written data is verified (passed as an argument) whilst the save_file() function to dump the file uses the raw_writes to recreate the written data (while raw_writes is only updated after after this check would have succeeded). Several lines to say that in this patch the verify only gets called _after_ the datastructures are updated. Signed-off-by: Elie De Brauwer Signed-off-by: Artem Bityutskiy --- tests/fs-tests/integrity/integck.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/fs-tests/integrity/integck.c b/tests/fs-tests/integrity/integck.c index 087a18b..2c6ffea 100644 --- a/tests/fs-tests/integrity/integck.c +++ b/tests/fs-tests/integrity/integck.c @@ -960,9 +960,6 @@ static void file_write_info(struct file_info *file, int fd, off_t offset, w->random_seed = seed; file->raw_writes = w; - if (args.verify_ops && !args.power_cut_mode) - file_check_data(file, fd, new_write); - /* Insert it into file->writes */ inserted = 0; end = offset + size; @@ -1028,6 +1025,9 @@ static void file_write_info(struct file_info *file, int fd, off_t offset, /* Update file length */ if (end > file->length) file->length = end; + + if (args.verify_ops && !args.power_cut_mode) + file_check_data(file, fd, new_write); } /* Randomly select offset and and size to write in a file */ -- cgit v1.2.3