Commit d16794f6 authored by James.Smart@Emulex.Com's avatar James.Smart@Emulex.Com Committed by James Bottomley

[SCSI] FW: [PATCH] for Deadlock in transport_fc

Cannot call fc_rport_terminate() under the host lock, so drop the
lock.
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 7a9366e4
...@@ -819,12 +819,15 @@ show_fc_private_host_tgtid_bind_type(struct class_device *cdev, char *buf) ...@@ -819,12 +819,15 @@ show_fc_private_host_tgtid_bind_type(struct class_device *cdev, char *buf)
return snprintf(buf, FC_BINDTYPE_MAX_NAMELEN, "%s\n", name); return snprintf(buf, FC_BINDTYPE_MAX_NAMELEN, "%s\n", name);
} }
#define get_list_head_entry(pos, head, member) \
pos = list_entry((head)->next, typeof(*pos), member)
static ssize_t static ssize_t
store_fc_private_host_tgtid_bind_type(struct class_device *cdev, store_fc_private_host_tgtid_bind_type(struct class_device *cdev,
const char *buf, size_t count) const char *buf, size_t count)
{ {
struct Scsi_Host *shost = transport_class_to_shost(cdev); struct Scsi_Host *shost = transport_class_to_shost(cdev);
struct fc_rport *rport, *next_rport; struct fc_rport *rport;
enum fc_tgtid_binding_type val; enum fc_tgtid_binding_type val;
unsigned long flags; unsigned long flags;
...@@ -834,9 +837,13 @@ store_fc_private_host_tgtid_bind_type(struct class_device *cdev, ...@@ -834,9 +837,13 @@ store_fc_private_host_tgtid_bind_type(struct class_device *cdev,
/* if changing bind type, purge all unused consistent bindings */ /* if changing bind type, purge all unused consistent bindings */
if (val != fc_host_tgtid_bind_type(shost)) { if (val != fc_host_tgtid_bind_type(shost)) {
spin_lock_irqsave(shost->host_lock, flags); spin_lock_irqsave(shost->host_lock, flags);
list_for_each_entry_safe(rport, next_rport, while (!list_empty(&fc_host_rport_bindings(shost))) {
&fc_host_rport_bindings(shost), peers) get_list_head_entry(rport,
&fc_host_rport_bindings(shost), peers);
spin_unlock_irqrestore(shost->host_lock, flags);
fc_rport_terminate(rport); fc_rport_terminate(rport);
spin_lock_irqsave(shost->host_lock, flags);
}
spin_unlock_irqrestore(shost->host_lock, flags); spin_unlock_irqrestore(shost->host_lock, flags);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment