Skip to content

Commit

Permalink
Merge branch 'stable/for-jens-4.13' of git://git.kernel.org/pub/scm/l…
Browse files Browse the repository at this point in the history
…inux/kernel/git/konrad/xen into for-linus

Pull xen-blkback fix from Konrad:

"[...] A bug-fix when shutting down xen block backend driver with
 multiple queues and the driver not clearing all of them."
  • Loading branch information
Jens Axboe committed Aug 29, 2017
2 parents 22d5382 + dc52d78 commit 015a2f8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions drivers/block/xen-blkback/xenbus.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ static int xen_blkif_disconnect(struct xen_blkif *blkif)
{
struct pending_req *req, *n;
unsigned int j, r;
bool busy = false;

for (r = 0; r < blkif->nr_rings; r++) {
struct xen_blkif_ring *ring = &blkif->rings[r];
Expand All @@ -261,8 +262,10 @@ static int xen_blkif_disconnect(struct xen_blkif *blkif)
* don't have any discard_io or other_io requests. So, checking
* for inflight IO is enough.
*/
if (atomic_read(&ring->inflight) > 0)
return -EBUSY;
if (atomic_read(&ring->inflight) > 0) {
busy = true;
continue;
}

if (ring->irq) {
unbind_from_irqhandler(ring->irq, ring);
Expand Down Expand Up @@ -300,6 +303,9 @@ static int xen_blkif_disconnect(struct xen_blkif *blkif)
WARN_ON(i != (XEN_BLKIF_REQS_PER_PAGE * blkif->nr_ring_pages));
ring->active = false;
}
if (busy)
return -EBUSY;

blkif->nr_ring_pages = 0;
/*
* blkif->rings was allocated in connect_ring, so we should free it in
Expand Down

0 comments on commit 015a2f8

Please sign in to comment.