From patchwork Thu Sep 12 15:19:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Himanshu Madhani X-Patchwork-Id: 11143291 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 70202112B for ; Thu, 12 Sep 2019 15:20:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4E84F2081B for ; Thu, 12 Sep 2019 15:20:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="fxH/jLuM" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733026AbfILPUB (ORCPT ); Thu, 12 Sep 2019 11:20:01 -0400 Received: from mx0b-0016f401.pphosted.com ([67.231.156.173]:29398 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732699AbfILPUA (ORCPT ); Thu, 12 Sep 2019 11:20:00 -0400 Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id x8CFH9fM011743; Thu, 12 Sep 2019 08:19:58 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0818; bh=SqTLmJw7Y4YC45u+WuW5LZCK5hhcKWW6oeO7NhRao2Y=; b=fxH/jLuM9V5zRtS9+8T6yxkc4V170YeslebnRQyW3NTFjEN7113vzINPh4AT7KLQ3JT0 wUjsUvjMeAHdMbq+8tE7RMLrqnNlbRsSfqIh7anwzBYgw9GBwRjJumI9BnYHZb6lLLbo UYyuDta36pdc7Q4K0YHIjcOznjJDrMPAPdZWD7+qsBRanOjK9XClVxlLbvIXol6kChor wMAbdtiO3XJ638Mzwp0KywdNECKbYeTkJ9E5xJ5/UE3xjM2kpcIW5P2M+GxyOzUt+ycm HhLSL3qV9kTkJOuqAuHrqlqSlsSMDaXQvo+FgHmDLsC538bLzaulLjbNi4fsZ1P/8Lj1 Pg== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0b-0016f401.pphosted.com with ESMTP id 2uvc2jy5nq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 12 Sep 2019 08:19:58 -0700 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 12 Sep 2019 08:19:56 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Thu, 12 Sep 2019 08:19:56 -0700 Received: from dut1171.mv.qlogic.com (unknown [10.112.88.18]) by maili.marvell.com (Postfix) with ESMTP id 5A39D3F703F; Thu, 12 Sep 2019 08:19:56 -0700 (PDT) Received: from dut1171.mv.qlogic.com (localhost [127.0.0.1]) by dut1171.mv.qlogic.com (8.14.7/8.14.7) with ESMTP id x8CFJuNc002391; Thu, 12 Sep 2019 08:19:56 -0700 Received: (from root@localhost) by dut1171.mv.qlogic.com (8.14.7/8.14.7/Submit) id x8CFJuHF002390; Thu, 12 Sep 2019 08:19:56 -0700 From: Himanshu Madhani To: , CC: , Subject: [PATCH 02/14] qla2xxx: Fix unbound sleep in fcport delete path. Date: Thu, 12 Sep 2019 08:19:37 -0700 Message-ID: <20190912151949.2348-3-hmadhani@marvell.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20190912151949.2348-1-hmadhani@marvell.com> References: <20190912151949.2348-1-hmadhani@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.70,1.0.8 definitions=2019-09-12_08:2019-09-11,2019-09-12 signatures=0 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Quinn Tran There are instances, though rare, where a LOGO request cannot be sent out and the thread in free session done can wait indefinitely. Fix this by putting an upper bound to sleep. Signed-off-by: Quinn Tran Signed-off-by: Himanshu Madhani --- drivers/scsi/qla2xxx/qla_target.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c index d0061ae1488e..135c39a3cb66 100644 --- a/drivers/scsi/qla2xxx/qla_target.c +++ b/drivers/scsi/qla2xxx/qla_target.c @@ -1021,6 +1021,7 @@ void qlt_free_session_done(struct work_struct *work) if (logout_started) { bool traced = false; + u16 cnt = 0; while (!READ_ONCE(sess->logout_completed)) { if (!traced) { @@ -1030,6 +1031,9 @@ void qlt_free_session_done(struct work_struct *work) traced = true; } msleep(100); + cnt++; + if (cnt > 200) + break; } ql_dbg(ql_dbg_disc, vha, 0xf087,