]> git.hungrycats.org Git - linux/commitdiff
xen/blkback: don't use xen_blkif_get() in xen-blkback kthread
authorJuergen Gross <jgross@suse.com>
Thu, 18 May 2017 15:28:49 +0000 (17:28 +0200)
committerSasha Levin <alexander.levin@verizon.com>
Sun, 10 Sep 2017 20:35:51 +0000 (16:35 -0400)
[ Upstream commit a24fa22ce22ae302b3bf8f7008896d52d5d57b8d ]

There is no need to use xen_blkif_get()/xen_blkif_put() in the kthread
of xen-blkback. Thread stopping is synchronous and using the blkif
reference counting in the kthread will avoid to ever let the reference
count drop to zero at the end of an I/O running concurrent to
disconnecting and multiple rings.

Setting ring->xenblkd to NULL after stopping the kthread isn't needed
as the kthread does this already.

Signed-off-by: Juergen Gross <jgross@suse.com>
Tested-by: Steven Haigh <netwiz@crc.id.au>
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
drivers/block/xen-blkback/blkback.c
drivers/block/xen-blkback/xenbus.c

index 3e9ec9523f735f0f24f47fb019c5b6bfe00d0e03..1d8c6cb89c7f351120f035e50a2139d58de70d32 100644 (file)
@@ -588,8 +588,6 @@ int xen_blkif_schedule(void *arg)
        unsigned long timeout;
        int ret;
 
-       xen_blkif_get(blkif);
-
        while (!kthread_should_stop()) {
                if (try_to_freeze())
                        continue;
@@ -643,7 +641,6 @@ purge_gnt_list:
                print_stats(blkif);
 
        blkif->xenblkd = NULL;
-       xen_blkif_put(blkif);
 
        return 0;
 }
index 6ab69ad61ee126c6f62a63f77674b13489de7f73..b8c48da3b19fa26875fa0045a2897e546f5fe6e2 100644 (file)
@@ -256,7 +256,6 @@ static int xen_blkif_disconnect(struct xen_blkif *blkif)
        if (blkif->xenblkd) {
                kthread_stop(blkif->xenblkd);
                wake_up(&blkif->shutdown_wq);
-               blkif->xenblkd = NULL;
        }
 
        /* The above kthread_stop() guarantees that at this point we