Skip to content

Commit 82cfa33

Browse files
committed
syscalls/read02: Fix failures on Btrfs
Btrfs fallbacks to buffered I/O when file is opened with O_DIRECT and bufffer or length is not aligned and therefore such reads works fine. To quote Jan Kara: Historically what O_DIRECT means is: "Make my Oracle DB run faster." which was not well defined for the cases which the DB did not trigger and different people then came to different solutions for the cornercases. So this patch changes the O_DIRECT testcases to pass either if read() failed with EINVAL or if the buffer was read() fine. Signed-off-by: Cyril Hrubis <[email protected]>
1 parent caddfe5 commit 82cfa33

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

testcases/kernel/syscalls/read/read02.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,12 @@ static void read_verify(const struct test_case_t *test)
143143

144144
TEST(read(*test->fd, *test->buf, test->count));
145145

146+
if (*test->fd == fd4 && TEST_RETURN >= 0) {
147+
tst_resm(TPASS,
148+
"O_DIRECT unaligned reads fallbacks to buffered I/O");
149+
return;
150+
}
151+
146152
if (TEST_RETURN != -1) {
147153
tst_resm(TFAIL, "call succeeded unexpectedly");
148154
return;

0 commit comments

Comments
 (0)