1

I am facing data corruption issue when using libaio to read data from an iscsi disk.

Steps Performed:

  • Allocate buffer(1MB) using posix_memalign with 4K Allignemnt.
  • Fill the buffer with 9 before submitting io.
  • Open iscsi disk with O_DIRECT flag.
  • Submit read requests using io_submit of libaio
  • In parallel execute vfork()
  • Call io_getevents and wait for io to complete
  • Check crc of buffer retrieved in io_getevents to check data is consistent or not.

The CRC matching is failed for some offset.

The CRC check is failing for some io. Before submitting io request i am filling the buffer with a pattern say '9', and i have analyzed the corrupted buffer and observed thatsome part of data in the buffer remains unchange, i.e same 9 is there in some part of buffer. The buffer is allocated with , 4K alligned using posix_memalign().

Is some one has also faced similar issue ? If there is any known limitation will you please share with me.

sagar
  • 367
  • 2
  • 12
  • Are you by chance doing io_getevents in the child process after vfork? The aio_context_t used in io_submit won't work in the child. – Mike Andrews Mar 01 '16 at 12:31
  • Hi Sir Thanks for the reply. Sorry but somehow one thread from the same process context was executing system() which internally calls clone. So the issue is not with vfork, rather vfork is safe to use.This system() intermingled with AIO was creating memory corruption. There is a RHEL Bug already locked for this issue. https://bugzilla.redhat.com/show_bug.cgi?id=471613, https://bugzilla.redhat.com/show_bug.cgi?id=512100. We have removed the system() with our own command executor and the data corruption is not occurring now. – sagar Apr 27 '16 at 09:17

0 Answers0