qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Fam Zheng <famz@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] scsi: always call notifier on async cancellation
Date: Thu, 17 Dec 2015 09:15:27 +0800	[thread overview]
Message-ID: <20151217011527.GB20007@ad.usersys.redhat.com> (raw)
In-Reply-To: <1450290827-30508-2-git-send-email-pbonzini@redhat.com>

On Wed, 12/16 19:33, Paolo Bonzini wrote:
> This was found by code inspection.  If the request is cancelled twice,
> the notifier is never called on the second cancellation request,
> and hence for example a TMF might never finish.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  hw/scsi/scsi-bus.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c
> index 524a998..4c121fe 100644
> --- a/hw/scsi/scsi-bus.c
> +++ b/hw/scsi/scsi-bus.c
> @@ -1759,9 +1759,6 @@ void scsi_req_cancel_async(SCSIRequest *req, Notifier *notifier)
>      if (notifier) {
>          notifier_list_add(&req->cancel_notifiers, notifier);
>      }
> -    if (req->io_canceled) {
> -        return;
> -    }
>      scsi_req_ref(req);
>      scsi_req_dequeue(req);
>      req->io_canceled = true;
       if (req->aiocb) {
           blk_aio_cancel_async(req->aiocb);
       } else {
           scsi_req_cancel_complete(req);
       }

A second TMF must be blk_aio_cancel_async case, otherwise the first one would
have already completed the request synchronously in scsi_req_cancel_complete.
With that in mind, I think returning early is not a problem. But I suppose
these are also idempotent so this change is not breaking anything, either.

Fam

  reply	other threads:[~2015-12-17  1:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-16 18:33 [Qemu-devel] [PATCH] scsi: always call notifier on async cancellation Paolo Bonzini
2015-12-17  1:15 ` Fam Zheng [this message]
2015-12-17  8:41   ` Paolo Bonzini
2015-12-17 12:22     ` Fam Zheng

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=20151217011527.GB20007@ad.usersys.redhat.com \
    --to=famz@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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).