[patch 1/4] zfcp: fix spinlock initialization

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Heiko Carstens <heiko.carstens@xxxxxxxxxx>

[patch 1/4] zfcp: fix spinlock initialization

Move initialization of locks and lists to adapter allocation function.
Otherwise we might end up with some uninitialized locks, like e.g. the
erp locks which only will be inititialized if an error recovery thread
for an adapter will be started.

Signed-off-by: Heiko Carstens <heiko.carstens@xxxxxxxxxx>
Signed-off-by: Andreas Herrmann <aherrman@xxxxxxxxxx>

diff -Nurp linux-2.6.15-rc3/drivers/s390/scsi/zfcp_aux.c linux-2.6.x/drivers/s390/scsi/zfcp_aux.c
--- linux-2.6.15-rc3/drivers/s390/scsi/zfcp_aux.c	2005-12-01 00:10:35.000000000 +0100
+++ linux-2.6.x/drivers/s390/scsi/zfcp_aux.c	2005-12-01 01:14:36.000000000 +0100
@@ -996,6 +996,20 @@ zfcp_adapter_enqueue(struct ccw_device *
 	spin_lock_init(&adapter->fsf_req_list_lock);
 	INIT_LIST_HEAD(&adapter->fsf_req_list_head);
 
+	/* initialize debug locks */
+
+	spin_lock_init(&adapter->erp_dbf_lock);
+	spin_lock_init(&adapter->hba_dbf_lock);
+	spin_lock_init(&adapter->san_dbf_lock);
+	spin_lock_init(&adapter->scsi_dbf_lock);
+
+	/* initialize error recovery stuff */
+
+	rwlock_init(&adapter->erp_lock);
+	sema_init(&adapter->erp_ready_sem, 0);
+	INIT_LIST_HEAD(&adapter->erp_ready_head);
+	INIT_LIST_HEAD(&adapter->erp_running_head);
+
 	/* initialize abort lock */
 	rwlock_init(&adapter->abort_lock);
 
diff -Nurp linux-2.6.15-rc3/drivers/s390/scsi/zfcp_dbf.c linux-2.6.x/drivers/s390/scsi/zfcp_dbf.c
--- linux-2.6.15-rc3/drivers/s390/scsi/zfcp_dbf.c	2005-10-28 02:02:08.000000000 +0200
+++ linux-2.6.x/drivers/s390/scsi/zfcp_dbf.c	2005-12-01 01:14:36.000000000 +0100
@@ -926,7 +926,6 @@ int zfcp_adapter_debug_register(struct z
 	char dbf_name[DEBUG_MAX_NAME_LEN];
 
 	/* debug feature area which records recovery activity */
-	spin_lock_init(&adapter->erp_dbf_lock);
 	sprintf(dbf_name, "zfcp_%s_erp", zfcp_get_busid_by_adapter(adapter));
 	adapter->erp_dbf = debug_register(dbf_name, dbfsize, 2,
 					  sizeof(struct zfcp_erp_dbf_record));
@@ -936,7 +935,6 @@ int zfcp_adapter_debug_register(struct z
 	debug_set_level(adapter->erp_dbf, 3);
 
 	/* debug feature area which records HBA (FSF and QDIO) conditions */
-	spin_lock_init(&adapter->hba_dbf_lock);
 	sprintf(dbf_name, "zfcp_%s_hba", zfcp_get_busid_by_adapter(adapter));
 	adapter->hba_dbf = debug_register(dbf_name, dbfsize, 1,
 					  sizeof(struct zfcp_hba_dbf_record));
@@ -947,7 +945,6 @@ int zfcp_adapter_debug_register(struct z
 	debug_set_level(adapter->hba_dbf, 3);
 
 	/* debug feature area which records SAN command failures and recovery */
-	spin_lock_init(&adapter->san_dbf_lock);
 	sprintf(dbf_name, "zfcp_%s_san", zfcp_get_busid_by_adapter(adapter));
 	adapter->san_dbf = debug_register(dbf_name, dbfsize, 1,
 					  sizeof(struct zfcp_san_dbf_record));
@@ -958,7 +955,6 @@ int zfcp_adapter_debug_register(struct z
 	debug_set_level(adapter->san_dbf, 6);
 
 	/* debug feature area which records SCSI command failures and recovery */
-	spin_lock_init(&adapter->scsi_dbf_lock);
 	sprintf(dbf_name, "zfcp_%s_scsi", zfcp_get_busid_by_adapter(adapter));
 	adapter->scsi_dbf = debug_register(dbf_name, dbfsize, 1,
 					   sizeof(struct zfcp_scsi_dbf_record));
diff -Nurp linux-2.6.15-rc3/drivers/s390/scsi/zfcp_erp.c linux-2.6.x/drivers/s390/scsi/zfcp_erp.c
--- linux-2.6.15-rc3/drivers/s390/scsi/zfcp_erp.c	2005-10-28 02:02:08.000000000 +0200
+++ linux-2.6.x/drivers/s390/scsi/zfcp_erp.c	2005-12-01 01:14:36.000000000 +0100
@@ -1071,11 +1071,6 @@ zfcp_erp_thread_setup(struct zfcp_adapte
 
 	atomic_clear_mask(ZFCP_STATUS_ADAPTER_ERP_THREAD_UP, &adapter->status);
 
-	rwlock_init(&adapter->erp_lock);
-	INIT_LIST_HEAD(&adapter->erp_ready_head);
-	INIT_LIST_HEAD(&adapter->erp_running_head);
-	sema_init(&adapter->erp_ready_sem, 0);
-
 	retval = kernel_thread(zfcp_erp_thread, adapter, SIGCHLD);
 	if (retval < 0) {
 		ZFCP_LOG_NORMAL("error: creation of erp thread failed for "
-
: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux