Am 02.02.2015 um 02:19 hat Wen Congyang geschrieben:
> On 01/30/2015 09:39 PM, Kevin Wolf wrote:
> > Am 30.01.2015 um 09:07 hat Wen Congyang geschrieben:
> >> If the child touches qiov->iov, it will cause unexpected results.
> >>
> >> Signed-off-by: Wen Congyang <we...@cn.fujitsu.com>
> > 
> > Any specific child you're thinking of?
> > 
> > I think children are not supposed to modify their qiov (which would also
> > fail for init_external qiovs). Perhaps we should have made it const.
> 
> NBD client. The qiov will be modified in iov_send_recv():
> nbd_co_writev()
>     nbd_client_session_co_writev()
>         nbd_co_writev_1()
>             nbd_co_send_request()
>                 qemu_co_sendv()
>                     qemu_co_sendv_recvv()
>                         iov_send_recv()

Paolo, I think it's rather surprising that iov_send_recv() modifies its
iov. The modification is undone at the end, so you seem to have
considered that a caller might be reusing it after and you can't "use it
up", but we still get problems with concurrent accesses.

Was it an intentional design decision that iov_send_recv() is the sole
owner of the iov and the caller must duplicate it if it's used elsewhere
concurrently?

Otherwise I would suggest to fix iov_send_recv(), and possibly try and
make all the qiov/iov arguments in the block layer const.

Kevin

Reply via email to