public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Joe Jin <joe.jin@oracle.com>
To: unlisted-recipients:; (no To-header on input)
Cc: Joe Jin <joe.jin@oracle.com>,
	Daniel Stodden <daniel.stodden@citrix.com>,
	Jens Axboe <jaxboe@fusionio.com>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	Annie Li <annie.li@oracle.com>,
	Ian Campbell <Ian.Campbell@eu.citrix.com>,
	Kurt C Hackel <KURT.HACKEL@oracle.com>,
	Greg Marsden <greg.marsden@oracle.com>,
	"xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: [PATCH -v2 2/3] xen-blkback: repleace check kthread_should_stop() to remove_requested in xen_blkif_schedule() loop.
Date: Wed, 03 Aug 2011 14:06:10 +0800	[thread overview]
Message-ID: <4E38E552.2030207@oracle.com> (raw)
In-Reply-To: <4E38E4A2.3070003@oracle.com>

When backend state change to XenbusStateClosed, remove_requested will be set,
so repleace check kthread_should_stop() to remove_requested in 
xen_blkif_schedule() loop.

Signed-off-by: Joe Jin <joe.jin@oracle.com>
Cc: Daniel Stodden <daniel.stodden@citrix.com>
Cc: Jens Axboe <jaxboe@fusionio.com>
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Annie Li <annie.li@oracle.com>
Cc: Ian Campbell <Ian.Campbell@eu.citrix.com>
--
 drivers/block/xen-blkback/blkback.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c
index 2330a9a..3d64b52 100644
--- a/drivers/block/xen-blkback/blkback.c
+++ b/drivers/block/xen-blkback/blkback.c
@@ -274,7 +274,7 @@ int xen_blkif_schedule(void *arg)
 
 	xen_blkif_get(blkif);
 
-	while (!kthread_should_stop()) {
+	while (!blkif->remove_requested) {
 		if (try_to_freeze())
 			continue;
 		if (unlikely(vbd->size != vbd_sz(vbd)))
@@ -282,11 +282,11 @@ int xen_blkif_schedule(void *arg)
 
 		wait_event_interruptible(
 			blkif->wq,
-			blkif->waiting_reqs || kthread_should_stop());
+			blkif->waiting_reqs || blkif->remove_requested);
 		wait_event_interruptible(
 			blkbk->pending_free_wq,
 			!list_empty(&blkbk->pending_free) ||
-			kthread_should_stop());
+			blkif->remove_requested);
 
 		blkif->waiting_reqs = 0;
 		smp_mb(); /* clear flag *before* checking for work */
@@ -301,8 +301,8 @@ int xen_blkif_schedule(void *arg)
 	if (log_stats)
 		print_stats(blkif);
 
-	blkif->xenblkd = NULL;
 	xen_blkif_put(blkif);
+	xen_blkback_close(blkif);
 
 	return 0;
 }
@@ -476,7 +476,7 @@ __do_block_io_op(struct xen_blkif *blkif)
 		if (RING_REQUEST_CONS_OVERFLOW(&blk_rings->common, rc))
 			break;
 
-		if (kthread_should_stop()) {
+		if (blkif->remove_requested) {
 			more_to_do = 1;
 			break;
 		}


  parent reply	other threads:[~2011-08-03  6:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-03  6:03 [PATCH -v2 0/3] xen-blkback: refactor vbd remove/disconnect Joe Jin
2011-08-03  6:05 ` [PATCH -v2 1/3] xen-blkback: add remove_requested to xen_blkif and some declares Joe Jin
2011-08-03  6:06 ` Joe Jin [this message]
2011-08-03  6:07 ` [PATCH -v2 3/3] xen-blkback: refactor vbd remove/disconnect Joe Jin
2011-08-03 21:49 ` [PATCH -v2 0/3] " Konrad Rzeszutek Wilk
2011-08-04  6:56   ` Joe Jin

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=4E38E552.2030207@oracle.com \
    --to=joe.jin@oracle.com \
    --cc=Ian.Campbell@eu.citrix.com \
    --cc=KURT.HACKEL@oracle.com \
    --cc=annie.li@oracle.com \
    --cc=daniel.stodden@citrix.com \
    --cc=greg.marsden@oracle.com \
    --cc=jaxboe@fusionio.com \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=xen-devel@lists.xensource.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox