# Re: \[PATCH v2 17/18\] vhost: don't bother copying iovecs in handle\_rx(), kill memcpy\_toiovecend()

- From: Al Viro \<viro@ZenIV.linux.org.uk\>
- Date: 2015-02-03 22:13:15 
- List: netdev
- Page: https://ratatoskr.run/netdev/2015/02/10977150
- Thread: https://ratatoskr.run/netdev/2015/01/10976815/t.md

```text
On Tue, Feb 03, 2015 at 04:21:54PM +0100, Michael S. Tsirkin wrote:
> > Hmm having second thoughts here.
> > Will this modify the iov in vq->iov?
> > If yes, how will recvmsg fill it?
> 
> OK that was just me misunderstanding what the
> function does. As it doesn't modify the iovec itself,
> I think there's no issue, my ack stands.

That, BTW, was the point of switching ->sendmsg() and ->recvmsg() to
iov_iter primitives - not only do memcpy_toiovec() et.al. change the
iovec, the way it's done was protocol-dependent, up to and including
the things like "have sent 60 caller-supplied bytes, iovec modified
with only 6 bytes consumed".  What's worse, on TCP sendmsg we usually
left iovec unchanged, but sometimes it got drained.  Granted, that
happened only after setsockopt() playing caller with TCP_REPAIR (i.e.
checkpoint/restart stuff), but...
```
