From: "Stephen M. Cameron" <scameron@beardog.cce.hp.com>
To: axboe@kernel.dk, akpm@linux-foundation.org
Cc: linux-kernel@vger.kernel.org, mikem@beardog.cce.hp.com,
achiang@hp.com, brace@beardog.cce.hp.com
Subject: [PATCH 02/11] cciss: Fix problem with remove_from_scan_list on driver unload
Date: Thu, 12 Nov 2009 12:49:19 -0600 [thread overview]
Message-ID: <20091112184919.23389.52861.stgit@beardog.cce.hp.com> (raw)
In-Reply-To: <20091112184542.23389.36220.stgit@beardog.cce.hp.com>
From: Stephen M. Cameron <scameron@beardog.cce.hp.com>
cciss: Fix problem with remove_from_scan_list that on driver unload
it doesn't remove the controller from the scan list correctly if
the controller is currently being scanned for new devices.
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
---
drivers/block/cciss.c | 21 +++++++++++++--------
1 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 92b1263..81c2187 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -3513,28 +3513,33 @@ static int add_to_scan_list(struct ctlr_info *h)
* @h: Pointer to the controller.
*
* Removes the controller from the rescan queue if present. Blocks if
- * the controller is currently conducting a rescan.
+ * the controller is currently conducting a rescan. The controller
+ * can be in one of three states:
+ * 1. Doesn't need a scan
+ * 2. On the scan list, but not scanning yet (we remove it)
+ * 3. Busy scanning (and not on the list). In this case we want to wait for
+ * the scan to complete to make sure the scanning thread for this
+ * controller is completely idle.
**/
static void remove_from_scan_list(struct ctlr_info *h)
{
struct ctlr_info *test_h, *tmp_h;
- int scanning = 0;
mutex_lock(&scan_mutex);
list_for_each_entry_safe(test_h, tmp_h, &scan_q, scan_list) {
- if (test_h == h) {
+ if (test_h == h) { /* state 2. */
list_del(&h->scan_list);
complete_all(&h->scan_wait);
mutex_unlock(&scan_mutex);
return;
}
}
- if (&h->busy_scanning)
- scanning = 0;
- mutex_unlock(&scan_mutex);
-
- if (scanning)
+ if (h->busy_scanning) { /* state 3. */
+ mutex_unlock(&scan_mutex);
wait_for_completion(&h->scan_wait);
+ } else { /* state 1, nothing to do. */
+ mutex_unlock(&scan_mutex);
+ }
}
/**
next prev parent reply other threads:[~2009-11-12 18:48 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-12 18:49 [PATCH 00/11] cciss: driver updates Stephen M. Cameron
2009-11-12 18:49 ` [PATCH 01/11] cciss: Make device attributes static Stephen M. Cameron
2009-11-12 18:49 ` Stephen M. Cameron [this message]
2009-11-12 18:49 ` [PATCH 03/11] cciss: Retry driver initiated cmds with unit attention condition Stephen M. Cameron
2009-11-12 18:49 ` [PATCH 04/11] cciss: Remove the "withirq" parameter from various functions where possible Stephen M. Cameron
2009-11-12 18:49 ` [PATCH 05/11] cciss: clean up code in cciss_shutdown Stephen M. Cameron
2009-11-12 18:49 ` [PATCH 06/11] cciss: remove sendcmd() as it is no longer used Stephen M. Cameron
2009-11-12 18:49 ` [PATCH 07/11] cciss: fix typo that causes scsi status to be lost Stephen M. Cameron
2009-11-12 18:49 ` [PATCH 08/11] cciss: Remove unnecessary check in scan_thread Stephen M. Cameron
2009-11-12 18:49 ` [PATCH 09/11] cciss: Do not automatically rescan on UNIT ATTENTION/LUN DATA CHANGED Stephen M. Cameron
2009-11-12 18:50 ` [PATCH 10/11] cciss: Add enhanced scatter-gather support Stephen M. Cameron
2009-11-12 18:50 ` [PATCH 11/11] cciss: Fix weird usage of ENXIO in cciss_scsi.c Stephen M. Cameron
2009-11-13 7:46 ` [PATCH 00/11] cciss: driver updates Jens Axboe
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=20091112184919.23389.52861.stgit@beardog.cce.hp.com \
--to=scameron@beardog.cce.hp.com \
--cc=achiang@hp.com \
--cc=akpm@linux-foundation.org \
--cc=axboe@kernel.dk \
--cc=brace@beardog.cce.hp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mikem@beardog.cce.hp.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