diff mbox series

[RESEND,v2] fixup "qla2xxx: Optimize NPIV tear down process"

Message ID 20191105145550.10268-1-martin.wilck@suse.com (mailing list archive)
State Mainlined
Commit 8b1062d513880b3ec696945f15dc84d179f1f3c1
Headers show
Series [RESEND,v2] fixup "qla2xxx: Optimize NPIV tear down process" | expand

Commit Message

Martin Wilck Nov. 5, 2019, 2:56 p.m. UTC
From: Martin Wilck <mwilck@suse.com>

Hello Martin,

this patch fixes two issues in patch 02/14 in Himanshu's latest
qla2xxx series ("qla2xxx: Bug fixes for the driver") from
Sept. 12th, which you applied onto 5.4/scsi-fixes already.
See https://marc.info/?l=linux-scsi&m=156951704106671&w=2

I'm assuming that Himanshu and Quinn are working on another
series of fixes, in which case that should take precedence
over this patch. I just wanted to provide this so that the
already known problems are fixed in your tree.

v2: check loop condition only once (Bart van Assche)

Commit message follows:

Fix two issues with the previously submitted patch
"qla2xxx: Optimize NPIV tear down process": a missing negation
in a wait_event_timeout() condition, and a missing loop end
condition.

Signed-off-by: Martin Wilck <mwilck@suse.com>
Fixes: f5187b7d1ac6 ("scsi: qla2xxx: Optimize NPIV tear down process")
---
 drivers/scsi/qla2xxx/qla_mid.c | 8 +++++---
 drivers/scsi/qla2xxx/qla_os.c  | 8 +++++---
 2 files changed, 10 insertions(+), 6 deletions(-)

Comments

Himanshu Madhani Nov. 5, 2019, 3:04 p.m. UTC | #1
On 11/5/19, 8:59 AM, "linux-scsi-owner@vger.kernel.org on behalf of Martin Wilck" <linux-scsi-owner@vger.kernel.org on behalf of Martin.Wilck@suse.com> wrote:

    From: Martin Wilck <mwilck@suse.com>
    
    Hello Martin,
    
    this patch fixes two issues in patch 02/14 in Himanshu's latest
    qla2xxx series ("qla2xxx: Bug fixes for the driver") from
    Sept. 12th, which you applied onto 5.4/scsi-fixes already.
    See https://urldefense.proofpoint.com/v2/url?u=https-3A__marc.info_-3Fl-3Dlinux-2Dscsi-26m-3D156951704106671-26w-3D2&d=DwIDAw&c=nKjWec2b6R0mOyPaz7xtfQ&r=lanuADUiz2ynuLzGAQkJPfvgrZxmmOucLvCpGp9SngU&m=NJlapTkH8uLnZ9PSYZ3iR_rXJzyr5E0FXcqfRQu9_jY&s=nPvI253oURt0Q2P-CIWTEymjBPtBRooenDjCrNd3mQ4&e= 
    
    I'm assuming that Himanshu and Quinn are working on another
    series of fixes, in which case that should take precedence
    over this patch. I just wanted to provide this so that the
    already known problems are fixed in your tree.
    
    v2: check loop condition only once (Bart van Assche)
    
    Commit message follows:
    
    Fix two issues with the previously submitted patch
    "qla2xxx: Optimize NPIV tear down process": a missing negation
    in a wait_event_timeout() condition, and a missing loop end
    condition.
    
    Signed-off-by: Martin Wilck <mwilck@suse.com>
    Fixes: f5187b7d1ac6 ("scsi: qla2xxx: Optimize NPIV tear down process")
    ---
     drivers/scsi/qla2xxx/qla_mid.c | 8 +++++---
     drivers/scsi/qla2xxx/qla_os.c  | 8 +++++---
     2 files changed, 10 insertions(+), 6 deletions(-)
    
    diff --git a/drivers/scsi/qla2xxx/qla_mid.c b/drivers/scsi/qla2xxx/qla_mid.c
    index 6afad68e5ba2..238240984bc1 100644
    --- a/drivers/scsi/qla2xxx/qla_mid.c
    +++ b/drivers/scsi/qla2xxx/qla_mid.c
    @@ -76,9 +76,11 @@ qla24xx_deallocate_vp_id(scsi_qla_host_t *vha)
     	 * ensures no active vp_list traversal while the vport is removed
     	 * from the queue)
     	 */
    -	for (i = 0; i < 10 && atomic_read(&vha->vref_count); i++)
    -		wait_event_timeout(vha->vref_waitq,
    -		    atomic_read(&vha->vref_count), HZ);
    +	for (i = 0; i < 10; i++) {
    +		if (wait_event_timeout(vha->vref_waitq,
    +		    !atomic_read(&vha->vref_count), HZ) > 0)
    +			break;
    +	}
     
     	spin_lock_irqsave(&ha->vport_slock, flags);
     	if (atomic_read(&vha->vref_count)) {
    diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
    index 6e627e521562..ee5b6cba9872 100644
    --- a/drivers/scsi/qla2xxx/qla_os.c
    +++ b/drivers/scsi/qla2xxx/qla_os.c
    @@ -1119,9 +1119,11 @@ qla2x00_wait_for_sess_deletion(scsi_qla_host_t *vha)
     
     	qla2x00_mark_all_devices_lost(vha, 0);
     
    -	for (i = 0; i < 10; i++)
    -		wait_event_timeout(vha->fcport_waitQ, test_fcport_count(vha),
    -		    HZ);
    +	for (i = 0; i < 10; i++) {
    +		if (wait_event_timeout(vha->fcport_waitQ,
    +		    test_fcport_count(vha), HZ) > 0)
    +			break;
    +	}
     
     	flush_workqueue(vha->hw->wq);
     }
    -- 
    2.12.3
    
    
Thanks for the fixup.

Acked-by: Himanshu Madhani <hmadhani@marvell.com>
Martin K. Petersen Nov. 6, 2019, 5:01 a.m. UTC | #2
Martin,

Applied to 5.4/scsi-fixes, thanks.

Next time, please run checkpatch on your patch and please make sure you
get the ordering of commit description and commentary/changelog right.
diff mbox series

Patch

diff --git a/drivers/scsi/qla2xxx/qla_mid.c b/drivers/scsi/qla2xxx/qla_mid.c
index 6afad68e5ba2..238240984bc1 100644
--- a/drivers/scsi/qla2xxx/qla_mid.c
+++ b/drivers/scsi/qla2xxx/qla_mid.c
@@ -76,9 +76,11 @@  qla24xx_deallocate_vp_id(scsi_qla_host_t *vha)
 	 * ensures no active vp_list traversal while the vport is removed
 	 * from the queue)
 	 */
-	for (i = 0; i < 10 && atomic_read(&vha->vref_count); i++)
-		wait_event_timeout(vha->vref_waitq,
-		    atomic_read(&vha->vref_count), HZ);
+	for (i = 0; i < 10; i++) {
+		if (wait_event_timeout(vha->vref_waitq,
+		    !atomic_read(&vha->vref_count), HZ) > 0)
+			break;
+	}
 
 	spin_lock_irqsave(&ha->vport_slock, flags);
 	if (atomic_read(&vha->vref_count)) {
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 6e627e521562..ee5b6cba9872 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -1119,9 +1119,11 @@  qla2x00_wait_for_sess_deletion(scsi_qla_host_t *vha)
 
 	qla2x00_mark_all_devices_lost(vha, 0);
 
-	for (i = 0; i < 10; i++)
-		wait_event_timeout(vha->fcport_waitQ, test_fcport_count(vha),
-		    HZ);
+	for (i = 0; i < 10; i++) {
+		if (wait_event_timeout(vha->fcport_waitQ,
+		    test_fcport_count(vha), HZ) > 0)
+			break;
+	}
 
 	flush_workqueue(vha->hw->wq);
 }