qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Cc: kwolf@redhat.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] ISCSI: Only set up the read-event if we are actually waiting for data to come back in from the target.
Date: Fri, 11 May 2012 13:27:26 +0200	[thread overview]
Message-ID: <4FACF79E.6040100@redhat.com> (raw)
In-Reply-To: <1336731722-17743-2-git-send-email-ronniesahlberg@gmail.com>

Il 11/05/2012 12:22, Ronnie Sahlberg ha scritto:
> Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
> ---
>  block/iscsi.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/block/iscsi.c b/block/iscsi.c
> index d37c4ee..989b5e9 100644
> --- a/block/iscsi.c
> +++ b/block/iscsi.c
> @@ -105,7 +105,9 @@ iscsi_set_events(IscsiLun *iscsilun)
>  {
>      struct iscsi_context *iscsi = iscsilun->iscsi;
>  
> -    qemu_aio_set_fd_handler(iscsi_get_fd(iscsi), iscsi_process_read,
> +    qemu_aio_set_fd_handler(iscsi_get_fd(iscsi),
> +                           (iscsi_queue_length(iscsi) > 0)
> +                           ? iscsi_process_read : NULL,
>                             (iscsi_which_events(iscsi) & POLLOUT)
>                             ? iscsi_process_write : NULL,
>                             iscsi_process_flush, iscsilun);

I wonder if iscsi is also susceptible to the same race condition I saw
with NBD, where you can have:

1) select in the iothread exiting and reporting readability

2) the iothread subsequently blocking on the mutex

3) a VCPU thread's qemu_aio_wait() calling iscsi_process_read

4) when the VCPU releases the mutex, the iothread will call
iscsi_process_read again.

This should be easily reproducible with IDE drives, but the above patch
would not fix it.  Perhaps it's better to call iscsi_queue_length in
iscsi_process_read instead.

Paolo

  reply	other threads:[~2012-05-11 11:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-11 10:22 [Qemu-devel] [PATCH 0/1] ISCSI: Only set read-event if we have i/o in flight Ronnie Sahlberg
2012-05-11 10:22 ` [Qemu-devel] [PATCH] ISCSI: Only set up the read-event if we are actually waiting for data to come back in from the target Ronnie Sahlberg
2012-05-11 11:27   ` Paolo Bonzini [this message]
2012-05-11 12:39     ` ronnie sahlberg

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=4FACF79E.6040100@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=ronniesahlberg@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).