Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1073586ybl; Wed, 14 Aug 2019 10:15:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqwZ5UptUuNkTH+p/oiUNagQM/IP+YKVfbLoulZu4soDK+OY2ZKswKjaJ31pYOZva7Ul8HfV X-Received: by 2002:a63:6f8f:: with SMTP id k137mr239801pgc.90.1565802959090; Wed, 14 Aug 2019 10:15:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565802959; cv=none; d=google.com; s=arc-20160816; b=jFe+IScmfDPNepam5zrJTEN5v1ebVTp/CGkXBZzwkuARobU4+pNf41MkvnHMl7j0HS eihs70B1vlncdIR3Ru9eYc0B/vickRuYv3Jzx+g8rqv+4kOzNVcMz6CsulUzGMO6a2kX K4HCEUADRtVLpVK+0MyKBdGM9iXBQW0/fs5XW4Z56pM5InowdmF9GDeGhii+nK4WISKR TySkNT9NbIuencs0WWyrZPTFrWoyQWrKNLcg9GKkPwaNzt418doP8dMMcA4boG2TMgBb K9fPI8wELv5ALKVHdOKpVyXQQfayi1xj6s+S02/MG1MFbvo+xwajGslPI6phI5pnguVF x5Mg== 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=KE4/SKJ5e+gh3GaTs/kCnuvkMhyysDGz5uw1gFcmFy8=; b=XqBH3nFCdbGO+4f+cT8AhPb0fvE/9vAa70MBm0wMWd2pwOgxzDW7MQyFaonLS3d+F6 QxsqwVnvpzIAjkI//bsL1qGRpdc85zpqCv2wfCUCXQDlhElGl0/zFCgXMAG4eXOCQxlH GIIo68rzFkExqQvBub3CcyB57g2mRZzIPwWiVaZpLUAquBFT4N18QxMQKrzTO8SpcwV8 M7WK5d8sblLcMLZwU6zLMOSmvVeAeaPlOnFEXaoAS/wGGY2WxU5UEbaCwUM1INHGyG8+ 9cDkwTlQGVyc4OOYxLanKER6GGBQLoUOUaLhebPeW7sP9ao48GcACn6Alw8+rBChB+mR fhNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=NKStqUdG; 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 w1si194692pjr.92.2019.08.14.10.15.43; Wed, 14 Aug 2019 10:15:59 -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=NKStqUdG; 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 S1730975AbfHNRPN (ORCPT + 99 others); Wed, 14 Aug 2019 13:15:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:39750 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731187AbfHNRPL (ORCPT ); Wed, 14 Aug 2019 13:15:11 -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 24DC4216F4; Wed, 14 Aug 2019 17:15:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565802910; bh=bT/ifoB7YigEAgm+EklFf5SF4up/C8At50C32O+TL2U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NKStqUdGW29dYS1oe4AS9hLN64GXzPhOVIDV/8PbddU67WLNFvVH9XDJkQwcDhZ/U 30uZSERjRF+9H6ID49DtjceUZlqJuY+MBra8f0VeMrJHgFHVt/0zjGuIhqGhSuGkns idF0nP79lEZEbwSCmoXkKUi+w76m4vkQ1orN+hW8= 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.14 47/69] scsi: scsi_dh_alua: always use a 2 second delay before retrying RTPG Date: Wed, 14 Aug 2019 19:01:45 +0200 Message-Id: <20190814165748.628134162@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190814165744.822314328@linuxfoundation.org> References: <20190814165744.822314328@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 09c6a16fab93f..41f5f64101630 100644 --- a/drivers/scsi/device_handler/scsi_dh_alua.c +++ b/drivers/scsi/device_handler/scsi_dh_alua.c @@ -53,6 +53,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 @@ -677,7 +678,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; @@ -802,6 +803,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); @@ -813,6 +816,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