The AIO write code path does not guarantee that metadata has been written out to disk when the I/O completion is delivered. This comment exists in the code: /* By the time this function is called, all of the pages prior to * the current good_idx have been released appropriately. The remaining * duties are to release any remaining pages and to honour O_SYNC. */ static void __iodesc_finish_write(struct iodesc *io) but the bit about honouring O_SYNC is not implemented. I have not verified this with anything other than code inspection, at this point. I've attached a patch that should fix the problem.
Created attachment 127563 [details] Honor O_SYNC for AIO writes
Created attachment 127568 [details] Honor the O_SYNC flag for AIO writes. The previous patch would call generic_osync_inode w/o the i_sem held, which could result in a livelock. Note that this patch is subject to change with testing/review.
I don't believe that this bug fits the RHEL 3.9 release criteria, so I'm closing it as WONTFIX.