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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 7 Aug 2017 02:19:43 +0000 (19:19 -0700)
commit a24fa22ce22ae302b3bf8f7008896d52d5d57b8d upstream.

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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/block/xen-blkback/blkback.c
drivers/block/xen-blkback/xenbus.c

index 41fb1a917b172dc9446495d84357060847c2b569..33e23a7a691f8d0ee328181286371b0f7ca20277 100644 (file)
@@ -595,8 +595,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;
@@ -650,7 +648,6 @@ purge_gnt_list:
                print_stats(blkif);
 
        blkif->xenblkd = NULL;
-       xen_blkif_put(blkif);
 
        return 0;
 }
index 58f151e283ff9fd781cb1b6a87e9d3f8bc2cb7ab..9233082013755fb0d05e1f76812b8808072f416e 100644 (file)
@@ -221,7 +221,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