]> www.infradead.org Git - mtd-utils.git/commitdiff
integck.c: Only verify the operation after all datastructures have been updated
authorElie De Brauwer <eliedebrauwer@gmail.com>
Fri, 1 Mar 2013 18:37:37 +0000 (19:37 +0100)
committerArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Mon, 11 Mar 2013 08:33:58 +0000 (10:33 +0200)
<quote>
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
...
</quote>
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 <eliedebrauwer@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
tests/fs-tests/integrity/integck.c

index 087a18b0355ab8ea4106dde01745b167b3aa5359..2c6ffea7601848a7d7e7d7979679aca379954e7b 100644 (file)
@@ -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 */