提交 d1b3f51e 编写于 作者: S Satish Kharat 提交者: Martin K. Petersen

scsi: libfc: fix a deadlock in fc_rport_work

In places like fc_rport_recv_plogi_req and fcoe_ctlr_vn_add we always
take the lport disc_mutex lock before the rports mutex
(rp_mutex) lock. Gaurding list_del_rcu(&rdata->peers) with
disc.disc_mutex in fc_rport_work is correct but the rp_mutex lock
can and should to be dropped before taking that lock else results
in a deadlock.
Signed-off-by: NSatish Kharat <satishkh@cisco.com>
Reviewed-by: NJohannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
上级 fbce4d97
...@@ -383,11 +383,11 @@ static void fc_rport_work(struct work_struct *work) ...@@ -383,11 +383,11 @@ static void fc_rport_work(struct work_struct *work)
fc_rport_enter_flogi(rdata); fc_rport_enter_flogi(rdata);
mutex_unlock(&rdata->rp_mutex); mutex_unlock(&rdata->rp_mutex);
} else { } else {
mutex_unlock(&rdata->rp_mutex);
FC_RPORT_DBG(rdata, "work delete\n"); FC_RPORT_DBG(rdata, "work delete\n");
mutex_lock(&lport->disc.disc_mutex); mutex_lock(&lport->disc.disc_mutex);
list_del_rcu(&rdata->peers); list_del_rcu(&rdata->peers);
mutex_unlock(&lport->disc.disc_mutex); mutex_unlock(&lport->disc.disc_mutex);
mutex_unlock(&rdata->rp_mutex);
kref_put(&rdata->kref, fc_rport_destroy); kref_put(&rdata->kref, fc_rport_destroy);
} }
} else { } else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册