Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1070092ybl; Wed, 14 Aug 2019 10:12:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqxt1fjl+No9x9O0qDQDiAxirPLgtDbHvsko6S5QGIVTUmZoHvQqKyFBArPBcoqsy58v8fNN X-Received: by 2002:a17:90a:e28a:: with SMTP id d10mr717626pjz.107.1565802768813; Wed, 14 Aug 2019 10:12:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565802768; cv=none; d=google.com; s=arc-20160816; b=ob61eYaDTOqGb65iX0X21onL8ZwmgjHCcu64G46l/w2jCzshbDsoxiT+z8mmDvMCP0 ao/xd2SbyayXM80UPQ5lgL6G+/oIHhSMtRvqGfjf1yhhNoynGK2RhCdzX7MmEtJLnnnn Le/TZS4BmVXyvRWDeoVo9a83/ANaCPa3gjqtF6d+uw0/H8cRmKsDnixhvK/CERy6wI7f l+PUeWu/UD+fBygeSAfeZ1dPiPxe9ZMYAIrZt82jZ4xcE+LrSPSsSGto281Iwhd34IBf 5cTkR4bguvV7PR6XFkpXi4IMWZ++rdnzroPiGGtQt5CD8WEsQqn3SWbmznA1eOmhZIlr VOTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+c7e6awnKl1boj5nCNB+apKzu1wTYfiIqytJCutU7cI=; b=RMicc8DWZHdL/Os53qcqd7QQwrqghafWHhK2I3ZO8I1lTEqHyj4azIORKDmOAOIGtr JKJhDsCmTj52To/f1diGu7GZtmUK2BferJrUFtojkksY8rEjH+fzrxwVodeBnXV0VVat SnwU81vDnco5iY1gAZ06YsPDsQJogF5P0dtQ9g73OFeT1mY0V2ZZM67IMdwQYWZu6UUY 91WQAeyLA7XTTmrgvm1pUBV7SEE/VHURVWytTTJhlee37tn/f6DDLaRArfuyR4+Gg0L+ lX1pnQVh3vjEi3l05e6qd5hT0B7V+dr9X8XSoR3USzyiA3IY6ISGzrd55SsMmrcRlsgv Okhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=jPMoKfum; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m32si244574pld.236.2019.08.14.10.12.32; Wed, 14 Aug 2019 10:12:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=jPMoKfum; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730674AbfHNRME (ORCPT + 99 others); Wed, 14 Aug 2019 13:12:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:35608 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730668AbfHNRMB (ORCPT ); Wed, 14 Aug 2019 13:12:01 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 619B42063F; Wed, 14 Aug 2019 17:12:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565802720; bh=H/J+QUGTpvkGNfplsZFmab6N54wgsHVUC46ruTanEMA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jPMoKfumwko11cMmX63DeNof5bAoHkc/C2NzPHJkzfJvyCf4zaGxlz4QDxDjdlxAV hyESzJJ+Yk+9IdJYJPqP5Sf3GATDhq0sPmknW4Mh3g9B4q+/sNW37ViPHEt4Frf/Cp vS3F3ZrT5zdBLr2RHIpe38PKgKiVtgYx4+0Z7Pas= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hannes Reinecke , Zhangguanghui , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 4.19 65/91] scsi: scsi_dh_alua: always use a 2 second delay before retrying RTPG Date: Wed, 14 Aug 2019 19:01:28 +0200 Message-Id: <20190814165752.371119116@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190814165748.991235624@linuxfoundation.org> References: <20190814165748.991235624@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 20122994e38aef0ae50555884d287adde6641c94 ] Retrying immediately after we've received a 'transitioning' sense code is pretty much pointless, we should always use a delay before retrying. So ensure the default delay is applied before retrying. Signed-off-by: Hannes Reinecke Tested-by: Zhangguanghui Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/device_handler/scsi_dh_alua.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/device_handler/scsi_dh_alua.c b/drivers/scsi/device_handler/scsi_dh_alua.c index d1154baa9436a..9c21938ed67ed 100644 --- a/drivers/scsi/device_handler/scsi_dh_alua.c +++ b/drivers/scsi/device_handler/scsi_dh_alua.c @@ -54,6 +54,7 @@ #define ALUA_FAILOVER_TIMEOUT 60 #define ALUA_FAILOVER_RETRIES 5 #define ALUA_RTPG_DELAY_MSECS 5 +#define ALUA_RTPG_RETRY_DELAY 2 /* device handler flags */ #define ALUA_OPTIMIZE_STPG 0x01 @@ -696,7 +697,7 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_port_group *pg) case SCSI_ACCESS_STATE_TRANSITIONING: if (time_before(jiffies, pg->expiry)) { /* State transition, retry */ - pg->interval = 2; + pg->interval = ALUA_RTPG_RETRY_DELAY; err = SCSI_DH_RETRY; } else { struct alua_dh_data *h; @@ -821,6 +822,8 @@ static void alua_rtpg_work(struct work_struct *work) spin_lock_irqsave(&pg->lock, flags); pg->flags &= ~ALUA_PG_RUNNING; pg->flags |= ALUA_PG_RUN_RTPG; + if (!pg->interval) + pg->interval = ALUA_RTPG_RETRY_DELAY; spin_unlock_irqrestore(&pg->lock, flags); queue_delayed_work(kaluad_wq, &pg->rtpg_work, pg->interval * HZ); @@ -832,6 +835,8 @@ static void alua_rtpg_work(struct work_struct *work) spin_lock_irqsave(&pg->lock, flags); if (err == SCSI_DH_RETRY || pg->flags & ALUA_PG_RUN_RTPG) { pg->flags &= ~ALUA_PG_RUNNING; + if (!pg->interval && !(pg->flags & ALUA_PG_RUN_RTPG)) + pg->interval = ALUA_RTPG_RETRY_DELAY; pg->flags |= ALUA_PG_RUN_RTPG; spin_unlock_irqrestore(&pg->lock, flags); queue_delayed_work(kaluad_wq, &pg->rtpg_work, -- 2.20.1