Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9449297pxu; Mon, 28 Dec 2020 16:59:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJw2RaHfrpIJNU7/3j5aoc/JaytwvmeorZSEtSvZ67IaFA55q7I2p0Y22NNjsm1WTnHPX+Hv X-Received: by 2002:a17:906:52c1:: with SMTP id w1mr30932477ejn.214.1609203576064; Mon, 28 Dec 2020 16:59:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609203576; cv=none; d=google.com; s=arc-20160816; b=jWjo1Qe3Mfgy1RPmweDMdusaoDBhLAyla3GyQmdrIFrKNLbl3qxMQdayPIeJnmwDRc Nd93UGyV21oPUOy77lJBPaClhgyCtK/S9Dz6nJ+2nrroWLNTPHWDtqfzsZyCHlehKHIx oMxJj2DFERysSsUsM5WItR5xS9zW5I7PEqI7//S+/QzNJROS5WGcrojB0IZbi8RKuXlY TiSzenTPOGVxSDpSpg3/BJhoTMnK4JwngVO9DUMBuvZG7Yv0vwp42+Ukx230j3YOQn/L TVI1aBhBslkqS4xF9hsy0kjHsql71TIPDK4om8ehHL9GnfI/9twG/1wRgC0l+3rbqGon ABAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=EOJRS5aZoWaCyOX97nFKGx8KYgkpvUlE0iNfEqp8P5s=; b=UFbX5ILgEaacQyALkJantGsiIiQk2vp86Y5bzdp0YxobbhENxTvH4zALvRYB5Zp1Td TCahAIXPmT0q2DCom2/hMXVBYmq2i1O3WMaoq3tkKFtsb1CtL3daqUYlnIkFXpWbEggV 5QW1TQVXqPsqEzeqSTqM2l0FbkIrtxkDeoFivyN6ZnvDNMk9ixNowlPXWe0SSTeSFCmV /FGQy1ZEJT0Cl8rqwSAJCmLtWTw0H33lVnu0P1SFeBzwTfmkqaVktFHX4BLNMRmdJvun 28SiYEH8qTD9uUxrLIUJ8aAtSHhLM3EV58s6YaNxZTdsge54fVmA0b4HI7H3zUnvamFr 1eOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=v+g6GrHg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bx8si19932087ejb.664.2020.12.28.16.59.14; Mon, 28 Dec 2020 16:59:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=v+g6GrHg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2394338AbgL1QRq (ORCPT + 99 others); Mon, 28 Dec 2020 11:17:46 -0500 Received: from mail.kernel.org ([198.145.29.99]:45214 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733276AbgL1NQz (ORCPT ); Mon, 28 Dec 2020 08:16:55 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id A417D22583; Mon, 28 Dec 2020 13:16:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609161374; bh=m3/3x9AANiyrBZ/NkeUEI3WE9L/neCAgUnormjva8/0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v+g6GrHgFSRYlO+aQmfIzcTMgn96N8UYpF09YLe91uzQAqlhrwPYPc6gHrBLeXtfI H09LJAS/FOObXwYEeL8vjhGrwz0FFXrEBw4jlOR8GTkUj4X/nZQs3HNQWHIRdvD4+H YV9nCiGlEHBbiWEKu31sfCWVXSDRGygAEpHgJ37c= 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.14 192/242] s390/dasd: prevent inconsistent LCU device data Date: Mon, 28 Dec 2020 13:49:57 +0100 Message-Id: <20201228124914.139293843@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228124904.654293249@linuxfoundation.org> References: <20201228124904.654293249@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Stefan Haberland commit a29ea01653493b94ea12bb2b89d1564a265081b6 upstream. Prevent _lcu_update from adding a device to a pavgroup if the LCU still requires an update. The data is not reliable any longer and in parallel devices might have been moved on the lists already. This might lead to list corruptions or invalid PAV grouping. Only add devices to a pavgroup if the LCU is up to date. Additional steps are taken by the scheduled lcu update. Fixes: 8e09f21574ea ("[S390] dasd: add hyper PAV support to DASD device driver, part 1") Cc: stable@vger.kernel.org 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 | 9 +++++++++ 1 file changed, 9 insertions(+) --- a/drivers/s390/block/dasd_alias.c +++ b/drivers/s390/block/dasd_alias.c @@ -503,6 +503,14 @@ static int _lcu_update(struct dasd_devic return rc; spin_lock_irqsave(&lcu->lock, flags); + /* + * there is another update needed skip the remaining handling + * the data might already be outdated + * but especially do not add the device to an LCU with pending + * update + */ + if (lcu->flags & NEED_UAC_UPDATE) + goto out; lcu->pav = NO_PAV; for (i = 0; i < MAX_DEVICES_PER_LCU; ++i) { switch (lcu->uac->unit[i].ua_type) { @@ -521,6 +529,7 @@ static int _lcu_update(struct dasd_devic alias_list) { _add_device_to_lcu(lcu, device, refdev); } +out: spin_unlock_irqrestore(&lcu->lock, flags); return 0; }