From 4a676c4ed7ae9b7b4fea255cd882e03a061734b7 Mon Sep 17 00:00:00 2001 From: "Stephen M. Cameron" Date: Thu, 12 Nov 2009 12:49:19 -0600 Subject: [PATCH] --- yaml --- r: 172949 b: refs/heads/master c: fd8489cff419d216479655b8041b8574ed89f806 h: refs/heads/master i: 172947: a58f11e5dff0225960c9ecd1b79a4833205fea52 v: v3 --- [refs] | 2 +- trunk/drivers/block/cciss.c | 21 +++++++++++++-------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/[refs] b/[refs] index 242f823a193c..cbfb5892b156 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 8ba95c69fe6eb65ff36b64136ae24844ddba16a1 +refs/heads/master: fd8489cff419d216479655b8041b8574ed89f806 diff --git a/trunk/drivers/block/cciss.c b/trunk/drivers/block/cciss.c index 92b126394fa1..81c21875eb72 100644 --- a/trunk/drivers/block/cciss.c +++ b/trunk/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); + } } /**