@@ -469,7 +469,8 @@ ssize_t nfs_file_direct_read(struct kiocb *iocb, struct iov_iter *iter,
requested -= result;
iocb->ki_pos += result;
}
- iov_iter_revert(iter, requested);
+ if (is_sync_kiocb(iocb))
+ iov_iter_revert(iter, requested);
} else {
result = requested;
}
@@ -1028,7 +1029,8 @@ ssize_t nfs_file_direct_write(struct kiocb *iocb, struct iov_iter *iter,
/* XXX: should check the generic_write_sync retval */
generic_write_sync(iocb, result);
}
- iov_iter_revert(iter, requested);
+ if (is_sync_kiocb(iocb))
+ iov_iter_revert(iter, requested);
} else {
result = requested;
}
For AIO, nfs_direct_wait return -EIOCBQUEUED would be expected. Revert iter is redundant. Signed-off-by: liuh <liuhuan01@kylinos.cn> --- fs/nfs/direct.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)