Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp2761869ybh; Mon, 5 Aug 2019 06:26:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqw0UEySZCiDFw1IS88UcpGjosIDgrX21r+I26x5tlaiuN+AsstNW6j0syGgCjdfESPcMkCa X-Received: by 2002:a17:90a:ca0f:: with SMTP id x15mr17666776pjt.82.1565011612501; Mon, 05 Aug 2019 06:26:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565011612; cv=none; d=google.com; s=arc-20160816; b=vNDWsSgLqDaHr+mRKTtd34UzEjzcxDBEElTIlEcx8hV3+SpBgJx04c+01fXWaTwHNz PxIgQfz3FX5cUFitcwA06m0wgq0EZlbTF48eGIibj3NY5yXUt1+g7PVt0yV8upmPihZD YkhmyEGsmNnOekxnDdadlafcOBH/cmSziZ6u6LOXyvlTuQ0H4R815L/YWPxGPsnrQzps xVOYN//HBzr11Q71VT9WLkqiFA7yyKuCQypi9QMiNuDndbvWDQ3BEKcDygynlyZQTJP3 LYL45Jx0sjBtYviqlUfDWLnWyRnMFYy9bE0npg/ujMCpNwms/eEVm2Ib0ozPvkVd/q6G dLVQ== 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=eAqUL49edXVfJQ0qC+k8AkYPjj8xLH9Oz2p5XHKHWaU=; b=Z+P4xNWBJzH/012eT+Aod6VP8Gj397ro/Yt+g0UThkr1gkljiz7xwzXxL6fTRTwHvL 0bTP2ap/gqaquand46nNdzUA5H8qEKWp5fPwS2/ZiTKmjgTpSdoaOmiHxqPQIJP1oE/p toQl0m7+A5iIOhcan3/rUPvcbqhRVmJUP7iIc7WaR1GG7KJSl8pvgXoIi4JjMNhLRbYB uUkbHPyarFETbKljr+Je6JSv5yg4zUqQCVvUaFmJ4dIkZyjyF+7njiuU25gpCUrKSVtD W2u6gRL+JZ42+U/gd0SiL9iosqmv0BJrzP2Bdw5zF6Vt5ZYHHushmnBxjZBQXs+DPfe4 nFRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=fFJgRje0; 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 m7si44449130pls.110.2019.08.05.06.26.36; Mon, 05 Aug 2019 06:26:52 -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=fFJgRje0; 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 S1731034AbfHENZ6 (ORCPT + 99 others); Mon, 5 Aug 2019 09:25:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:34474 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730776AbfHENZy (ORCPT ); Mon, 5 Aug 2019 09:25:54 -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 E9B2620644; Mon, 5 Aug 2019 13:25:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1565011554; bh=Vl6OPnb9Fexr5uG2WQcqeRCcoYoD+Utx6wUVCjijQ8Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fFJgRje0shTaJa9RKCrRFemPPPnD6X++0X23GtrOqqo78us2RNBSsWjGaj2rpjk11 7i3Tsxc5uIQoFFxTyBor0QRQEbTsRlUc5U8JIcsoyNBvrv0x9XQpVDbD5sqMlXQrT/ TCuuDDyNFnbToc0ea1SNDI95xVrH31mJvOQ38zS4= 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 5.2 106/131] s390/dasd: fix endless loop after read unit address configuration Date: Mon, 5 Aug 2019 15:03:13 +0200 Message-Id: <20190805124959.070635530@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190805124951.453337465@linuxfoundation.org> References: <20190805124951.453337465@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 @@ -383,6 +383,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; @@ -447,12 +461,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);