aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/xen-blkback/xenbus.c
diff options
context:
space:
mode:
authorRoger Pau Monne <roger.pau@citrix.com>2014-02-04 11:26:14 +0100
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>2014-02-07 12:59:30 -0500
commitc05f3e3c85df1d89673e00cee7ece5ae4eb4c6ec (patch)
treebf77875d2640a0f4388aa9c20d7867e51878c45a /drivers/block/xen-blkback/xenbus.c
parentxen-blkback: fix memory leaks (diff)
downloadlinux-dev-c05f3e3c85df1d89673e00cee7ece5ae4eb4c6ec.tar.xz
linux-dev-c05f3e3c85df1d89673e00cee7ece5ae4eb4c6ec.zip
xen-blkback: fix shutdown race
Introduce a new variable to keep track of the number of in-flight requests. We need to make sure that when xen_blkif_put is called the request has already been freed and we can safely free xen_blkif, which was not the case before. Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Cc: David Vrabel <david.vrabel@citrix.com> Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com> Tested-by: Matt Rushton <mrushton@amazon.com> Reviewed-by: Matt Rushton <mrushton@amazon.com> Cc: Matt Wilson <msw@amazon.com> Cc: Ian Campbell <Ian.Campbell@citrix.com> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Diffstat (limited to 'drivers/block/xen-blkback/xenbus.c')
-rw-r--r--drivers/block/xen-blkback/xenbus.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c
index 8afef67fecdd..84973c6a856a 100644
--- a/drivers/block/xen-blkback/xenbus.c
+++ b/drivers/block/xen-blkback/xenbus.c
@@ -128,6 +128,7 @@ static struct xen_blkif *xen_blkif_alloc(domid_t domid)
INIT_LIST_HEAD(&blkif->persistent_purge_list);
blkif->free_pages_num = 0;
atomic_set(&blkif->persistent_gnt_in_use, 0);
+ atomic_set(&blkif->inflight, 0);
INIT_LIST_HEAD(&blkif->pending_free);