mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Nicholas A. Bellinger" <nab@linux-iscsi.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	Joe Carnuccio <joe.carnuccio@cavium.com>,
	Himanshu Madhani <himanshu.madhani@cavium.com>,
	target-devel <target-devel@vger.kernel.org>
Subject: Re: [PATCH 4.10 15/17] qla2xxx: Allow vref count to timeout on vport delete.
Date: Fri, 31 Mar 2017 00:50:33 -0700	[thread overview]
Message-ID: <1490946633.6977.91.camel@haakon3.risingtidesystems.com> (raw)
In-Reply-To: <20170330095928.025909382@linuxfoundation.org>

Hi Joe + Himanshu,

Thanks for backporting this patch to apply to v4.10.y.

I haven't seen it queued to v4.9.y yet though, would you be so kind to
send out a v4.9.y backport as well to Greg-KH + stable team so it can be
picked up for earlier stable versions too..?

Thank you,

On Thu, 2017-03-30 at 12:00 +0200, Greg Kroah-Hartman wrote:
> 4.10-stable review patch.  If anyone has any objections, please let me know.
> 
> ------------------
> 
> From: Joe Carnuccio <joe.carnuccio@cavium.com>
> 
> commit c4a9b538ab2a109c5f9798bea1f8f4bf93aadfb9 upstream.
> 
> Signed-off-by: Joe Carnuccio <joe.carnuccio@cavium.com>
> Signed-off-by: Himanshu Madhani <himanshu.madhani@cavium.com>
> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> 
> ---
>  drivers/scsi/qla2xxx/qla_attr.c |    4 +---
>  drivers/scsi/qla2xxx/qla_def.h  |    6 +++++-
>  drivers/scsi/qla2xxx/qla_init.c |    1 +
>  drivers/scsi/qla2xxx/qla_mid.c  |   14 ++++++++------
>  drivers/scsi/qla2xxx/qla_os.c   |    1 +
>  5 files changed, 16 insertions(+), 10 deletions(-)
> 
> --- a/drivers/scsi/qla2xxx/qla_attr.c
> +++ b/drivers/scsi/qla2xxx/qla_attr.c
> @@ -2154,8 +2154,6 @@ qla24xx_vport_delete(struct fc_vport *fc
>  		    "Timer for the VP[%d] has stopped\n", vha->vp_idx);
>  	}
>  
> -	BUG_ON(atomic_read(&vha->vref_count));
> -
>  	qla2x00_free_fcports(vha);
>  
>  	mutex_lock(&ha->vport_lock);
> @@ -2163,7 +2161,7 @@ qla24xx_vport_delete(struct fc_vport *fc
>  	clear_bit(vha->vp_idx, ha->vp_idx_map);
>  	mutex_unlock(&ha->vport_lock);
>  
> -	if (vha->qpair->vp_idx == vha->vp_idx) {
> +	if (vha->qpair && vha->qpair->vp_idx == vha->vp_idx) {
>  		if (qla2xxx_delete_qpair(vha, vha->qpair) != QLA_SUCCESS)
>  			ql_log(ql_log_warn, vha, 0x7087,
>  			    "Queue Pair delete failed.\n");
> --- a/drivers/scsi/qla2xxx/qla_def.h
> +++ b/drivers/scsi/qla2xxx/qla_def.h
> @@ -3788,6 +3788,7 @@ typedef struct scsi_qla_host {
>  	struct qla8044_reset_template reset_tmplt;
>  	struct qla_tgt_counters tgt_counters;
>  	uint16_t	bbcr;
> +	wait_queue_head_t vref_waitq;
>  } scsi_qla_host_t;
>  
>  struct qla27xx_image_status {
> @@ -3843,14 +3844,17 @@ struct qla2_sgx {
>  	mb();						\
>  	if (__vha->flags.delete_progress) {		\
>  		atomic_dec(&__vha->vref_count);		\
> +		wake_up(&__vha->vref_waitq);		\
>  		__bail = 1;				\
>  	} else {					\
>  		__bail = 0;				\
>  	}						\
>  } while (0)
>  
> -#define QLA_VHA_MARK_NOT_BUSY(__vha)			\
> +#define QLA_VHA_MARK_NOT_BUSY(__vha) do {		\
>  	atomic_dec(&__vha->vref_count);			\
> +	wake_up(&__vha->vref_waitq);			\
> +} while (0)						\
>  
>  #define QLA_QPAIR_MARK_BUSY(__qpair, __bail) do {	\
>  	atomic_inc(&__qpair->ref_count);		\
> --- a/drivers/scsi/qla2xxx/qla_init.c
> +++ b/drivers/scsi/qla2xxx/qla_init.c
> @@ -4352,6 +4352,7 @@ qla2x00_update_fcports(scsi_qla_host_t *
>  			}
>  		}
>  		atomic_dec(&vha->vref_count);
> +		wake_up(&vha->vref_waitq);
>  	}
>  	spin_unlock_irqrestore(&ha->vport_slock, flags);
>  }
> --- a/drivers/scsi/qla2xxx/qla_mid.c
> +++ b/drivers/scsi/qla2xxx/qla_mid.c
> @@ -74,13 +74,14 @@ qla24xx_deallocate_vp_id(scsi_qla_host_t
>  	 * ensures no active vp_list traversal while the vport is removed
>  	 * from the queue)
>  	 */
> -	spin_lock_irqsave(&ha->vport_slock, flags);
> -	while (atomic_read(&vha->vref_count)) {
> -		spin_unlock_irqrestore(&ha->vport_slock, flags);
> -
> -		msleep(500);
> +	wait_event_timeout(vha->vref_waitq, atomic_read(&vha->vref_count),
> +	    10*HZ);
>  
> -		spin_lock_irqsave(&ha->vport_slock, flags);
> +	spin_lock_irqsave(&ha->vport_slock, flags);
> +	if (atomic_read(&vha->vref_count)) {
> +		ql_dbg(ql_dbg_vport, vha, 0xfffa,
> +		    "vha->vref_count=%u timeout\n", vha->vref_count.counter);
> +		vha->vref_count = (atomic_t)ATOMIC_INIT(0);
>  	}
>  	list_del(&vha->list);
>  	qlt_update_vp_map(vha, RESET_VP_IDX);
> @@ -269,6 +270,7 @@ qla2x00_alert_all_vps(struct rsp_que *rs
>  
>  			spin_lock_irqsave(&ha->vport_slock, flags);
>  			atomic_dec(&vha->vref_count);
> +			wake_up(&vha->vref_waitq);
>  		}
>  		i++;
>  	}
> --- a/drivers/scsi/qla2xxx/qla_os.c
> +++ b/drivers/scsi/qla2xxx/qla_os.c
> @@ -4215,6 +4215,7 @@ struct scsi_qla_host *qla2x00_create_hos
>  
>  	spin_lock_init(&vha->work_lock);
>  	spin_lock_init(&vha->cmd_list_lock);
> +	init_waitqueue_head(&vha->vref_waitq);
>  
>  	sprintf(vha->host_str, "%s_%ld", QLA2XXX_DRIVER_NAME, vha->host_no);
>  	ql_dbg(ql_dbg_init, vha, 0x0041,
> 
> 

  reply	other threads:[~2017-03-31  7:50 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-30 10:00 [PATCH 4.10 00/17] 4.10.8-stable review Greg Kroah-Hartman
2017-03-30 10:00 ` [PATCH 4.10 01/17] xfrm: policy: init locks early Greg Kroah-Hartman
2017-03-30 10:00 ` [PATCH 4.10 02/17] xfrm_user: validate XFRM_MSG_NEWAE XFRMA_REPLAY_ESN_VAL replay_window Greg Kroah-Hartman
2017-03-30 10:00 ` [PATCH 4.10 03/17] xfrm_user: validate XFRM_MSG_NEWAE incoming ESN size harder Greg Kroah-Hartman
2017-03-30 10:00 ` [PATCH 4.10 05/17] KVM: x86: cleanup the page tracking SRCU instance Greg Kroah-Hartman
2017-03-30 10:00 ` [PATCH 4.10 06/17] virtio_balloon: init 1st buffer in stats vq Greg Kroah-Hartman
2017-03-30 10:00 ` [PATCH 4.10 07/17] pinctrl: qcom: Dont clear status bit on irq_unmask Greg Kroah-Hartman
2017-03-30 10:00 ` [PATCH 4.10 08/17] c6x/ptrace: Remove useless PTRACE_SETREGSET implementation Greg Kroah-Hartman
2017-03-30 10:00 ` [PATCH 4.10 09/17] h8300/ptrace: Fix incorrect register transfer count Greg Kroah-Hartman
2017-03-30 10:00 ` [PATCH 4.10 10/17] mips/ptrace: Preserve previous registers for short regset write Greg Kroah-Hartman
2017-03-30 10:00 ` [PATCH 4.10 11/17] sparc/ptrace: " Greg Kroah-Hartman
2017-03-30 10:00 ` [PATCH 4.10 12/17] metag/ptrace: " Greg Kroah-Hartman
2017-03-30 10:00 ` [PATCH 4.10 13/17] metag/ptrace: Provide default TXSTATUS for short NT_PRSTATUS Greg Kroah-Hartman
2017-03-30 10:00 ` [PATCH 4.10 14/17] metag/ptrace: Reject partial NT_METAG_RPIPE writes Greg Kroah-Hartman
2017-03-30 10:00 ` [PATCH 4.10 15/17] qla2xxx: Allow vref count to timeout on vport delete Greg Kroah-Hartman
2017-03-31  7:50   ` Nicholas A. Bellinger [this message]
2017-03-30 10:00 ` [PATCH 4.10 16/17] sched/rt: Add a missing rescheduling point Greg Kroah-Hartman
2017-03-30 10:00 ` [PATCH 4.10 17/17] usb: musb: fix possible spinlock deadlock Greg Kroah-Hartman
2017-03-30 18:54 ` [PATCH 4.10 00/17] 4.10.8-stable review Shuah Khan
2017-03-31  7:48   ` Greg Kroah-Hartman
2017-03-31  3:46 ` Guenter Roeck
2017-03-31  7:48   ` Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1490946633.6977.91.camel@haakon3.risingtidesystems.com \
    --to=nab@linux-iscsi.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=himanshu.madhani@cavium.com \
    --cc=joe.carnuccio@cavium.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=target-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®