Skip to contentSkip to conversation

generic: unaligned direct AIO write test

PATCH New Zorro Lang 1 participant 1 message Mar 30, 2019

lore
Share & tools
lore

Zorro Lang

author
#0 lore raw

PATCH v3 1/1 generic: unaligned direct AIO write test

A simply reproducer from Frank Sorenson:

  ftruncate(fd, 65012224)
  io_prep_pwrite(iocbs[0], fd, buf[0], 1048576, 63963648);
  io_prep_pwrite(iocbs[1], fd, buf[1], 1048576, 65012224);

  io_submit(io_ctx, 1, &iocbs[0]);
  io_submit(io_ctx, 1, &iocbs[1]);

io_getevents(io_ctx, 2, 2, events, NULL)

help to find an ext4 corruption:

           **************** **************** ****************
           *    page 1    * *    page 2    * *    page 3    *
           **************** **************** ****************

existing 0000000000000000 0000000000000000 0000000000000000
write 1 AAAAAAAAAAAAAA AA
write 2 BBBBBBBBBBBBBB BB

result 00AAAAAAAAAAAAAA 00BBBBBBBBBBBBBB BB00000000000000
desired 00AAAAAAAAAAAAAA AABBBBBBBBBBBBBB BB00000000000000

This issue remind us we might miss unaligned AIO test for long time. We thought fsx cover this part, but looks like it's not. So this case trys to cover unaligned direct AIO write test on file with different initial truncate i_size.

---

Hi,

V3 contains below changes:
1) Change page-unaligned test to block-unaligned test.
2) Add more comments to .c program. And some unimportant changes.

BTW, after improve this case(V2), it found a XFS regression issue (not 100%). Refer to:
[PATCH] xfs: serialize unaligned dio writes against all other dio writes

Thanks,
Zorro

 .gitignore                                 |   1 +
 src/aio-dio-regress/aio-dio-write-verify.c | 341 +++++++++++++++++++++
 tests/generic/999                          |  95 ++++++
 tests/generic/999.out                      |   2 +
 tests/generic/group                        |   1 +
 5 files changed, 440 insertions(+)
 create mode 100644 src/aio-dio-regress/aio-dio-write-verify.c
 create mode 100755 tests/generic/999
 create mode 100644 tests/generic/999.out
.gitignore +1 -0
index 6454e4d6..c13fb713 100644
@@ -162,6 +162,7 @@
 /src/aio-dio-regress/aio-dio-invalidate-failure
 /src/aio-dio-regress/aio-dio-invalidate-readahead
 /src/aio-dio-regress/aio-dio-subblock-eof-read
+/src/aio-dio-regress/aio-dio-write-verify
 /src/aio-dio-regress/aio-free-ring-with-bogus-nr-pages
 /src/aio-dio-regress/aio-io-setup-with-nonwritable-context-pointer
 /src/aio-dio-regress/aio-last-ref-held-by-io
src/aio-dio-regress/aio-dio-write-verify.c new file +341 -0

341 lines not on this page · raw message

tests/generic/999 new file +95 -0

95 lines not on this page · raw message

tests/generic/999.out new file +2 -0
new file mode 100644
index 00000000..3b276ca8
@@ -0,0 +1,2 @@
+QA output created by 999
+Silence is golden
tests/generic/group +1 -0
index 78b9b45d..7ec25749 100644
@@ -538,3 +538,4 @@
 533 auto quick attr
 534 auto quick log
 535 auto quick log
+999 auto quick aio
Signature · 1 line
2.17.2