virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Heinz Graalfs <graalfs@linux.vnet.ibm.com>
Cc: borntraeger@de.ibm.com, virtualization@lists.linux-foundation.org
Subject: Re: [PATCH v3 RFC 3/4] virtio_blk: avoid calling blk_cleanup_queue() on device loss
Date: Wed, 27 Nov 2013 14:49:56 +0200	[thread overview]
Message-ID: <20131127124956.GA30325@redhat.com> (raw)
In-Reply-To: <5295D95E.4070305@linux.vnet.ibm.com>

On Wed, Nov 27, 2013 at 12:37:02PM +0100, Heinz Graalfs wrote:
> On 27/11/13 11:47, Michael S. Tsirkin wrote:
> >On Wed, Nov 27, 2013 at 11:32:39AM +0100, Heinz Graalfs wrote:
> >>Code is added to avoid calling blk_cleanup_queue() when the surprize_removal
> >>flag is set due to a disappeared device. It avoid hangs due to incomplete
> >>requests (e.g. in-flight requests). Such requests must be considered as lost.
> >
> >Ugh. Can't we complete these immediately using detach_unused_buf? If not why?
> 
> OK, I will try
> 
> >
> >>If the current remove callback was triggered due to an unregister driver,
> >>and the surprize_removal is not already set (although the actual device
> >>is already gone, e.g. virsh detach), blk_cleanup_queue() would be triggered
> >>resulting in a possible hang. This hang is caused by e.g. 'in-flight' requests
> >>that will never complete. This is a weird situation, and most likely not
> >>'serializable'.
> >
> >Hmm interesting. Implement some timeout and probe device to make sure
> >it's still alive?
> 
> but there is always some race, isn't it?

To clarify, why this might not be very elegant, a timer-based
solution for surprise removal during driver cleanup
might be easier than trying to build robust interfaces
to address this esoteric case.

But what worries me is that it's not clear to me that ccw won't
invoke notify in parallel with remove callback.
If this happens there will be use after free.


-- 
MST

  parent reply	other threads:[~2013-11-27 12:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-27 10:32 [PATCH v3 RFC 0/4] virtio: add 'surprize_removal' to virtio_device Heinz Graalfs
2013-11-27 10:32 ` [PATCH v3 RFC 1/4] virtio: add surprize_removal " Heinz Graalfs
2013-11-27 10:32 ` [PATCH v3 RFC 2/4] virtio_blk: avoid further request queueing on device loss Heinz Graalfs
2013-12-04  4:04   ` Rusty Russell
2013-11-27 10:32 ` [PATCH v3 RFC 3/4] virtio_blk: avoid calling blk_cleanup_queue() " Heinz Graalfs
2013-11-27 10:47   ` Michael S. Tsirkin
2013-11-27 11:37     ` Heinz Graalfs
2013-11-27 12:28       ` Michael S. Tsirkin
2013-11-27 12:49       ` Michael S. Tsirkin [this message]
2013-11-27 14:15         ` Heinz Graalfs
2013-11-27 14:37           ` Michael S. Tsirkin
2013-11-27 10:32 ` [PATCH v3 RFC 4/4] virtio_ccw: set surprize_removal in virtio_device if a device was lost Heinz Graalfs
2013-11-27 10:49   ` Michael S. Tsirkin

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=20131127124956.GA30325@redhat.com \
    --to=mst@redhat.com \
    --cc=borntraeger@de.ibm.com \
    --cc=graalfs@linux.vnet.ibm.com \
    --cc=virtualization@lists.linux-foundation.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).