aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorVasu Dev <vasu.dev@intel.com>2009-02-27 13:54:57 -0500
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2009-03-06 16:37:49 -0500
commitbc0e17f691085315ae9303eb5b0883fe16dfe6b1 (patch)
tree53138e80aec810604d4eca4626e4f8df65376ccc /include
parenta7e84f2b83f17f8f11da34ccef3ba5a862dc0182 (diff)
[SCSI] libfc, fcoe: fixed locking issues with lport->lp_mutex around lport->link_status
The fcoe_xmit could call fc_pause in case the pending skb queue len is larger than FCOE_MAX_QUEUE_DEPTH, the fc_pause was trying to grab lport->lp_muex to change lport->link_status and that had these issues :- 1. The fcoe_xmit was getting called with bh disabled, thus causing "BUG: scheduling while atomic" when grabbing lport->lp_muex with bh disabled. 2. fc_linkup and fc_linkdown function calls lport_enter function with lport->lp_mutex held and these enter function in turn calls fcoe_xmit to send lport related FC frame, e.g. fc_linkup => fc_lport_enter_flogi to send flogi req. In this case grabbing the same lport->lp_mutex again in fc_puase from fcoe_xmit would cause deadlock. The lport->lp_mutex was used for setting FC_PAUSE in fcoe_xmit path but FC_PAUSE bit was not used anywhere beside just setting and clear this bit in lport->link_status, instead used a separate field qfull in fc_lport to eliminate need for lport->lp_mutex to track pending queue full condition and in turn avoid above described two locking issues. Also added check for lp->qfull in fc_fcp_lport_queue_ready to trigger SCSI_MLQUEUE_HOST_BUSY when lp->qfull is set to prevent more scsi-ml cmds while lp->qfull is set. This patch eliminated FC_LINK_UP and FC_PAUSE and instead used dedicated fields in fc_lport for this, this simplified all related conditional code. Also removed fc_pause and fc_unpause functions and instead used newly added lport->qfull directly in fcoe. Signed-off-by: Vasu Dev <vasu.dev@intel.com> Signed-off-by: Robert Love <robert.w.love@intel.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'include')
-rw-r--r--include/scsi/libfc.h12
1 files changed, 2 insertions, 10 deletions
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h
index 042f4ade73d7..b9e6c1cd8914 100644
--- a/include/scsi/libfc.h
+++ b/include/scsi/libfc.h
@@ -68,9 +68,6 @@
68/* 68/*
69 * FC HBA status 69 * FC HBA status
70 */ 70 */
71#define FC_PAUSE (1 << 1)
72#define FC_LINK_UP (1 << 0)
73
74enum fc_lport_state { 71enum fc_lport_state {
75 LPORT_ST_NONE = 0, 72 LPORT_ST_NONE = 0,
76 LPORT_ST_FLOGI, 73 LPORT_ST_FLOGI,
@@ -603,7 +600,8 @@ struct fc_lport {
603 600
604 /* Operational Information */ 601 /* Operational Information */
605 struct libfc_function_template tt; 602 struct libfc_function_template tt;
606 u16 link_status; 603 u8 link_up;
604 u8 qfull;
607 enum fc_lport_state state; 605 enum fc_lport_state state;
608 unsigned long boot_time; 606 unsigned long boot_time;
609 607
@@ -704,12 +702,6 @@ void fc_linkup(struct fc_lport *);
704void fc_linkdown(struct fc_lport *); 702void fc_linkdown(struct fc_lport *);
705 703
706/* 704/*
707 * Pause and unpause traffic.
708 */
709void fc_pause(struct fc_lport *);
710void fc_unpause(struct fc_lport *);
711
712/*
713 * Configure the local port. 705 * Configure the local port.
714 */ 706 */
715int fc_lport_config(struct fc_lport *); 707int fc_lport_config(struct fc_lport *);