Skip to content

Commit e20f80b

Browse files
bjking1martinkpetersen
authored andcommitted
scsi: ibmvfc: Fix up duplicate response detection
Commit a264cf5 ("scsi: ibmvfc: Fix command state accounting and stale response detection") introduced a regression in detecting duplicate responses. This was observed in test where a command was sent to the VIOS and completed before ibmvfc_send_event() set the active flag to 1, which resulted in the atomic_dec_if_positive() call in ibmvfc_handle_crq() thinking this was a duplicate response, which resulted in scsi_done() not getting called, so we then hit a SCSI command timeout for this command once the timeout expires. This simply ensures the active flag gets set prior to making the hcall to send the command to the VIOS, in order to close this window. Link: https://lore.kernel.org/r/[email protected] Fixes: a264cf5 ("scsi: ibmvfc: Fix command state accounting and stale response detection") Cc: [email protected] Acked-by: Tyrel Datwyler <[email protected]> Signed-off-by: Brian King <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 4e5483b commit e20f80b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/scsi/ibmvscsi/ibmvfc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1696,6 +1696,7 @@ static int ibmvfc_send_event(struct ibmvfc_event *evt,
16961696

16971697
spin_lock_irqsave(&evt->queue->l_lock, flags);
16981698
list_add_tail(&evt->queue_list, &evt->queue->sent);
1699+
atomic_set(&evt->active, 1);
16991700

17001701
mb();
17011702

@@ -1710,6 +1711,7 @@ static int ibmvfc_send_event(struct ibmvfc_event *evt,
17101711
be64_to_cpu(crq_as_u64[1]));
17111712

17121713
if (rc) {
1714+
atomic_set(&evt->active, 0);
17131715
list_del(&evt->queue_list);
17141716
spin_unlock_irqrestore(&evt->queue->l_lock, flags);
17151717
del_timer(&evt->timer);
@@ -1737,7 +1739,6 @@ static int ibmvfc_send_event(struct ibmvfc_event *evt,
17371739

17381740
evt->done(evt);
17391741
} else {
1740-
atomic_set(&evt->active, 1);
17411742
spin_unlock_irqrestore(&evt->queue->l_lock, flags);
17421743
ibmvfc_trc_start(evt);
17431744
}

0 commit comments

Comments
 (0)