]> www.infradead.org Git - users/jedix/linux-maple.git/commit
ocfs2: serialize unaligned aio
authorMark Fasheh <mfasheh@suse.com>
Mon, 15 Aug 2011 17:08:44 +0000 (10:08 -0700)
committerMaxim Uvarov <maxim.uvarov@oracle.com>
Thu, 22 Mar 2012 00:17:23 +0000 (17:17 -0700)
commitf69db2ed9d7c6eb53197b2d302f0a420adce4da2
treedf10afed1f965139b0d5a2d9845db1a755a507e2
parentbf648f7a731d9662d8e01326e373f54dc2e15a26
ocfs2: serialize unaligned aio

[Pulled before push to mainline]

Fix a corruption that can happen when we have (two or more) outstanding
aio's to an overlapping unaligned region.  Ext4
(e9e3bcecf44c04b9e6b505fd8e2eb9cea58fb94d) and xfs recently had to fix
similar issues.

In our case what happens is that we can have an outstanding aio on a region
and if a write comes in with some bytes overlapping the original aio we may
decide to read that region into a page before continuing (typically because
of buffered-io fallback).  Since we have no ordering guarantees with the
aio, we can read stale or bad data into the page and then write it back out.

If the i/o is page and block aligned, then we avoid this issue as there
won't be any need to read data from disk.

I took the same approach as Eric in the ext4 patch and introduced some
serialization of unaligned async direct i/o.  I don't expect this to have an
effect on the most common cases of AIO.  Unaligned aio will be slower
though, but that's far more acceptable than data corruption.

Signed-off-by: Mark Fasheh <mfasheh@suse.com>
Signed-off-by: Joel Becker <jlbec@evilplan.org>
fs/ocfs2/aops.c
fs/ocfs2/aops.h
fs/ocfs2/file.c
fs/ocfs2/inode.h
fs/ocfs2/super.c