All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Fam Zheng <famz@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:41:41 +0100	[thread overview]
Message-ID: <56727545.60203@redhat.com> (raw)
In-Reply-To: <20151217011527.GB20007@ad.usersys.redhat.com>



On 17/12/2015 02:15, Fam Zheng wrote:
>> >      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.

Good point.

> 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.

Right, the issue is that all these calls are idempotent, but the
notifier may not; that is why I prefer to be safe and ensure that all
notifier additions are matched by a notify.  But you explained well why
this should be safe, I'll add a note to the commit message.

Paolo

  reply	other threads:[~2015-12-17  8:41 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
2015-12-17  8:41   ` Paolo Bonzini [this message]
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=56727545.60203@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=famz@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 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.