Lachlan McIlroy 25051158bb [XFS] Fix race in xfs_write() between direct and buffered I/O with DMAPI
The iolock is dropped and re-acquired around the call to XFS_SEND_NAMESP().
While the iolock is released the file can become cached.  We then
'goto retry' and - if we are doing direct I/O - mapping->nrpages may now be
non zero but need_i_mutex will be zero and we will hit the WARN_ON().

Since we have dropped the I/O lock then the file size may have also changed
so what we need to do here is 'goto start' like we do for the XFS_SEND_DATA()
DMAPI event.

We also need to update the filesize before releasing the iolock so that
needs to be done before the XFS_SEND_NAMESP event.  If we drop the iolock
before setting the filesize we could race with a truncate.

Reviewed-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
2008-12-24 14:07:32 +11:00
..
2008-04-29 16:07:48 +10:00
2008-12-04 15:39:25 +11:00
2008-08-13 16:22:40 +10:00
2008-12-01 11:37:20 +11:00
2008-07-28 16:58:35 +10:00
2008-12-01 11:29:28 +11:00
2008-12-01 11:37:35 +11:00
2008-10-30 17:53:24 +11:00
2008-12-11 13:14:17 +11:00
2008-12-04 15:39:21 +11:00
2008-11-17 17:37:10 +11:00
2008-12-04 15:39:24 +11:00
2008-12-11 13:14:17 +11:00
2008-10-30 17:53:24 +11:00
2008-12-04 15:39:22 +11:00
2008-12-11 13:13:33 +11:00
2008-12-11 13:14:17 +11:00
2008-10-30 16:55:13 +11:00