xfs: prevent against ioend livelocks in xfs_file_fsync
[sfrench/cifs-2.6.git] / fs / xfs / linux-2.6 / xfs_file.c
index 825390e1c13850985c634fcbaec19c88ce2d6e46..7f7b42469ea7c9653903d0ffbe00769d40a168eb 100644 (file)
@@ -149,7 +149,9 @@ xfs_file_fsync(
 
        xfs_iflags_clear(ip, XFS_ITRUNCATED);
 
+       xfs_ilock(ip, XFS_IOLOCK_SHARED);
        xfs_ioend_wait(ip);
+       xfs_iunlock(ip, XFS_IOLOCK_SHARED);
 
        if (mp->m_flags & XFS_MOUNT_BARRIER) {
                /*