Skip to content

Commit

Permalink
scsi: libfc: fix a deadlock in fc_rport_work
Browse files Browse the repository at this point in the history
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: Satish Kharat <satishkh@cisco.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
  • Loading branch information
Satish Kharat authored and martinkpetersen committed Oct 6, 2017
1 parent fbce4d9 commit d1b3f51
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/scsi/libfc/fc_rport.c
Original file line number Diff line number Diff line change
Expand Up @@ -383,11 +383,11 @@ static void fc_rport_work(struct work_struct *work)
fc_rport_enter_flogi(rdata);
mutex_unlock(&rdata->rp_mutex);
} else {
mutex_unlock(&rdata->rp_mutex);
FC_RPORT_DBG(rdata, "work delete\n");
mutex_lock(&lport->disc.disc_mutex);
list_del_rcu(&rdata->peers);
mutex_unlock(&lport->disc.disc_mutex);
mutex_unlock(&rdata->rp_mutex);
kref_put(&rdata->kref, fc_rport_destroy);
}
} else {
Expand Down

0 comments on commit d1b3f51

Please sign in to comment.