Skip to contentSkip to conversation

zfcp fixes

PATCH New Christof Schmitt 1 participant 4 messages Apr 18, 2008

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover zfcp fixes

James,

here is a series of three zfcp fixes for issues that have been found during the last couple of weeks. The patches apply on the current scsi-misc tree.

Christof

#1 lore raw

PATCH 1/3 zfcp: fix 31 bit compile warnings

From: Martin Peschke <[email protected]>

drivers/s390/scsi/zfcp_aux.c: In function ‘zfcp_fsf_incoming_els_rscn’:
drivers/s390/scsi/zfcp_aux.c:1379: warning: cast from pointer to integer of different size
drivers/s390/scsi/zfcp_aux.c: In function ‘zfcp_fsf_incoming_els_plogi’:
drivers/s390/scsi/zfcp_aux.c:1432: warning: cast from pointer to integer of different size
drivers/s390/scsi/zfcp_aux.c: In function ‘zfcp_fsf_incoming_els_logo’:
drivers/s390/scsi/zfcp_aux.c:1457: warning: cast from pointer to integer of different size
..

Just passing pointers rids us of these warnings and improves readability.

---
 drivers/s390/scsi/zfcp_aux.c           |    6 -
 drivers/s390/scsi/zfcp_ccw.c           |   19 ++--
 drivers/s390/scsi/zfcp_dbf.c           |   22 ++--
 drivers/s390/scsi/zfcp_erp.c           |  140 ++++++++++++++++---------------
 drivers/s390/scsi/zfcp_ext.h           |   60 ++++++-------
 drivers/s390/scsi/zfcp_fsf.c           |  149 +++++++++++++++------------------
 drivers/s390/scsi/zfcp_qdio.c          |    3 
 drivers/s390/scsi/zfcp_scsi.c          |    4 
 drivers/s390/scsi/zfcp_sysfs_adapter.c |    9 +
 drivers/s390/scsi/zfcp_sysfs_port.c    |    8 -
 drivers/s390/scsi/zfcp_sysfs_unit.c    |    4 
 11 files changed, 211 insertions(+), 213 deletions(-)
drivers/s390/scsi/zfcp_aux.c +3 -3
@@ -1376,7 +1376,7 @@ static void zfcp_fsf_incoming_els_rscn(s
 					      "port 0x%016Lx\n", port->wwpn);
 				zfcp_erp_port_reopen(port,
 						     ZFCP_STATUS_COMMON_ERP_FAILED,
-						     82, (u64)fsf_req);
+						     82, fsf_req);
 				continue;
 			}
 
@@ -1429,7 +1429,7 @@ static void zfcp_fsf_incoming_els_plogi(
 			       status_buffer->d_id,
 			       zfcp_get_busid_by_adapter(adapter));
 	} else {
-		zfcp_erp_port_forced_reopen(port, 0, 83, (u64)fsf_req);
+		zfcp_erp_port_forced_reopen(port, 0, 83, fsf_req);
 	}
 }
 
@@ -1454,7 +1454,7 @@ static void zfcp_fsf_incoming_els_logo(s
 			       status_buffer->d_id,
 			       zfcp_get_busid_by_adapter(adapter));
 	} else {
-		zfcp_erp_port_forced_reopen(port, 0, 84, (u64)fsf_req);
+		zfcp_erp_port_forced_reopen(port, 0, 84, fsf_req);
 	}
 }
 
drivers/s390/scsi/zfcp_dbf.c +11 -11
@@ -700,7 +700,7 @@ void zfcp_rec_dbf_event_thread(u8 id2, s
 	spin_unlock_irqrestore(&adapter->rec_dbf_lock, flags);
 }
 
-static void zfcp_rec_dbf_event_target(u8 id2, u64 ref,
+static void zfcp_rec_dbf_event_target(u8 id2, void *ref,
 				      struct zfcp_adapter *adapter,
 				      atomic_t *status, atomic_t *erp_count,
 				      u64 wwpn, u32 d_id, u64 fcp_lun)
@@ -712,7 +712,7 @@ static void zfcp_rec_dbf_event_target(u8
 	memset(r, 0, sizeof(*r));
 	r->id = ZFCP_REC_DBF_ID_TARGET;
 	r->id2 = id2;
-	r->u.target.ref = ref;
+	r->u.target.ref = (unsigned long)ref;
 	r->u.target.status = atomic_read(status);
 	r->u.target.wwpn = wwpn;
 	r->u.target.d_id = d_id;
@@ -728,7 +728,7 @@ static void zfcp_rec_dbf_event_target(u8
  * @ref: additional reference (e.g. request)
  * @adapter: adapter
  */
-void zfcp_rec_dbf_event_adapter(u8 id, u64 ref, struct zfcp_adapter *adapter)
+void zfcp_rec_dbf_event_adapter(u8 id, void *ref, struct zfcp_adapter *adapter)
 {
 	zfcp_rec_dbf_event_target(id, ref, adapter, &adapter->status,
 				  &adapter->erp_counter, 0, 0, 0);
@@ -740,7 +740,7 @@ void zfcp_rec_dbf_event_adapter(u8 id, u
  * @ref: additional reference (e.g. request)
  * @port: port
  */
-void zfcp_rec_dbf_event_port(u8 id, u64 ref, struct zfcp_port *port)
+void zfcp_rec_dbf_event_port(u8 id, void *ref, struct zfcp_port *port)
 {
 	struct zfcp_adapter *adapter = port->adapter;
 
@@ -755,7 +755,7 @@ void zfcp_rec_dbf_event_port(u8 id, u64 
  * @ref: additional reference (e.g. request)
  * @unit: unit
  */
-void zfcp_rec_dbf_event_unit(u8 id, u64 ref, struct zfcp_unit *unit)
+void zfcp_rec_dbf_event_unit(u8 id, void *ref, struct zfcp_unit *unit)
 {
 	struct zfcp_port *port = unit->port;
 	struct zfcp_adapter *adapter = port->adapter;
@@ -776,8 +776,8 @@ void zfcp_rec_dbf_event_unit(u8 id, u64 
  * @port: port
  * @unit: unit
  */
-void zfcp_rec_dbf_event_trigger(u8 id2, u64 ref, u8 want, u8 need, u64 action,
-				struct zfcp_adapter *adapter,
+void zfcp_rec_dbf_event_trigger(u8 id2, void *ref, u8 want, u8 need,
+				void *action, struct zfcp_adapter *adapter,
 				struct zfcp_port *port, struct zfcp_unit *unit)
 {
 	struct zfcp_rec_dbf_record *r = &adapter->rec_dbf_buf;
@@ -787,10 +787,10 @@ void zfcp_rec_dbf_event_trigger(u8 id2, 
 	memset(r, 0, sizeof(*r));
 	r->id = ZFCP_REC_DBF_ID_TRIGGER;
 	r->id2 = id2;
-	r->u.trigger.ref = ref;
+	r->u.trigger.ref = (unsigned long)ref;
 	r->u.trigger.want = want;
 	r->u.trigger.need = need;
-	r->u.trigger.action = action;
+	r->u.trigger.action = (unsigned long)action;
 	r->u.trigger.as = atomic_read(&adapter->status);
 	if (port) {
 		r->u.trigger.ps = atomic_read(&port->status);
@@ -819,10 +819,10 @@ void zfcp_rec_dbf_event_action(u8 id2, s
 	memset(r, 0, sizeof(*r));
 	r->id = ZFCP_REC_DBF_ID_ACTION;
 	r->id2 = id2;
-	r->u.action.action = (u64)erp_action;
+	r->u.action.action = (unsigned long)erp_action;
 	r->u.action.status = erp_action->status;
 	r->u.action.step = erp_action->step;
-	r->u.action.fsf_req = (u64)erp_action->fsf_req;
+	r->u.action.fsf_req = (unsigned long)erp_action->fsf_req;
 	debug_event(adapter->rec_dbf, 4, r, sizeof(*r));
 	spin_unlock_irqrestore(&adapter->rec_dbf_lock, flags);
 }
drivers/s390/scsi/zfcp_erp.c +73 -67

495 lines not on this page · raw message

drivers/s390/scsi/zfcp_ext.h +31 -29

76 lines not on this page · raw message

drivers/s390/scsi/zfcp_fsf.c +68 -81

531 lines not on this page · raw message

drivers/s390/scsi/zfcp_scsi.c +2 -2
@@ -185,7 +185,7 @@ static void zfcp_scsi_slave_destroy(stru
 		atomic_clear_mask(ZFCP_STATUS_UNIT_REGISTERED, &unit->status);
 		sdpnt->hostdata = NULL;
 		unit->device = NULL;
-		zfcp_erp_unit_failed(unit, 12, 0);
+		zfcp_erp_unit_failed(unit, 12, NULL);
 		zfcp_unit_put(unit);
 	} else
 		ZFCP_LOG_NORMAL("bug: no unit associated with SCSI device at "
@@ -529,7 +529,7 @@ static int zfcp_scsi_eh_host_reset_handl
 		unit->fcp_lun, unit->port->wwpn,
 		zfcp_get_busid_by_adapter(unit->port->adapter));
 
-	zfcp_erp_adapter_reopen(adapter, 0, 141, (u64)scpnt);
+	zfcp_erp_adapter_reopen(adapter, 0, 141, scpnt);
 	zfcp_erp_wait(adapter);
 
 	return SUCCESS;
drivers/s390/scsi/zfcp_ccw.c +10 -9
@@ -170,9 +170,10 @@ zfcp_ccw_set_online(struct ccw_device *c
 	BUG_ON(!zfcp_reqlist_isempty(adapter));
 	adapter->req_no = 0;
 
-	zfcp_erp_modify_adapter_status(adapter, 10, 0,
+	zfcp_erp_modify_adapter_status(adapter, 10, NULL,
 				       ZFCP_STATUS_COMMON_RUNNING, ZFCP_SET);
-	zfcp_erp_adapter_reopen(adapter, ZFCP_STATUS_COMMON_ERP_FAILED, 85, 0);
+	zfcp_erp_adapter_reopen(adapter, ZFCP_STATUS_COMMON_ERP_FAILED, 85,
+				NULL);
 	zfcp_erp_wait(adapter);
 	goto out;
 
@@ -197,7 +198,7 @@ zfcp_ccw_set_offline(struct ccw_device *
 
 	down(&zfcp_data.config_sema);
 	adapter = dev_get_drvdata(&ccw_device->dev);
-	zfcp_erp_adapter_shutdown(adapter, 0, 86, 0);
+	zfcp_erp_adapter_shutdown(adapter, 0, 86, NULL);
 	zfcp_erp_wait(adapter);
 	zfcp_erp_thread_kill(adapter);
 	up(&zfcp_data.config_sema);
@@ -223,21 +224,21 @@ zfcp_ccw_notify(struct ccw_device *ccw_d
 	case CIO_GONE:
 		ZFCP_LOG_NORMAL("adapter %s: device gone\n",
 				zfcp_get_busid_by_adapter(adapter));
-		zfcp_erp_adapter_shutdown(adapter, 0, 87, 0);
+		zfcp_erp_adapter_shutdown(adapter, 0, 87, NULL);
 		break;
 	case CIO_NO_PATH:
 		ZFCP_LOG_NORMAL("adapter %s: no path\n",
 				zfcp_get_busid_by_adapter(adapter));
-		zfcp_erp_adapter_shutdown(adapter, 0, 88, 0);
+		zfcp_erp_adapter_shutdown(adapter, 0, 88, NULL);
 		break;
 	case CIO_OPER:
 		ZFCP_LOG_NORMAL("adapter %s: operational again\n",
 				zfcp_get_busid_by_adapter(adapter));
-		zfcp_erp_modify_adapter_status(adapter, 11, 0,
+		zfcp_erp_modify_adapter_status(adapter, 11, NULL,
 					       ZFCP_STATUS_COMMON_RUNNING,
 					       ZFCP_SET);
-		zfcp_erp_adapter_reopen(adapter,
-					ZFCP_STATUS_COMMON_ERP_FAILED, 89, 0);
+		zfcp_erp_adapter_reopen(adapter, ZFCP_STATUS_COMMON_ERP_FAILED,
+					89, NULL);
 		break;
 	}
 	zfcp_erp_wait(adapter);
@@ -269,7 +270,7 @@ zfcp_ccw_shutdown(struct ccw_device *cde
 
 	down(&zfcp_data.config_sema);
 	adapter = dev_get_drvdata(&cdev->dev);
-	zfcp_erp_adapter_shutdown(adapter, 0, 90, 0);
+	zfcp_erp_adapter_shutdown(adapter, 0, 90, NULL);
 	zfcp_erp_wait(adapter);
 	up(&zfcp_data.config_sema);
 }
drivers/s390/scsi/zfcp_qdio.c +2 -1
@@ -176,7 +176,8 @@ zfcp_qdio_handler_error_check(struct zfc
                 */
 		zfcp_erp_adapter_reopen(adapter,
 					ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED |
-					ZFCP_STATUS_COMMON_ERP_FAILED, 140, 0);
+					ZFCP_STATUS_COMMON_ERP_FAILED, 140,
+					NULL);
 	}
 	return retval;
 }
drivers/s390/scsi/zfcp_sysfs_adapter.c +5 -4
@@ -89,7 +89,7 @@ zfcp_sysfs_port_add_store(struct device 
 
 	retval = 0;
 
-	zfcp_erp_port_reopen(port, 0, 91, 0);
+	zfcp_erp_port_reopen(port, 0, 91, NULL);
 	zfcp_erp_wait(port->adapter);
 	zfcp_port_put(port);
  out:
@@ -147,7 +147,7 @@ zfcp_sysfs_port_remove_store(struct devi
 		goto out;
 	}
 
-	zfcp_erp_port_shutdown(port, 0, 92, 0);
+	zfcp_erp_port_shutdown(port, 0, 92, NULL);
 	zfcp_erp_wait(adapter);
 	zfcp_port_put(port);
 	zfcp_port_dequeue(port);
@@ -191,9 +191,10 @@ zfcp_sysfs_adapter_failed_store(struct d
 		goto out;
 	}
 
-	zfcp_erp_modify_adapter_status(adapter, 44, 0,
+	zfcp_erp_modify_adapter_status(adapter, 44, NULL,
 				       ZFCP_STATUS_COMMON_RUNNING, ZFCP_SET);
-	zfcp_erp_adapter_reopen(adapter, ZFCP_STATUS_COMMON_ERP_FAILED, 93, 0);
+	zfcp_erp_adapter_reopen(adapter, ZFCP_STATUS_COMMON_ERP_FAILED, 93,
+				NULL);
 	zfcp_erp_wait(adapter);
  out:
 	up(&zfcp_data.config_sema);
drivers/s390/scsi/zfcp_sysfs_port.c +4 -4
@@ -94,7 +94,7 @@ zfcp_sysfs_unit_add_store(struct device 
 
 	retval = 0;
 
-	zfcp_erp_unit_reopen(unit, 0, 94, 0);
+	zfcp_erp_unit_reopen(unit, 0, 94, NULL);
 	zfcp_erp_wait(unit->port->adapter);
 	zfcp_unit_put(unit);
  out:
@@ -150,7 +150,7 @@ zfcp_sysfs_unit_remove_store(struct devi
 		goto out;
 	}
 
-	zfcp_erp_unit_shutdown(unit, 0, 95, 0);
+	zfcp_erp_unit_shutdown(unit, 0, 95, NULL);
 	zfcp_erp_wait(unit->port->adapter);
 	zfcp_unit_put(unit);
 	zfcp_unit_dequeue(unit);
@@ -193,9 +193,9 @@ zfcp_sysfs_port_failed_store(struct devi
 		goto out;
 	}
 
-	zfcp_erp_modify_port_status(port, 45, 0,
+	zfcp_erp_modify_port_status(port, 45, NULL,
 				    ZFCP_STATUS_COMMON_RUNNING, ZFCP_SET);
-	zfcp_erp_port_reopen(port, ZFCP_STATUS_COMMON_ERP_FAILED, 96, 0);
+	zfcp_erp_port_reopen(port, ZFCP_STATUS_COMMON_ERP_FAILED, 96, NULL);
 	zfcp_erp_wait(port->adapter);
  out:
 	up(&zfcp_data.config_sema);
drivers/s390/scsi/zfcp_sysfs_unit.c +2 -2
@@ -94,9 +94,9 @@ zfcp_sysfs_unit_failed_store(struct devi
 		goto out;
 	}
 
-	zfcp_erp_modify_unit_status(unit, 46, 0,
+	zfcp_erp_modify_unit_status(unit, 46, NULL,
 				    ZFCP_STATUS_COMMON_RUNNING, ZFCP_SET);
-	zfcp_erp_unit_reopen(unit, ZFCP_STATUS_COMMON_ERP_FAILED, 97, 0);
+	zfcp_erp_unit_reopen(unit, ZFCP_STATUS_COMMON_ERP_FAILED, 97, NULL);
 	zfcp_erp_wait(unit->port->adapter);
  out:
 	up(&zfcp_data.config_sema);
Signature · 4 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#2 lore raw

PATCH 2/3 zfcp: Remove zfcp_erp_wait from slave destory handler to fix deadlock

In reply to Christof Schmitt

From: Christof Schmitt <[email protected]>

The testcase

# chchp -v 0 0.da && sleep 59 && chchp -v 1 0.da
results in this deadlock situation:

STACK TRACE FOR TASK: 0x7e9a2048 (zfcperp0.0.c613) 0 schedule+816 [0x356b3c]
1 schedule_timeout+172 [0x357340]
2 wait_for_common+192 [0x3565fc]
3 flush_cpu_workqueue+116 [0x52af0]
4 flush_workqueue+116 [0x533b8]
5 fc_remote_port_add+64 [0x1c83ec]
6 zfcp_erp_thread+4534 [0x26585a]
7 kernel_thread_starter+6 [0x195d2]

STACK TRACE FOR TASK: 0x7f8ec048 (fc_wq_0)
0 schedule+816 [0x356b3c]
1 zfcp_erp_wait+104 [0x264568]
2 zfcp_scsi_slave_destroy+64 [0x261b24]
3 __scsi_remove_device+154 [0x1c24ba]
4 scsi_remove_device+62 [0x1c2512]
5 __scsi_remove_target+198 [0x1c25ea]
6 __remove_child+58 [0x1c26d6]
7 device_for_each_child+66 [0x1ab566]
8 scsi_remove_target+98 [0x1c268a]
9 run_workqueue+200 [0x5272c]
10 worker_thread+146 [0x52882]
11 kthread+140 [0x58360]
12 kernel_thread_starter+6 [0x195d2]

Remove the zfcp_erp_wait call that is not required here to prevent the deadlock situation.

---
 drivers/s390/scsi/zfcp_scsi.c |    1 -
 1 file changed, 1 deletion(-)
drivers/s390/scsi/zfcp_scsi.c +0 -1
@@ -181,7 +181,6 @@ static void zfcp_scsi_slave_destroy(stru
 	struct zfcp_unit *unit = (struct zfcp_unit *) sdpnt->hostdata;
 
 	if (unit) {
-		zfcp_erp_wait(unit->port->adapter);
 		atomic_clear_mask(ZFCP_STATUS_UNIT_REGISTERED, &unit->status);
 		sdpnt->hostdata = NULL;
 		unit->device = NULL;
#3 lore raw

PATCH 3/3 zfcp: Fix error handling for blocked unit for send FCP command

In reply to Christof Schmitt

From: Christof Schmitt <[email protected]>

In the case the unit is blocked, zfcp_unit_get has not been called yet, so the error handling path should not call zfcp_unit_put.

---
 drivers/s390/scsi/zfcp_fsf.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/s390/scsi/zfcp_fsf.c +1 -1
@@ -3562,8 +3562,8 @@ zfcp_fsf_send_fcp_command_task(struct zf
  send_failed:
  no_fit:
  failed_scsi_cmnd:
- unit_blocked:
 	zfcp_unit_put(unit);
+ unit_blocked:
 	zfcp_fsf_req_free(fsf_req);
 	fsf_req = NULL;
 	scsi_cmnd->host_scribble = NULL;