Commit 4977b7a1 authored by Christoph Hellwig's avatar Christoph Hellwig

[XFS] Fix use of AIO wait_on_sync_kiocb and a deadlock in O_SYNC

inode semaphore handling.
parent 25fcf560
......@@ -164,8 +164,6 @@ __linvfs_readv(
if (unlikely(file->f_flags & O_DIRECT))
ioflags |= IO_ISDIRECT;
VOP_READ(vp, &kiocb, iov, nr_segs, &kiocb.ki_pos, ioflags, NULL, rval);
if (rval == -EIOCBQUEUED)
rval = wait_on_sync_kiocb(&kiocb);
*ppos = kiocb.ki_pos;
return rval;
......@@ -211,8 +209,6 @@ __linvfs_writev(
ioflags |= IO_ISDIRECT;
VOP_WRITE(vp, &kiocb, iov, nr_segs, &kiocb.ki_pos, ioflags, NULL, rval);
if (rval == -EIOCBQUEUED)
rval = wait_on_sync_kiocb(&kiocb);
*ppos = kiocb.ki_pos;
return rval;
......
......@@ -319,6 +319,8 @@ xfs_read(
xfs_rw_enter_trace(XFS_READ_ENTER, &ip->i_iocore,
(void *)iovp, segs, *offset, ioflags);
ret = __generic_file_aio_read(iocb, iovp, segs, offset);
if (ret == -EIOCBQUEUED)
ret = wait_on_sync_kiocb(iocb);
xfs_iunlock(ip, XFS_IOLOCK_SHARED);
if (ret > 0)
......@@ -846,6 +848,9 @@ xfs_write(
current->backing_dev_info = NULL;
if (ret == -EIOCBQUEUED)
ret = wait_on_sync_kiocb(iocb);
if ((ret == -ENOSPC) &&
DM_EVENT_ENABLED(vp->v_vfsp, xip, DM_EVENT_NOSPACE) &&
!(ioflags & IO_INVIS)) {
......@@ -953,13 +958,15 @@ xfs_write(
goto out_unlock_internal;
}
}
xfs_rwunlock(bdp, locktype);
if (need_isem)
up(&inode->i_sem);
error = sync_page_range(inode, mapping, pos, ret);
if (!error)
error = -ret;
goto out_unlock_isem;
error = ret;
return error;
}
out_unlock_internal:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment