提交 6fcc4711 编写于 作者: S Swen Schillig 提交者: James Bottomley

[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: NSwen Schillig <swen@vnet.ibm.com>
Signed-off-by: NJames Bottomley <James.Bottomley@SteelEye.com>
上级 19966769
...@@ -89,7 +89,7 @@ extern int zfcp_fsf_control_file(struct zfcp_adapter *, struct zfcp_fsf_req **, ...@@ -89,7 +89,7 @@ extern int zfcp_fsf_control_file(struct zfcp_adapter *, struct zfcp_fsf_req **,
u32, u32, struct zfcp_sg_list *); u32, u32, struct zfcp_sg_list *);
extern void zfcp_fsf_start_timer(struct zfcp_fsf_req *, unsigned long); extern void zfcp_fsf_start_timer(struct zfcp_fsf_req *, unsigned long);
extern void zfcp_erp_start_timer(struct zfcp_fsf_req *); 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_status_read(struct zfcp_adapter *, int);
extern int zfcp_fsf_req_create(struct zfcp_adapter *, u32, int, mempool_t *, extern int zfcp_fsf_req_create(struct zfcp_adapter *, u32, int, mempool_t *,
unsigned long *, struct zfcp_fsf_req **); unsigned long *, struct zfcp_fsf_req **);
......
...@@ -176,28 +176,25 @@ static void zfcp_fsf_req_dismiss(struct zfcp_adapter *adapter, ...@@ -176,28 +176,25 @@ static void zfcp_fsf_req_dismiss(struct zfcp_adapter *adapter,
/** /**
* zfcp_fsf_req_dismiss_all - dismiss all remaining fsf requests * 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; struct zfcp_fsf_req *request, *tmp;
unsigned long flags; unsigned long flags;
LIST_HEAD(remove_queue);
unsigned int i, counter; unsigned int i, counter;
spin_lock_irqsave(&adapter->req_list_lock, flags); spin_lock_irqsave(&adapter->req_list_lock, flags);
atomic_set(&adapter->reqs_active, 0); atomic_set(&adapter->reqs_active, 0);
for (i=0; i<REQUEST_LIST_SIZE; i++) { for (i=0; i<REQUEST_LIST_SIZE; i++)
if (list_empty(&adapter->req_list[i])) list_splice_init(&adapter->req_list[i], &remove_queue);
continue;
counter = 0;
list_for_each_entry_safe(request, tmp,
&adapter->req_list[i], list) {
zfcp_fsf_req_dismiss(adapter, request, counter);
counter++;
}
}
spin_unlock_irqrestore(&adapter->req_list_lock, flags); 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++;
}
} }
/* /*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册