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)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Tue, 13 Jun 2017 20:27:39 +0000 (16:27 -0400)
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>
drivers/block/xen-blkback/blkback.c
drivers/block/xen-blkback/xenbus.c

index 726c32e35db9c542e6f050ff0a04e31e10fc2b7d..6b14c509f3c7bbacc9aaaf034b40f55c6a613cf1 100644 (file)
@@ -609,8 +609,6 @@ int xen_blkif_schedule(void *arg)
        unsigned long timeout;
        int ret;
 
-       xen_blkif_get(blkif);
-
        set_freezable();
        while (!kthread_should_stop()) {
                if (try_to_freeze())
@@ -665,7 +663,6 @@ purge_gnt_list:
                print_stats(ring);
 
        ring->xenblkd = NULL;
-       xen_blkif_put(blkif);
 
        return 0;
 }
index 4cdf0490983e42600aa278f64c1ce1af6d91466e..792da683e70dafafa6f69e224b8e57272d3e6be1 100644 (file)
@@ -255,7 +255,6 @@ static int xen_blkif_disconnect(struct xen_blkif *blkif)
                if (ring->xenblkd) {
                        kthread_stop(ring->xenblkd);
                        wake_up(&ring->shutdown_wq);
-                       ring->xenblkd = NULL;
                }
 
                /* The above kthread_stop() guarantees that at this point we