Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9041110pxu; Mon, 28 Dec 2020 05:11:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJymiqEQiIPlzA+15cQaXgEtN1jzlHF8N1ixNRqCcGIIhH6OwmpgmXzNQpt9JVNL7iyZb6dK X-Received: by 2002:aa7:db56:: with SMTP id n22mr42844918edt.4.1609161093652; Mon, 28 Dec 2020 05:11:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609161093; cv=none; d=google.com; s=arc-20160816; b=f1qXDtD8BemYL3Ize04I9+jBdldZ9/ULsr4hqw/+NsPt0IrYDyY6ObILrClcAsrgZR 8Bp3DxJfrxlygVMCc1cLnqTCh5lJM1maCkEN/JHC6P1hAAt3bd8f83M66VjQG0I1gf0f qvvxWe6W6PVNjG5f62EEjvRtmruPod/9UVggGhtXj0Wy3OBS/iMx7bYULZzgUxzDy3Xa BMjlaN04iOjxjcBsW9fkoXC2PiU3Z3TwJi8iW75FlFO0MEeuoZrsVWxoyfgSJ3ceCrOH QWayrRPOoRIhGlMoFuum8vCtwWh0hpinBwcKJk29nDf9JEOgw0vY+ABb4UX/DpNYLfod NRPw== 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=f3U20Mv4FT68mMmbDYuyn+JXa0OVPIdn3FpmzEhTd+w=; b=V9v5NoakmIoRpwMsfngdgLv2O0E5gVLFSc2GALPf13RnucHSgLYar2QDP+J2NPXahK PCPngCywYXQOPm44aOvM1xzMabXv6xtRGrGnLi8z9ANgxzB+n/xyhtqk0tvD6q4x7626 q/eplQrNrx2pJjCXZvKkWPvKh2JvgRhMjuHEJAs0KPW5w9DJwbBm1QbmU+9SyO2ak+0a vzDi4g4tiIJ3juU2/kvJy55T742cFQm2V1wZYo28fT6Swzi5AYjKGn0IoBzwVKyvxkic aA1uV1oS8YgTWn/tUBAyItpmWYTq9Qx1bU2MEeki4Q67hld4MDEVeFBvr0b+ZMZHlyqm PQxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SqXTPzQu; 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 l19si12534864edb.391.2020.12.28.05.11.09; Mon, 28 Dec 2020 05:11:33 -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=SqXTPzQu; 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 S1730635AbgL1NFd (ORCPT + 99 others); Mon, 28 Dec 2020 08:05:33 -0500 Received: from mail.kernel.org ([198.145.29.99]:32854 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730569AbgL1NFM (ORCPT ); Mon, 28 Dec 2020 08:05:12 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id C27CD22A84; Mon, 28 Dec 2020 13:04:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609160696; bh=M7feVJb4J5+v0RDefL6gJZZ685A7+llWtYvbk39kb8Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SqXTPzQu3J1fdYhPgr8vQgy/vHr+lp3zJUZP40ahe54G/XGBnRRkS6t+MCQ6Peg6l FuyZ/YB2Q9/1OrN/Wx3PrajiCxmdfUHd2mFhZrsHaykABKjyXzs+e4yxjQxdPg5Sk7 FhqnhW32JQc3uN0rMYjnGylrz+SqSJDbblqS9et8= 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.9 139/175] s390/dasd: prevent inconsistent LCU device data Date: Mon, 28 Dec 2020 13:49:52 +0100 Message-Id: <20201228124859.981154467@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228124853.216621466@linuxfoundation.org> References: <20201228124853.216621466@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 @@ -502,6 +502,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) { @@ -520,6 +528,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; }