be2iscsi: Fix for freeing cid
Subsystems (2)
PATCH 5/20 be2iscsi: Fix for freeing cid
This patch frees up the allocated cid and returns error if allocation
of tag fails.
Signed-off-by Jayamohan Kallickal <[email protected]>
--- drivers/scsi/be2iscsi/be_iscsi.c | 28 +++++++++++++++------------- 1 files changed, 15 insertions(+), 13 deletions(-)
drivers/scsi/be2iscsi/be_iscsi.c +15 -13
@@ -442,6 +442,19 @@ static int beiscsi_get_cid(struct beiscsi_hba *phba) }/** +* beiscsi_put_cid - Free the cid +* @phba: The phba for which the cid is being freed +* @cid: The cid to free +*/ +static void beiscsi_put_cid (struct beiscsi_hba *phba,unsigned short cid) +{ + phba->avlbl_cids++; + phba->cid_array[phba->cid_free++] = cid; +if (phba->cid_free == phba->params.cxns_per_ctrl) + phba->cid_free =0 ; +} + +/** * beiscsi_open_conn - Ask FW to open a TCP connection * @ep: endpoint to be used * @src_addr: The source IP address
@@ -484,6 +497,8 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep,SE_DEBUG (DBG_LVL_1 ,"mgmt_open_connection Failed for cid=%d\n" , beiscsi_ep->ep_cid); +beiscsi_put_cid (phba, beiscsi_ep->ep_cid); +return -EAGAIN ; }else {wait_event_interruptible (phba->ctrl.mcc_wait[tag], phba->ctrl.mcc_numtag[tag]);
@@ -511,19 +526,6 @@ static int beiscsi_open_conn(struct iscsi_endpoint *ep, }/** -* beiscsi_put_cid - Free the cid -* @phba: The phba for which the cid is being freed -* @cid: The cid to free -*/ -static void beiscsi_put_cid (struct beiscsi_hba *phba,unsigned short cid) -{ - phba->avlbl_cids++; - phba->cid_array[phba->cid_free++] = cid; -if (phba->cid_free == phba->params.cxns_per_ctrl) - phba->cid_free =0 ; -} - -/** * beiscsi_free_ep - free endpoint * @ep: pointer to iscsi endpoint structure */
Signature · 1 line
1.6.5.2