Re: [PATCH v2 01/14] qla2xxx: Fix delayed response to command for loop mode/direct connect.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2017-02-03 at 14:40 -0800, Himanshu Madhani wrote:
> +static void qla2x00_iocb_work_fn(struct work_struct *work)
> +{
> +	struct scsi_qla_host *vha = container_of(work,
> +		struct scsi_qla_host, iocb_work);
> +	unsigned long flags;
> +	int cnt = 0;
> +
> +	while (!list_empty(&vha->work_list)) {
> +		qla2x00_do_work(vha);
> +		cnt++;
> +		if (cnt > 10)
> +			break;
> +	}
> +
> +	spin_lock_irqsave(&vha->work_lock, flags);
> +	vha->flags.iocb_work_sheduled = 0;
> +	spin_unlock_irqrestore(&vha->work_lock, flags);
> +}
> +
> +void qla2x00_schedule_work(struct scsi_qla_host *vha)
> +{
> +	unsigned long flags;
> +
> +	spin_lock_irqsave(&vha->work_lock, flags);
> +	if (vha->flags.iocb_work_sheduled) {
> +		spin_unlock_irqrestore(&vha->work_lock, flags);
> +		return;
> +	}
> +	vha->flags.iocb_work_sheduled = 1;
> +	spin_unlock_irqrestore(&vha->work_lock, flags);
> +
> +	/*
> +	 * We're in the middle of bringing up the adapter.
> +	 * the scheduled work need to go out now.
> +	 */
> +	INIT_WORK(&vha->iocb_work, qla2x00_iocb_work_fn);
> +	schedule_work(&vha->iocb_work);
> +}

Please move the INIT_WORK() call to an initialization function such that
is executed once instead of during every qla2x00_schedule_work() call. Please
also remove the iocb_work_sheduled variable and all code that tests and sets
it. schedule_work() already checks whether or not a work item has been
scheduled.

> @@ -4564,7 +4568,8 @@ static int qlt_24xx_handle_els(struct scsi_qla_host *vha,
>  		}
>  
>  		if (sess != NULL) {
> -			if (sess->fw_login_state == DSC_LS_PLOGI_PEND) {
> +			if ((sess->fw_login_state != DSC_LS_PLOGI_PEND) &&
> +			    (sess->fw_login_state != DSC_LS_PLOGI_COMP)) {

The != operator has a higher precedence than the && operator so the parentheses
around the inequality test are not needed.

Bart.



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux