From: Mike Miller <mike.miller@hp.com>

This patch adds a flag called busy_initializing.  If there are multiple
controllers in a server AND the HP agents are running it's possible the agents
may try to poll a card that is still initializing if the driver is removed and
then added again.

Signed-off-by: Don Brace <dab@hp.com>
Signed-off-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 drivers/block/cciss.c |    8 ++++++++
 drivers/block/cciss.h |    1 +
 2 files changed, 9 insertions(+)

diff -puN drivers/block/cciss.c~cciss-busy_initializing-flag drivers/block/cciss.c
--- devel/drivers/block/cciss.c~cciss-busy_initializing-flag	2005-09-09 19:02:27.000000000 -0700
+++ devel-akpm/drivers/block/cciss.c	2005-09-09 19:02:27.000000000 -0700
@@ -468,6 +468,9 @@ static int cciss_open(struct inode *inod
 	printk(KERN_DEBUG "cciss_open %s\n", inode->i_bdev->bd_disk->disk_name);
 #endif /* CCISS_DEBUG */ 
 
+	if (host->busy_initializing)
+		return -EBUSY;
+
 	/*
 	 * Root is allowed to open raw volume zero even if it's not configured
 	 * so array config can still work. Root is also allowed to open any
@@ -2743,6 +2746,9 @@ static int __devinit cciss_init_one(stru
 	i = alloc_cciss_hba();
 	if(i < 0)
 		return (-1);
+
+	hba[i]->busy_initializing = 1;
+
 	if (cciss_pci_init(hba[i], pdev) != 0)
 		goto clean1;
 
@@ -2865,6 +2871,7 @@ static int __devinit cciss_init_one(stru
 		add_disk(disk);
 	}
 
+	hba[i]->busy_initializing = 0;
 	return(1);
 
 clean4:
@@ -2885,6 +2892,7 @@ clean2:
 clean1:
 	release_io_mem(hba[i]);
 	free_hba(i);
+	hba[i]->busy_initializing = 0;
 	return(-1);
 }
 
diff -puN drivers/block/cciss.h~cciss-busy_initializing-flag drivers/block/cciss.h
--- devel/drivers/block/cciss.h~cciss-busy_initializing-flag	2005-09-09 19:02:27.000000000 -0700
+++ devel-akpm/drivers/block/cciss.h	2005-09-09 19:02:27.000000000 -0700
@@ -83,6 +83,7 @@ struct ctlr_info 
 	int			nr_allocs;
 	int			nr_frees; 
 	int			busy_configuring;
+	int			busy_initializing;
 
 	/* This element holds the zero based queue number of the last
 	 * queue to be started.  It is used for fairness.
_