Commit 164ba8d2 authored by Dick Kennedy's avatar Dick Kennedy Committed by Martin K. Petersen
Browse files

scsi: lpfc: Maintain atomic consistency of queue_claimed flag

A previous change introduced the atomic use of queue_claimed flag for eq's
and cq's.  The code works fine, but the clearing of the queue_claimed flag
is not atomic.

Change queue_claimed = 0 into xchg(&queue_claimed, 0) to be consistent for
change under atomicity.

Link: https://lore.kernel.org/r/20200501214310.91713-3-jsmart2021@gmail.com


Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
Signed-off-by: default avatarDick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: default avatarJames Smart <jsmart2021@gmail.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 356ba2a8
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -538,7 +538,7 @@ lpfc_sli4_process_eq(struct lpfc_hba *phba, struct lpfc_queue *eq,
	if (count > eq->EQ_max_eqe)
		eq->EQ_max_eqe = count;
	eq->queue_claimed = 0;
	xchg(&eq->queue_claimed, 0);
rearm_and_exit:
	/* Always clear the EQ. */
@@ -13694,7 +13694,7 @@ __lpfc_sli4_process_cq(struct lpfc_hba *phba, struct lpfc_queue *cq,
				"0369 No entry from completion queue "
				"qid=%d\n", cq->queue_id);
	cq->queue_claimed = 0;
	xchg(&cq->queue_claimed, 0);
rearm_and_exit:
	phba->sli4_hba.sli4_write_cq_db(phba, cq, consumed,