All of lore.kernel.org
 help / color / mirror / Atom feed
From: Juergen Gross <jgross@suse.com>
To: linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org
Cc: konrad.wilk@oracle.com, roger.pau@citrix.com, netwiz@crc.id.au,
	Juergen Gross <jgross@suse.com>
Subject: [PATCH v2 3/3] xen/blkback: don't use xen_blkif_get() in xen-blkback kthread
Date: Thu, 18 May 2017 17:28:49 +0200	[thread overview]
Message-ID: <20170518152849.1872-4-jgross@suse.com> (raw)
In-Reply-To: <20170518152849.1872-1-jgross@suse.com>

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>
---
 drivers/block/xen-blkback/blkback.c | 3 ---
 drivers/block/xen-blkback/xenbus.c  | 1 -
 2 files changed, 4 deletions(-)

diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c
index 726c32e35db9..6b14c509f3c7 100644
--- a/drivers/block/xen-blkback/blkback.c
+++ b/drivers/block/xen-blkback/blkback.c
@@ -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 @@ int xen_blkif_schedule(void *arg)
 		print_stats(ring);
 
 	ring->xenblkd = NULL;
-	xen_blkif_put(blkif);
 
 	return 0;
 }
diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c
index 4cdf0490983e..792da683e70d 100644
--- a/drivers/block/xen-blkback/xenbus.c
+++ b/drivers/block/xen-blkback/xenbus.c
@@ -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
-- 
2.12.0

  parent reply	other threads:[~2017-05-18 15:29 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-18 15:28 [PATCH v2 0/3] xen/blkback: several fixes of resource management Juergen Gross
2017-05-18 15:28 ` [PATCH v2 1/3] xen/blkback: fix disconnect while I/Os in flight Juergen Gross
2017-05-18 15:28 ` Juergen Gross
2017-05-18 15:28 ` [PATCH v2 2/3] xen/blkback: don't free be structure too early Juergen Gross
2017-05-18 15:28 ` Juergen Gross
2017-05-18 15:28 ` Juergen Gross [this message]
2017-05-18 15:28 ` [PATCH v2 3/3] xen/blkback: don't use xen_blkif_get() in xen-blkback kthread Juergen Gross
2017-06-07 12:36 ` [PATCH v2 0/3] xen/blkback: several fixes of resource management Steven Haigh
2017-06-07 12:36 ` Steven Haigh
2017-06-07 13:52   ` [Xen-devel] " Konrad Rzeszutek Wilk
2017-06-07 14:08     ` Steven Haigh
2017-06-07 14:08     ` Steven Haigh
2017-06-07 13:52   ` Konrad Rzeszutek Wilk
2017-06-07 13:52   ` Konrad Rzeszutek Wilk
2017-06-07 12:36 ` Steven Haigh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170518152849.1872-4-jgross@suse.com \
    --to=jgross@suse.com \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netwiz@crc.id.au \
    --cc=roger.pau@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.