]> git.karo-electronics.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>
Mon, 12 Sep 2011 18:52:04 +0000 (13:52 -0500)
commit05d3202e28eb437a185d6c56fbf8fa8e1f638e6e
tree0562ed611c81c45f62ce531c81c31983fb16f391
parentb73d8f7667aa82ece204a9a2e5467b54a8ecd059
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