Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1064475ybl; Wed, 14 Aug 2019 10:08:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqzAwKUZgJmSk/sFXt6yMhXdEmOZdZm2sv37R0TXkvIQ6GOKb9Qh4WnpxNHyluCEDMUMwmpu X-Received: by 2002:aa7:90d8:: with SMTP id k24mr952418pfk.115.1565802495509; Wed, 14 Aug 2019 10:08:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565802495; cv=none; d=google.com; s=arc-20160816; b=Rrzz/89l/fv0WLoQ2PVVc1ETs1scJte/H73jId8HslgcptlTex3qzLarCDy9tKLgQm CgzpADDFCbgX+leZJK5gGc5tVHJ4EXOAyGP67ZJeCofSY0cSy3JkLs6lHtapWp/dTPfj CBHjBEf/80LzB3ANt/Yaiy+EmjODZj+BoLZXngSUn6o9P+1l3OrwQgCrngnFsVhS/twk i+Mw63BuXKM4ZTTfkDgUmetTfIAgPFSOlPqbGyb9VxwCbo2VXQpR0MzL6jNE4sCkOmrv GVX1+5CYklVuqljOh+mRIqAR2oyp8l4rLgwOxwnZsuF4SRGDrWzrsOjqLYlBzzVjVqzF vQ4A== 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=qy+hOmf1Ujq5jXYiGEUZ9vqvjY/RyXrV4D4gCZFp8TE=; b=ewxKlJ6cNydmWbGruwsjnCCxn2rUlsoMHDuBBI6o8ISj51CcGVOhbgZUjJmeBJGg+x hLDFmc2bDN+Q1EWplN/0RRKt1lgzFEmD7bRIirzWZVKbRZfB8Y/AtuvvpDHjmAq2WhG4 TAOiQwssOMQnG8y1GLsAnDE0KuIHYoMeRsSsaVT86O2T+a+FYHlr/thoBcjcMp8WdItl mVaqm4dCKnIf+eBn5JU/urjYp072l/fxtwCTeN8J0okjDDoZ0w9xdPiVwa0MvDM0IK2r Kril0UCbIFMAvBikVqY08kNJWqWMq+MYrNeXCySaWcXkYVg/VE/EYI3V3Zs9d2O0sCa7 HYmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CBlubNSV; 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 h11si161070pgr.555.2019.08.14.10.07.59; Wed, 14 Aug 2019 10:08:15 -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=CBlubNSV; 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 S1729706AbfHNRGj (ORCPT + 99 others); Wed, 14 Aug 2019 13:06:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:55824 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729244AbfHNRGg (ORCPT ); Wed, 14 Aug 2019 13:06:36 -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 AFD0F216F4; Wed, 14 Aug 2019 17:06:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565802396; bh=4noxMmMwwZlBjkmbUaPchq6ruRdbS3jvks2GTzEWJc0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CBlubNSV5pHYmdcGD90db78SU88WrfYDeadiynP+7KUeCXk7h6AkVogVsp6HKAILb hMBdaSTB+6ZIBF0Mq6TbsQhSQi4qvs+DCetE+TTaidWwNwzeih3c0wx/ZkNKOrzn0C O33V3QmVM34li1IV6c50xvTgvaTmU9GVId7G7wOA= 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 5.2 109/144] scsi: scsi_dh_alua: always use a 2 second delay before retrying RTPG Date: Wed, 14 Aug 2019 19:01:05 +0200 Message-Id: <20190814165804.469685205@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190814165759.466811854@linuxfoundation.org> References: <20190814165759.466811854@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 f0066f8a17864..4971104b1817b 100644 --- a/drivers/scsi/device_handler/scsi_dh_alua.c +++ b/drivers/scsi/device_handler/scsi_dh_alua.c @@ -40,6 +40,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 @@ -682,7 +683,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; @@ -807,6 +808,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); @@ -818,6 +821,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