scsi: lpfc: Maintain atomic consistency of queue_claimed flag
authorDick Kennedy <dick.kennedy@broadcom.com>
Fri, 1 May 2020 21:43:03 +0000 (14:43 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Fri, 8 May 2020 02:47:21 +0000 (22:47 -0400)
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: Hannes Reinecke <hare@suse.de>
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/lpfc/lpfc_sli.c

index b6fb665e6ec40349de22332a163bab400755442d..9ce37560f4c0846080080b440e2a66ef03d3b5b5 100644 (file)
@@ -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,