On Sun, Nov 12, 2017 at 9:59 AM, Leo Chen <liangc8367@xxxxxxxxx> wrote: > > > I wrote a program to verify my thought. Surprisingly, the readers did > occasionally read back mixed data. For example, in the first pwrite(), > the writer writes all 0x11, and in the 2nd pwrite(), it writes all > 0x22, and in the 3rd write, it writes all 0x33... Occasionally, a > reader can read back data like "0x11, 0x11, .... 0x11, 0x22, 0x22.... > 0x22". The data appears to be from two consecutive pwrite() calls. I > checked the offset where the broken starts. The offset seems to be > sector-aligned (512-byte-aligned). > Just for clarification purpose, the writer loop looks like while(true) { memset(aligned_buffer, seed, 128KB); pwrite(fd, aligned_buffer, 128KB); seed++; } the reader loop looks like: while(true) { pread(fd, aligned_reader_buffer, 128KB); verify_aligned_reader_buffer(); } Thanks, Leo