This reproduces the problem. It can probably be simplified still further. Make a UDF filesystem and mount it: fallocate /mnt2/udf_scratch -l 1G mount -o loop /mnt2/udf_scratch /xfstests.scratch ./the_program_below /xfstests.scratch/foo David --- #define __USE_GNU #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <fcntl.h> #include <err.h> # define O_DIRECT 040000 static char buf[256 * 1024] __attribute__((aligned(512))); static char *filename; static void cleanup(void) { if (unlink(filename) == -1) err(1, "unlink"); } int main(int argc, char **argv) { size_t page = 4096, big = 2 * page; int fd; if (argc != 2) { fprintf(stderr, "Format: %s <file>\n", argv[1]); exit(2); } filename = argv[1]; fd = open(filename, O_RDWR | O_CREAT | O_EXCL, 0666); if (fd == -1) err(1, "%s", filename); atexit(cleanup); if (pwrite(fd, buf, page, 0) != page) err(1, "pwrite/1"); if (pwrite(fd, buf, big, big) != big) err(1, "pwrite/2"); if (close(fd) == -1) err(1, "close"); fd = open(filename, O_RDWR | O_DIRECT); if (fd == -1) err(1, "%s", filename); if (pread(fd, buf, big, big) != big) err(1, "pread/1"); if (pread(fd, buf, big, 0) != big) err(1, "pread/2"); if (pwrite(fd, buf, big, 0) != big) err(1, "pwrite/3"); if (close(fd) == -1) err(1, "close"); return 0; }