]> www.infradead.org Git - users/jedix/linux-maple.git/commit
xfs: avoid direct I/O write vs buffered I/O race
authorChristoph Hellwig <hch@infradead.org>
Sat, 19 Nov 2011 18:13:41 +0000 (13:13 -0500)
committerMaxim Uvarov <maxim.uvarov@oracle.com>
Thu, 8 Dec 2011 19:19:20 +0000 (11:19 -0800)
commit7f957c67d3c6191c0400af51afa5f40aab52ff3c
tree08c3220f47d81e1932751784809e0177bc050b86
parent1b06009de72c6ec6f53ebdc9ab09719274a13175
xfs: avoid direct I/O write vs buffered I/O race

commit c58cb165bd44de8aaee9755a144136ae743be116 upstream.

Currently a buffered reader or writer can add pages to the pagecache
while we are waiting for the iolock in xfs_file_dio_aio_write.  Prevent
this by re-checking mapping->nrpages after we got the iolock, and if
nessecary upgrade the lock to exclusive mode.  To simplify this a bit
only take the ilock inside of xfs_file_aio_write_checks.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Alex Elder <aelder@sgi.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/xfs/linux-2.6/xfs_file.c