On Thu, 2019-09-12 at 11:09 -0700, Himanshu Madhani wrote:
> From: Quinn Tran <qut...@marvell.com>
> 
> In the case of NPIV port is being torn down, this patch will
> set a flag to indicate VPORT_DELETE. This would prevent relogin
> to be triggered.
> 
> Signed-off-by: Quinn Tran <qut...@marvell.com>
> Signed-off-by: Himanshu Madhani <hmadh...@marvell.com>
> ---
>  drivers/scsi/qla2xxx/qla_attr.c   |  2 ++
>  drivers/scsi/qla2xxx/qla_def.h    |  1 +
>  drivers/scsi/qla2xxx/qla_gs.c     |  3 ++-
>  drivers/scsi/qla2xxx/qla_mid.c    | 32 ++++++++++++++++++++++-------
> ---
>  drivers/scsi/qla2xxx/qla_os.c     |  7 ++++++-
>  drivers/scsi/qla2xxx/qla_target.c |  1 +
>  6 files changed, 34 insertions(+), 12 deletions(-)
> 
> --- a/drivers/scsi/qla2xxx/qla_mid.c
> +++ b/drivers/scsi/qla2xxx/qla_mid.c
> @@ -66,6 +66,7 @@ qla24xx_deallocate_vp_id(scsi_qla_host_t *vha)
>       uint16_t vp_id;
>       struct qla_hw_data *ha = vha->hw;
>       unsigned long flags = 0;
> +     u8 i;
>  
>       mutex_lock(&ha->vport_lock);
>       /*
> @@ -75,8 +76,9 @@ qla24xx_deallocate_vp_id(scsi_qla_host_t *vha)
>        * ensures no active vp_list traversal while the vport is
> removed
>        * from the queue)
>        */
> -     wait_event_timeout(vha->vref_waitq, !atomic_read(&vha-
> >vref_count),
> -         10*HZ);
> +     for (i = 0; i < 10 && atomic_read(&vha->vref_count); i++)
> +             wait_event_timeout(vha->vref_waitq,
> +                 atomic_read(&vha->vref_count), HZ);

Are you missing a negation in this last line?
Also, what's the point of adding this loop? 


> --- a/drivers/scsi/qla2xxx/qla_os.c
> +++ b/drivers/scsi/qla2xxx/qla_os.c
> @@ -1115,9 +1115,14 @@ static inline int
> test_fcport_count(scsi_qla_host_t *vha)
>  void
>  qla2x00_wait_for_sess_deletion(scsi_qla_host_t *vha)
>  {
> +     u8 i;
> +
>       qla2x00_mark_all_devices_lost(vha, 0);
>  
> -     wait_event_timeout(vha->fcport_waitQ, test_fcport_count(vha),
> 10*HZ);
> +     for (i = 0; i < 10; i++)
> +             wait_event_timeout(vha->fcport_waitQ,
> test_fcport_count(vha),
> +                 HZ);
> +
>       flush_workqueue(vha->hw->wq);
>  }

Perhaps here, the loop should be exited if test_fcport_count(vha) gets
TRUE? And again, why is the loop necessary?

Regards
Martin


Reply via email to