@@ -471,7 +471,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;
}
@@ -1030,7 +1031,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;
}