* Re: [PATCH] block: xen-blkback: don't get/put blkif ref for each queue
[not found] <1474875384-24671-1-git-send-email-bob.liu@oracle.com>
@ 2016-09-26 14:14 ` Konrad Rzeszutek Wilk
0 siblings, 0 replies; 2+ messages in thread
From: Konrad Rzeszutek Wilk @ 2016-09-26 14:14 UTC (permalink / raw)
To: Bob Liu; +Cc: xen-devel, linux-kernel, roger.pau
On Mon, Sep 26, 2016 at 03:36:24PM +0800, Bob Liu wrote:
> xen_blkif_get/put() for each queue is useless, and introduces a bug:
>
> If there is I/O inflight when removing device, xen_blkif_disconnect() will
> return -EBUSY and xen_blkif_put() not be called.
> Which means the references are leaked, then even if I/O completed, the
> xen_blkif_put() won't call xen_blkif_deferred_free() to free resources anymore.
>
> Signed-off-by: Bob Liu <bob.liu@oracle.com>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> ---
> drivers/block/xen-blkback/xenbus.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c
> index 3cc6d1d..2e1bb6d 100644
> --- a/drivers/block/xen-blkback/xenbus.c
> +++ b/drivers/block/xen-blkback/xenbus.c
> @@ -159,7 +159,6 @@ static int xen_blkif_alloc_rings(struct xen_blkif *blkif)
> init_waitqueue_head(&ring->shutdown_wq);
> ring->blkif = blkif;
> ring->st_print = jiffies;
> - xen_blkif_get(blkif);
> }
>
> return 0;
> @@ -296,7 +295,6 @@ static int xen_blkif_disconnect(struct xen_blkif *blkif)
> BUG_ON(ring->free_pages_num != 0);
> BUG_ON(ring->persistent_gnt_c != 0);
> WARN_ON(i != (XEN_BLKIF_REQS_PER_PAGE * blkif->nr_ring_pages));
> - xen_blkif_put(blkif);
> }
> blkif->nr_ring_pages = 0;
> /*
> --
> 1.7.10.4
>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH] block: xen-blkback: don't get/put blkif ref for each queue
@ 2016-09-26 7:36 Bob Liu
0 siblings, 0 replies; 2+ messages in thread
From: Bob Liu @ 2016-09-26 7:36 UTC (permalink / raw)
To: xen-devel; +Cc: Bob Liu, linux-kernel, roger.pau
xen_blkif_get/put() for each queue is useless, and introduces a bug:
If there is I/O inflight when removing device, xen_blkif_disconnect() will
return -EBUSY and xen_blkif_put() not be called.
Which means the references are leaked, then even if I/O completed, the
xen_blkif_put() won't call xen_blkif_deferred_free() to free resources anymore.
Signed-off-by: Bob Liu <bob.liu@oracle.com>
---
drivers/block/xen-blkback/xenbus.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c
index 3cc6d1d..2e1bb6d 100644
--- a/drivers/block/xen-blkback/xenbus.c
+++ b/drivers/block/xen-blkback/xenbus.c
@@ -159,7 +159,6 @@ static int xen_blkif_alloc_rings(struct xen_blkif *blkif)
init_waitqueue_head(&ring->shutdown_wq);
ring->blkif = blkif;
ring->st_print = jiffies;
- xen_blkif_get(blkif);
}
return 0;
@@ -296,7 +295,6 @@ static int xen_blkif_disconnect(struct xen_blkif *blkif)
BUG_ON(ring->free_pages_num != 0);
BUG_ON(ring->persistent_gnt_c != 0);
WARN_ON(i != (XEN_BLKIF_REQS_PER_PAGE * blkif->nr_ring_pages));
- xen_blkif_put(blkif);
}
blkif->nr_ring_pages = 0;
/*
--
1.7.10.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-09-26 14:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <1474875384-24671-1-git-send-email-bob.liu@oracle.com>
2016-09-26 14:14 ` [PATCH] block: xen-blkback: don't get/put blkif ref for each queue Konrad Rzeszutek Wilk
2016-09-26 7:36 Bob Liu
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).