Skip to content

Commit 8b1062d

Browse files
mwilckmartinkpetersen
authored andcommitted
scsi: qla2xxx: fix NPIV tear down process
Fix two issues with commit f5187b7 ("scsi: qla2xxx: Optimize NPIV tear down process"): a missing negation in a wait_event_timeout() condition, and a missing loop end condition. Fixes: f5187b7 ("scsi: qla2xxx: Optimize NPIV tear down process") Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin Wilck <[email protected]> Acked-by: Himanshu Madhani <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent edc1f54 commit 8b1062d

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

drivers/scsi/qla2xxx/qla_mid.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,11 @@ qla24xx_deallocate_vp_id(scsi_qla_host_t *vha)
7676
* ensures no active vp_list traversal while the vport is removed
7777
* from the queue)
7878
*/
79-
for (i = 0; i < 10 && atomic_read(&vha->vref_count); i++)
80-
wait_event_timeout(vha->vref_waitq,
81-
atomic_read(&vha->vref_count), HZ);
79+
for (i = 0; i < 10; i++) {
80+
if (wait_event_timeout(vha->vref_waitq,
81+
!atomic_read(&vha->vref_count), HZ) > 0)
82+
break;
83+
}
8284

8385
spin_lock_irqsave(&ha->vport_slock, flags);
8486
if (atomic_read(&vha->vref_count)) {

drivers/scsi/qla2xxx/qla_os.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,9 +1119,11 @@ qla2x00_wait_for_sess_deletion(scsi_qla_host_t *vha)
11191119

11201120
qla2x00_mark_all_devices_lost(vha, 0);
11211121

1122-
for (i = 0; i < 10; i++)
1123-
wait_event_timeout(vha->fcport_waitQ, test_fcport_count(vha),
1124-
HZ);
1122+
for (i = 0; i < 10; i++) {
1123+
if (wait_event_timeout(vha->fcport_waitQ,
1124+
test_fcport_count(vha), HZ) > 0)
1125+
break;
1126+
}
11251127

11261128
flush_workqueue(vha->hw->wq);
11271129
}

0 commit comments

Comments
 (0)