Browse Source

[SCSI] zfcp: wait on SCSI work to be finished before proceeding with init dev

Due to the character of a scheduled work we cannot guarantee the
LUN register to be finished before an initial device tries to use it.
Therefor we have to wait for PENDING_SCSI_WORK flag to be cleared
before proceeding.

Signed-off-by: Swen Schillig <swen@vnet.ibm.com>
Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Swen Schillig 16 years ago
parent
commit
091694a556
2 changed files with 6 additions and 0 deletions
  1. 5 0
      drivers/s390/scsi/zfcp_aux.c
  2. 1 0
      drivers/s390/scsi/zfcp_erp.c

+ 5 - 0
drivers/s390/scsi/zfcp_aux.c

@@ -129,7 +129,12 @@ static void __init zfcp_init_device_configure(void)
 		goto out_unit;
 		goto out_unit;
 	up(&zfcp_data.config_sema);
 	up(&zfcp_data.config_sema);
 	ccw_device_set_online(adapter->ccw_device);
 	ccw_device_set_online(adapter->ccw_device);
+
 	zfcp_erp_wait(adapter);
 	zfcp_erp_wait(adapter);
+	wait_event(adapter->erp_done_wqh,
+		   !(atomic_read(&unit->status) &
+				ZFCP_STATUS_UNIT_SCSI_WORK_PENDING));
+
 	down(&zfcp_data.config_sema);
 	down(&zfcp_data.config_sema);
 	zfcp_unit_put(unit);
 	zfcp_unit_put(unit);
 out_unit:
 out_unit:

+ 1 - 0
drivers/s390/scsi/zfcp_erp.c

@@ -1189,6 +1189,7 @@ static void zfcp_erp_scsi_scan(struct work_struct *work)
 			 scsilun_to_int((struct scsi_lun *)&unit->fcp_lun), 0);
 			 scsilun_to_int((struct scsi_lun *)&unit->fcp_lun), 0);
 	atomic_clear_mask(ZFCP_STATUS_UNIT_SCSI_WORK_PENDING, &unit->status);
 	atomic_clear_mask(ZFCP_STATUS_UNIT_SCSI_WORK_PENDING, &unit->status);
 	zfcp_unit_put(unit);
 	zfcp_unit_put(unit);
+	wake_up(&unit->port->adapter->erp_done_wqh);
 	kfree(p);
 	kfree(p);
 }
 }