generic/574: remove invalid test of read completely past EOF
authorEric Biggers <ebiggers@google.com>
Mon, 8 Nov 2021 04:36:20 +0000 (20:36 -0800)
committerEryu Guan <guaneryu@gmail.com>
Sun, 14 Nov 2021 10:43:11 +0000 (18:43 +0800)
One of the test cases in generic/574 tests that if a file of length
130999 has fs-verity enabled, and if bytes 131000..131071 (i.e. some
bytes past EOF and in the same block as EOF) are corrupted with nonzero
values, then reads of the corrupted part should fail with EIO.

This isn't a valid test case, because reads that start at or past EOF
are allowed to simply return 0 without doing any I/O.

Therefore, don't run this test case.

This fixes a test failure caused by the kernel commit 8c8387ee3f55
("mm: stop filemap_read() from grabbing a superfluous page").

Note that the other test cases for this same corrupted file remain
valid, including testing that an error is reported during full file
reads and during mmap "reads".  This is because the fs-verity Merkle
tree is defined over full blocks, so the file's last block won't be
readable if it contains corrupted (nonzero) bytes past EOF.  This may
seem odd, but it's working as intended, especially considering that
bytes past EOF in a file's last block are exposed to userspace in mmaps.

Signed-off-by: Eric Biggers <ebiggers@google.com>
tests/generic/574
tests/generic/574.out

index df0ef95fb76e6ff86e249007ff714d1d5d1493ad..882baa21a3fee7404b54322165a93aa7099595db 100755 (executable)
@@ -106,7 +106,7 @@ corruption_test()
        dd if=$fsv_file bs=$FSV_BLOCK_SIZE iflag=direct status=none \
                of=/dev/null |& _filter_scratch
 
-       if ! $is_merkle_tree; then
+       if (( zap_offset < file_len )) && ! $is_merkle_tree; then
                echo "Validating corruption (reading just corrupted part)..."
                dd if=$fsv_file bs=1 skip=$zap_offset count=$zap_len \
                        of=/dev/null status=none |& _filter_scratch
index d43474c594afd50a2549b30f403d49e63b0e609d..3c08d3e8029484ae67615bd3c761a98b8f293daf 100644 (file)
@@ -63,8 +63,6 @@ Validating corruption (reading full file)...
 md5sum: SCRATCH_MNT/file.fsv: Input/output error
 Validating corruption (direct I/O)...
 dd: error reading 'SCRATCH_MNT/file.fsv': Input/output error
-Validating corruption (reading just corrupted part)...
-dd: error reading 'SCRATCH_MNT/file.fsv': Input/output error
 Validating corruption (reading full file via mmap)...
 Bus error
 Validating corruption (reading just corrupted part via mmap)...