Linux SCSI subsystem development
 help / color / mirror / Atom feed
From: Bandan Das <bandan.das@stratus.com>
To: James Bottomley <James.Bottomley@suse.de>
Cc: andrew.vasquez@qlogic.com, linux-scsi@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH] qla2xxx: Fix possible race that could hang kthread_stop()
Date: Thu, 27 Jan 2011 15:59:22 -0500	[thread overview]
Message-ID: <20110127205922.GF31955@stratus.com> (raw)

There is a small race window in qla2x00_do_dpc() between
checking for kthread_should_stop() and going to sleep after
setting TASK_INTERRUPTIBLE. If qla2x00_free_device() is called
in this window, kthread_stop will wait forever because there 
will be no one to wake up the process.


Signed-off-by: Bandan Das <bandan.das@stratus.com>
Signed-off-by: Nate Dailey <nate.dailey@stratus.com>
---
 drivers/scsi/qla2xxx/qla_os.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index c194c23..8d14d77 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -3286,6 +3286,8 @@ qla2x00_do_dpc(void *data)
 		DEBUG3(printk("qla2x00: DPC handler sleeping\n"));
 
 		set_current_state(TASK_INTERRUPTIBLE);
+		if (kthread_should_stop())
+			break;
 		schedule();
 		__set_current_state(TASK_RUNNING);
 
-- 
1.7.2.3

             reply	other threads:[~2011-01-27 20:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-27 20:59 Bandan Das [this message]
2011-01-27 21:12 ` [PATCH] qla2xxx: Fix possible race that could hang kthread_stop() James Bottomley
2011-01-27 21:32   ` Bandan Das
2011-01-27 22:36     ` Madhu Iyengar
2011-01-27 23:05       ` Bandan Das

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=20110127205922.GF31955@stratus.com \
    --to=bandan.das@stratus.com \
    --cc=James.Bottomley@suse.de \
    --cc=andrew.vasquez@qlogic.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox