From: James Smart Date: Tue, 30 Jan 2018 23:58:54 +0000 (-0800) Subject: scsi: lpfc: Fix soft lockup in lpfc worker thread during LIP testing X-Git-Tag: v4.1.12-124.31.3~984 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=71d7990846eeb3facf2506f5263f2734db3d8de5;p=users%2Fjedix%2Flinux-maple.git scsi: lpfc: Fix soft lockup in lpfc worker thread during LIP testing Orabug: 27631736 During link bounce testing in a point-to-point topology, the host may enter a soft lockup on the lpfc_worker thread: Call Trace: lpfc_work_done+0x1f3/0x1390 [lpfc] lpfc_do_work+0x16f/0x180 [lpfc] kthread+0xc7/0xe0 ret_from_fork+0x3f/0x70 The driver was simultaneously setting a combination of flags that caused lpfc_do_work()to effectively spin between slow path work and new event data, causing the lockup. Ensure in the typical wq completions, that new event data flags are set if the slow path flag is running. The slow path will eventually reschedule the wq handling. Signed-off-by: Dick Kennedy Signed-off-by: James Smart Reviewed-by: Hannes Reinecke Signed-off-by: Martin K. Petersen (cherry picked from commit 161df4f09987ae2e9f0f97f0b38eee298b4a39ff) Signed-off-by: Dick dkennedy Signed-off-by: Dan Duval Reviewed-by: Jack Vogel --- diff --git a/drivers/scsi/lpfc/lpfc_hbadisc.c b/drivers/scsi/lpfc/lpfc_hbadisc.c index eb541a5c4774..7cc9141ee53a 100644 --- a/drivers/scsi/lpfc/lpfc_hbadisc.c +++ b/drivers/scsi/lpfc/lpfc_hbadisc.c @@ -691,8 +691,9 @@ lpfc_work_done(struct lpfc_hba *phba) (phba->hba_flag & HBA_SP_QUEUE_EVT)) { if (pring->flag & LPFC_STOP_IOCB_EVENT) { pring->flag |= LPFC_DEFERRED_RING_EVENT; - /* Set the lpfc data pending flag */ - set_bit(LPFC_DATA_READY, &phba->data_flags); + /* Preserve legacy behavior. */ + if (!(phba->hba_flag & HBA_SP_QUEUE_EVT)) + set_bit(LPFC_DATA_READY, &phba->data_flags); } else { if (phba->link_state >= LPFC_LINK_UP || phba->link_flag & LS_MDS_LOOPBACK) {