Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp2737618ybh; Mon, 5 Aug 2019 06:06:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqzomgF14UQx5nK1+Q2uZProR7ivXhJiZquxgFNFaGl6RfuQ6OH0ZU21XyA8LSCBudKCZ2U3 X-Received: by 2002:a17:90a:db44:: with SMTP id u4mr18092607pjx.52.1565010376607; Mon, 05 Aug 2019 06:06:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565010376; cv=none; d=google.com; s=arc-20160816; b=JfoE/tAut1cUEE1kV0HSYL332poO0vaEfUYfP9PP0cletgrOhr0gwLiumOED2Uqo+A XqHwrjfGoATsh21odNvEnxoqhCV8zEjXzmVj+T4PVwLB6wusMRpJ7CV3TaYcF3sVvKbE NTeDsLIbwHLooMR/7QPrtdblLYdUJ+8H/qi4oPU32M3aBuhVoVdDBn+e0BQ+3jSyPlYY +ihzKuufDNethF8lmtzdghdgJn0lKeOCg2z7knxBg2Z8+yuOpUsxPDfCDKBq8wVLCzuA K8r080PUilRbHyKCBe2GBBNb6Q1y/dQsV2Lb5juDyJOv9WozcFEDVvtRdpxkbfagUrlg QsNA== 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=CcLKVNgeLDxffsuuQvy+PInvBS49lvZ7CpHwMjlSpsk=; b=Fd4RYOAF5/AASJYbQne/nBvs3zUtR30fKQfv8yONKFmt8pVGy8oUs5t2FVouCN7J8F 4wfSvTEzsOM4nxW+SwKVYbm0x6EFnFwqv1HErG/BVsUjXcLYm0tGvUG6PuiA/ZE0u/RK BONNtd36IOvT0XeefhAAVGMxpGwYrL/54Z1DyWsf5aK2d1VyoZMMWyQiThkV7bnLhmLk zlHTbD2Ko/FwnK+TnvTSGS19c6k+OQHl+j5nKb7q0Yh6QA84mItc8GpJOfZeb5EKuTyX nrfOtODDHGM7BtE1Hk3IpOp418266XB3hqxNEWXB24RYGfPd8WQJVMvm1wt0/6z+0Yni I7JA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CQwUmUIA; 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 v1si12932883pjn.79.2019.08.05.06.06.00; Mon, 05 Aug 2019 06:06:16 -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=CQwUmUIA; 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 S1729016AbfHENE0 (ORCPT + 99 others); Mon, 5 Aug 2019 09:04:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:40036 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729003AbfHENEX (ORCPT ); Mon, 5 Aug 2019 09:04:23 -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 EBB082147A; Mon, 5 Aug 2019 13:04:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565010263; bh=JVbvcF1ZlEUlRek4Wl2AbDuSGRAtfBt/8Th29uWfSaI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CQwUmUIAicHwHBamupG3E+WHhngAJxdnqDifEpZGLF/F+8RY+ZzMmuYDdvMGOJrG4 Xm/djdoZN5DtsD+iL0NUIGZTK84AMj/TTcznl1iH9+FYbH7sYzfaHWKKujJzKx7Enz klqnxuaTvuNDV1lojhBcvKLpRfXjzaVoyNJJ2XRA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Stefan Haberland , Jan Hoeppner , Jens Axboe Subject: [PATCH 4.4 21/22] s390/dasd: fix endless loop after read unit address configuration Date: Mon, 5 Aug 2019 15:02:58 +0200 Message-Id: <20190805124923.291513679@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190805124918.070468681@linuxfoundation.org> References: <20190805124918.070468681@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 From: Stefan Haberland commit 41995342b40c418a47603e1321256d2c4a2ed0fb upstream. After getting a storage server event that causes the DASD device driver to update its unit address configuration during a device shutdown there is the possibility of an endless loop in the device driver. In the system log there will be ongoing DASD error messages with RC: -19. The reason is that the loop starting the ruac request only terminates when the retry counter is decreased to 0. But in the sleep_on function there are early exit paths that do not decrease the retry counter. Prevent an endless loop by handling those cases separately. Remove the unnecessary do..while loop since the sleep_on function takes care of retries by itself. Fixes: 8e09f21574ea ("[S390] dasd: add hyper PAV support to DASD device driver, part 1") Cc: stable@vger.kernel.org # 2.6.25+ Signed-off-by: Stefan Haberland Reviewed-by: Jan Hoeppner Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- drivers/s390/block/dasd_alias.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) --- a/drivers/s390/block/dasd_alias.c +++ b/drivers/s390/block/dasd_alias.c @@ -396,6 +396,20 @@ suborder_not_supported(struct dasd_ccw_r char msg_format; char msg_no; + /* + * intrc values ENODEV, ENOLINK and EPERM + * will be optained from sleep_on to indicate that no + * IO operation can be started + */ + if (cqr->intrc == -ENODEV) + return 1; + + if (cqr->intrc == -ENOLINK) + return 1; + + if (cqr->intrc == -EPERM) + return 1; + sense = dasd_get_sense(&cqr->irb); if (!sense) return 0; @@ -460,12 +474,8 @@ static int read_unit_address_configurati lcu->flags &= ~NEED_UAC_UPDATE; spin_unlock_irqrestore(&lcu->lock, flags); - do { - rc = dasd_sleep_on(cqr); - if (rc && suborder_not_supported(cqr)) - return -EOPNOTSUPP; - } while (rc && (cqr->retries > 0)); - if (rc) { + rc = dasd_sleep_on(cqr); + if (rc && !suborder_not_supported(cqr)) { spin_lock_irqsave(&lcu->lock, flags); lcu->flags |= NEED_UAC_UPDATE; spin_unlock_irqrestore(&lcu->lock, flags);