[Open-FCoE] [PATCH 2/2] libfc: fixed fc_exch_timeout() issues

Mike Christie michaelc at cs.wisc.edu
Tue Sep 2 15:03:04 UTC 2008


Looks ok too. Thanks.

Vasu Dev wrote:
> @@ -406,16 +445,15 @@ static void fc_exch_timeout(unsigned long ep_arg)
>  		if (e_stat & ESB_ST_REC_QUAL)
>  			fc_exch_rrq(ep);
>  		goto done;
> -	} else if (!(e_stat & ESB_ST_ABNORMAL)) {
> +	} else {
>  		resp = ep->resp;
>  		arg = ep->resp_arg;
> -		/*
> -		 * For FCP commands fc_fcp.c will manage the completion.
> -		 * For all others fc_exch.c will handle.
> -		 */
> -		if (ep->fh_type != FC_TYPE_FCP)
> -			ep->resp = NULL;
> +		ep->resp = NULL;
> +		if (e_stat & ESB_ST_ABNORMAL)
> +			rc = fc_exch_done_locked(ep);
>  		spin_unlock_bh(&ep->ex_lock);
> +		if (!rc)
> +			fc_exch_mgr_delete_ep(ep);
>  		if (resp)
>  			resp(sp, ERR_PTR(-FC_EX_TIMEOUT), arg);
>  		fc_seq_exch_abort(sp, 2 * ep->r_a_tov);
> @@ -556,44 +594,6 @@ static struct fc_exch *fc_exch_find(struct fc_exch_mgr *mp, u16 xid)
>  	return ep;
>  }
>  
> -static void fc_exch_mgr_delete_ep(struct fc_exch *ep)
> -{
> -	struct fc_exch_mgr *mp;
> -
> -	mp = ep->em;
> -	spin_lock_bh(&mp->em_lock);
> -	WARN_ON(mp->total_exches <= 0);
> -	mp->total_exches--;
> -	mp->exches[ep->xid - mp->min_xid] = NULL;
> -	list_del(&ep->ex_list);
> -	spin_unlock_bh(&mp->em_lock);
> -}
> -
> -static int fc_exch_done_locked(struct fc_exch *ep)
> -{
> -	int rc = 1;
> -
> -	/*
> -	 * We must check for completion in case there are two threads
> -	 * tyring to complete this. But the rrq code will reuse the
> -	 * ep, and in that case we only clear the resp and set it as
> -	 * complete, so it can be reused by the timer to send the rrq.
> -	 */
> -	ep->resp = NULL;
> -	if (ep->state & FC_EX_DONE)
> -		return rc;
> -	ep->esb_stat |= ESB_ST_COMPLETE;
> -
> -	if (!(ep->esb_stat & ESB_ST_REC_QUAL)) {
> -		ep->state |= FC_EX_DONE;
> -		if (del_timer(&ep->ex_timer))
> -			atomic_dec(&ep->ex_refcnt); /* drop hold for timer */
> -		atomic_dec(&ep->ex_refcnt); /* drop hold from alloc */
> -		rc = 0;
> -	}
> -	return rc;
> -}
> -
>  void fc_exch_done(struct fc_seq *sp)
>  {
>  	struct fc_exch *ep = fc_seq_exch(sp);
> 
> _______________________________________________
> devel mailing list
> devel at open-fcoe.org
> http://www.open-fcoe.org/mailman/listinfo/devel




More information about the devel mailing list