When I pushed down the i_mutex into ->fsync() I created a deadlock with xfs when writing O_SYNC. Fix this by dropping the filemap_write_and_wait_range() since it's done in ->fsync() now and call xfs_file_fsync() where we've dropped the i_mutex. This was suggested by Christoph and has passed xfstests. Thanks, Signed-off-by: Josef Bacik <josef@xxxxxxxxxx> --- fs/xfs/linux-2.6/xfs_file.c | 11 ++--------- 1 files changed, 2 insertions(+), 9 deletions(-) diff --git a/fs/xfs/linux-2.6/xfs_file.c b/fs/xfs/linux-2.6/xfs_file.c index 9183f75..1db8bd8 100644 --- a/fs/xfs/linux-2.6/xfs_file.c +++ b/fs/xfs/linux-2.6/xfs_file.c @@ -887,18 +887,11 @@ xfs_file_aio_write( /* Handle various SYNC-type writes */ if ((file->f_flags & O_DSYNC) || IS_SYNC(inode)) { loff_t end = pos + ret - 1; - int error, error2; xfs_rw_iunlock(ip, iolock); - error = filemap_write_and_wait_range(mapping, pos, end); + ret = -xfs_file_fsync(file, pos, end, + (file->f_flags & __O_SYNC) ? 0 : 1); xfs_rw_ilock(ip, iolock); - - error2 = -xfs_file_fsync(file, pos, end, - (file->f_flags & __O_SYNC) ? 0 : 1); - if (error) - ret = error; - else if (error2) - ret = error2; } out_unlock: -- 1.7.5.2 -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html