From 6fcc47111ae14f284007e1b9a5002babb01d913c Mon Sep 17 00:00:00 2001 From: Swen Schillig Date: Wed, 7 Feb 2007 13:17:57 +0100 Subject: [SCSI] zfcp: Invalid locking order Invalid locking order. Kernel hangs after trying to take two locks which are dependend on each other. Introducing temporary variable to free requests. Free lock after requests are copied. Signed-off-by: Swen Schillig Signed-off-by: James Bottomley --- drivers/s390/scsi/zfcp_ext.h | 2 +- drivers/s390/scsi/zfcp_fsf.c | 23 ++++++++++------------- 2 files changed, 11 insertions(+), 14 deletions(-) (limited to 'drivers/s390') diff --git a/drivers/s390/scsi/zfcp_ext.h b/drivers/s390/scsi/zfcp_ext.h index b8794d77285..7ec8e352b1f 100644 --- a/drivers/s390/scsi/zfcp_ext.h +++ b/drivers/s390/scsi/zfcp_ext.h @@ -89,7 +89,7 @@ extern int zfcp_fsf_control_file(struct zfcp_adapter *, struct zfcp_fsf_req **, u32, u32, struct zfcp_sg_list *); extern void zfcp_fsf_start_timer(struct zfcp_fsf_req *, unsigned long); extern void zfcp_erp_start_timer(struct zfcp_fsf_req *); -extern int zfcp_fsf_req_dismiss_all(struct zfcp_adapter *); +extern void zfcp_fsf_req_dismiss_all(struct zfcp_adapter *); extern int zfcp_fsf_status_read(struct zfcp_adapter *, int); extern int zfcp_fsf_req_create(struct zfcp_adapter *, u32, int, mempool_t *, unsigned long *, struct zfcp_fsf_req **); diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c index 067f1519eb0..eabf86bb13f 100644 --- a/drivers/s390/scsi/zfcp_fsf.c +++ b/drivers/s390/scsi/zfcp_fsf.c @@ -176,28 +176,25 @@ static void zfcp_fsf_req_dismiss(struct zfcp_adapter *adapter, /** * zfcp_fsf_req_dismiss_all - dismiss all remaining fsf requests */ -int zfcp_fsf_req_dismiss_all(struct zfcp_adapter *adapter) +void zfcp_fsf_req_dismiss_all(struct zfcp_adapter *adapter) { struct zfcp_fsf_req *request, *tmp; unsigned long flags; + LIST_HEAD(remove_queue); unsigned int i, counter; spin_lock_irqsave(&adapter->req_list_lock, flags); atomic_set(&adapter->reqs_active, 0); - for (i=0; ireq_list[i])) - continue; - - counter = 0; - list_for_each_entry_safe(request, tmp, - &adapter->req_list[i], list) { - zfcp_fsf_req_dismiss(adapter, request, counter); - counter++; - } - } + for (i=0; ireq_list[i], &remove_queue); + spin_unlock_irqrestore(&adapter->req_list_lock, flags); - return 0; + counter = 0; + list_for_each_entry_safe(request, tmp, &remove_queue, list) { + zfcp_fsf_req_dismiss(adapter, request, counter); + counter++; + } } /* -- cgit v1.2.3 From ca880cf93361e752d2e0bf6bf73657e2c56a0822 Mon Sep 17 00:00:00 2001 From: Swen Schillig Date: Fri, 9 Feb 2007 10:00:14 +0100 Subject: [SCSI] zfcp: use of uninitialized variable commit 988d955c3314336d716a9208f3d565b06f262e07 Author: Swen Schillig Date: Fri Feb 9 09:40:11 2007 +0100 Use of uninitialized variable. ERP action might not be finished accordingly. Signed-off-by: Swen Schillig Signed-off-by: James Bottomley --- drivers/s390/scsi/zfcp_erp.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'drivers/s390') diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c index c88babce9bc..9d3c4a9ba90 100644 --- a/drivers/s390/scsi/zfcp_erp.c +++ b/drivers/s390/scsi/zfcp_erp.c @@ -841,29 +841,27 @@ zfcp_erp_action_exists(struct zfcp_erp_action *erp_action) * * returns: 0 */ -static int +static void zfcp_erp_strategy_check_fsfreq(struct zfcp_erp_action *erp_action) { - int retval = 0; - struct zfcp_fsf_req *fsf_req = NULL; struct zfcp_adapter *adapter = erp_action->adapter; if (erp_action->fsf_req) { /* take lock to ensure that request is not deleted meanwhile */ spin_lock(&adapter->req_list_lock); - if ((!zfcp_reqlist_ismember(adapter, - erp_action->fsf_req->req_id)) && - (fsf_req->erp_action == erp_action)) { + if (zfcp_reqlist_ismember(adapter, + erp_action->fsf_req->req_id)) { /* fsf_req still exists */ debug_text_event(adapter->erp_dbf, 3, "a_ca_req"); - debug_event(adapter->erp_dbf, 3, &fsf_req, + debug_event(adapter->erp_dbf, 3, &erp_action->fsf_req, sizeof (unsigned long)); /* dismiss fsf_req of timed out/dismissed erp_action */ if (erp_action->status & (ZFCP_STATUS_ERP_DISMISSED | ZFCP_STATUS_ERP_TIMEDOUT)) { debug_text_event(adapter->erp_dbf, 3, "a_ca_disreq"); - fsf_req->status |= ZFCP_STATUS_FSFREQ_DISMISSED; + erp_action->fsf_req->status |= + ZFCP_STATUS_FSFREQ_DISMISSED; } if (erp_action->status & ZFCP_STATUS_ERP_TIMEDOUT) { ZFCP_LOG_NORMAL("error: erp step timed out " @@ -876,11 +874,11 @@ zfcp_erp_strategy_check_fsfreq(struct zfcp_erp_action *erp_action) * then keep it running asynchronously and don't mess * with the association of erp_action and fsf_req. */ - if (fsf_req->status & (ZFCP_STATUS_FSFREQ_COMPLETED | + if (erp_action->fsf_req->status & + (ZFCP_STATUS_FSFREQ_COMPLETED | ZFCP_STATUS_FSFREQ_DISMISSED)) { /* forget about association between fsf_req and erp_action */ - fsf_req->erp_action = NULL; erp_action->fsf_req = NULL; } } else { @@ -894,8 +892,6 @@ zfcp_erp_strategy_check_fsfreq(struct zfcp_erp_action *erp_action) spin_unlock(&adapter->req_list_lock); } else debug_text_event(adapter->erp_dbf, 3, "a_ca_noreq"); - - return retval; } /** -- cgit v1.2.3 From 98051995ab44b993f992946055edc6115351f725 Mon Sep 17 00:00:00 2001 From: Swen Schillig Date: Fri, 9 Feb 2007 10:01:40 +0100 Subject: [SCSI] zfcp: removed wrong comment commit 07a105136f07f0cf1b476383e43033b8a65e13ff Author: Swen Schillig Date: Fri Feb 9 09:58:09 2007 +0100 removed wrong comment Signed-off-by: Swen Schillig Signed-off-by: James Bottomley --- drivers/s390/scsi/zfcp_erp.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'drivers/s390') diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c index 9d3c4a9ba90..755b754dec6 100644 --- a/drivers/s390/scsi/zfcp_erp.c +++ b/drivers/s390/scsi/zfcp_erp.c @@ -838,8 +838,6 @@ zfcp_erp_action_exists(struct zfcp_erp_action *erp_action) * and does appropriate preparations (dismiss fsf request, ...) * * locks: called under erp_lock (disabled interrupts) - * - * returns: 0 */ static void zfcp_erp_strategy_check_fsfreq(struct zfcp_erp_action *erp_action) -- cgit v1.2.3