All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Wolf <kwolf@redhat.com>
To: Wen Congyang <wency@cn.fujitsu.com>
Cc: pbonzini@redhat.com, qemu-devl <qemu-devel@nongnu.org>,
	Stefan Hajnoczi <stefanha@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] quorum: don't share qiov
Date: Tue, 3 Feb 2015 10:22:10 +0100	[thread overview]
Message-ID: <20150203092153.GA4488@noname.redhat.com> (raw)
In-Reply-To: <54CED08C.2080501@cn.fujitsu.com>

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 <wency@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	other threads:[~2015-02-03  9:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-30  8:07 [Qemu-devel] [PATCH] quorum: don't share qiov Wen Congyang
2015-01-30 13:39 ` Kevin Wolf
2015-02-02  1:19   ` Wen Congyang
2015-02-03  9:22     ` Kevin Wolf [this message]
2015-02-03 11:01       ` Paolo Bonzini
2015-02-09  2:10         ` Wen Congyang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150203092153.GA4488@noname.redhat.com \
    --to=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=wency@cn.fujitsu.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.