[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20170425125924.jxl35mujvaej33ki@dhcp-3-128.uk.xensource.com>
Date: Tue, 25 Apr 2017 13:59:24 +0100
From: Roger Pau Monné <roger.pau@...rix.com>
To: Juergen Gross <jgross@...e.com>
CC: <linux-kernel@...r.kernel.org>, <xen-devel@...ts.xenproject.org>,
<konrad.wilk@...cle.com>, <stable@...r.kernel.org>
Subject: Re: [PATCH] xen/blkback: fix disconnect while I/Os in flight
On Fri, Apr 21, 2017 at 10:51:00AM +0200, Juergen Gross wrote:
> Today disconnecting xen-blkback is broken in case there are still
> I/Os in flight: xen_blkif_disconnect() will bail out early without
> releasing all resources in the hope it will be called again when
> the last request has terminated. This, however, won't happen as
> xen_blkif_free() won't be called on termination of the last running
> request: xen_blkif_put() won't decrement the blkif refcnt to 0 as
> xen_blkif_disconnect() didn't finish before thus some xen_blkif_put()
> calls in xen_blkif_disconnect() didn't happen.
>
> To solve this deadlock xen_blkif_disconnect() and
> xen_blkif_alloc_rings() shouldn't use xen_blkif_put() and
> xen_blkif_get() but use some other way to do their accounting of
> resources.
>
> This at once fixes another error in xen_blkif_disconnect(): when it
> returned early with -EBUSY for another ring than 0 it would call
> xen_blkif_put() again for already handled rings on a subsequent call.
> This will lead to inconsistencies in the refcnt handling.
>
> Cc: stable@...r.kernel.org
> Signed-off-by: Juergen Gross <jgross@...e.com>
> Tested-by: Steven Haigh <netwiz@....id.au>
Acked-by: Roger Pau Monné <roger.pau@...rix.com>
TBH, it seems like all this accounting in blkback could be improved quite a
lot. Right now this is just a complete caos.
Thanks, Roger.
Powered by blists - more mailing lists