diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/xfs/xfs_inode.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index 8d2b36879f06..88a517fad07b 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c | |||
@@ -1393,6 +1393,16 @@ xfs_itrunc_trace( | |||
1393 | * calling into the buffer/page cache code and we can't hold the | 1393 | * calling into the buffer/page cache code and we can't hold the |
1394 | * inode lock when we do so. | 1394 | * inode lock when we do so. |
1395 | * | 1395 | * |
1396 | * We need to wait for any direct I/Os in flight to complete before we | ||
1397 | * proceed with the truncate. This is needed to prevent the extents | ||
1398 | * being read or written by the direct I/Os from being removed while the | ||
1399 | * I/O is in flight as there is no other method of synchronising | ||
1400 | * direct I/O with the truncate operation. Also, because we hold | ||
1401 | * the IOLOCK in exclusive mode, we prevent new direct I/Os from being | ||
1402 | * started until the truncate completes and drops the lock. Essentially, | ||
1403 | * the vn_iowait() call forms an I/O barrier that provides strict ordering | ||
1404 | * between direct I/Os and the truncate operation. | ||
1405 | * | ||
1396 | * The flags parameter can have either the value XFS_ITRUNC_DEFINITE | 1406 | * The flags parameter can have either the value XFS_ITRUNC_DEFINITE |
1397 | * or XFS_ITRUNC_MAYBE. The XFS_ITRUNC_MAYBE value should be used | 1407 | * or XFS_ITRUNC_MAYBE. The XFS_ITRUNC_MAYBE value should be used |
1398 | * in the case that the caller is locking things out of order and | 1408 | * in the case that the caller is locking things out of order and |