]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
xfs: avoid direct I/O write vs buffered I/O race
authorChristoph Hellwig <hch@infradead.org>
Sat, 27 Aug 2011 14:42:53 +0000 (14:42 +0000)
committerAlex Elder <aelder@sgi.com>
Wed, 12 Oct 2011 02:15:01 +0000 (21:15 -0500)
commitc58cb165bd44de8aaee9755a144136ae743be116
tree47cf60c7555cf49eb76bbc682bd355e726f51df3
parent859f57ca00805e6c482eef1a7ab073097d02c8ca
xfs: avoid direct I/O write vs buffered I/O race

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>
fs/xfs/xfs_file.c