Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp13932764pxu; Mon, 4 Jan 2021 08:17:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJwjRZWzKAmh6MnsI0V8yesFpAZGEf53l54bwzsMbQz3X5Unu9E1CPN/WG4eRSMTUX19x2sZ X-Received: by 2002:a17:906:890:: with SMTP id n16mr67515105eje.463.1609777049145; Mon, 04 Jan 2021 08:17:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609777049; cv=none; d=google.com; s=arc-20160816; b=QzTnitORyYdNbUtw70EGe2IWOGFgI0v4PasLA26M6+y2Px+axtzsF4cN7c3MT1Jtqy EzLbTgqSqHd8ePnNJhaovSkw5xLJYvZepjJy/x///5d0znuBYNhGOFoHpG4Szknqq20/ n7mOwRAuJ+GrM8Rjtfg9rEb4gzbLPJJwXj+a1fXig/z/Kp8ZJL5nmbRg9W0LB4dxIdG3 WU3T4wtBnrkBbr3gQwwWrzxw1xLHKZhbq2792MOXg/y51JwSSPs6Y5VnBYZKxUnQIJUD CLPvw6zTr5q9xEyAnPnORQdBsY7kl+HI99HX3jjCowrlv7/VUVaDp/thEOstw+acprbh CcWg== 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=ALKcVB1I6zKc0lkkz585OQtAv5tOgiUhYwT3eeUXQjw=; b=TvXcyMdv34WrFFVU8mYXO88/uUKaDmeobJISWyKkvpeJlOWj8huCEVzInEoAYJXlQS nefe+Ngy+nUTe5B5/u1tq7+iKM4YTW8t0UhiKRG4WSTM+nLdo8GQMUTBKZJFCRM12Z7e 7TMSMGfk+KhVx70zeyNmtW9ZixaThwjAmRc/V52SM+cz30blaXt7PTD7o2eLCXDwdsKf ENoNNLEe2DoXr1jhqhUKomnC83N7zGzlTCshkV+grHyfLp1vPAMo1KmZRa3IOI6nSxbq 6Z3O1hetd4ZhKY1OqMMnOT0YfRs/8aeTsvBV0vtLF94q2rhNrytjKOUDA6+o+dv1el8K eNvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=tkO5yBGO; 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 h17si31866876eds.404.2021.01.04.08.17.06; Mon, 04 Jan 2021 08:17:29 -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=tkO5yBGO; 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 S1728209AbhADQAG (ORCPT + 99 others); Mon, 4 Jan 2021 11:00:06 -0500 Received: from mail.kernel.org ([198.145.29.99]:36550 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728154AbhADQAA (ORCPT ); Mon, 4 Jan 2021 11:00:00 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id CAFD4224D2; Mon, 4 Jan 2021 15:59:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609775968; bh=IoUTC2FqG8W9J9G5cgeLZDO+KDQz0TDFTuK2GSLsKqw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tkO5yBGO6N+rVERFI5oExpWibcpz72mY8pYLxS0LMikcpGPxu8jopGKGvKONu5GEO 4Sem9T7Rse7iJGE0XK9f4EcpPwtr1w7GnTfutAzh25jOa2GcoSq3mriFmsEvCOO8sY /2n63tVVr8KIUnN/lQ29k0aZxqWVSSYxHlEx/FIU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jan Kara , Andreas Dilger , stable@kernel.org, Theodore Tso , Sasha Levin Subject: [PATCH 5.4 11/47] ext4: dont remount read-only with errors=continue on reboot Date: Mon, 4 Jan 2021 16:57:10 +0100 Message-Id: <20210104155706.299546196@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210104155705.740576914@linuxfoundation.org> References: <20210104155705.740576914@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: Jan Kara [ Upstream commit b08070eca9e247f60ab39d79b2c25d274750441f ] ext4_handle_error() with errors=continue mount option can accidentally remount the filesystem read-only when the system is rebooting. Fix that. Fixes: 1dc1097ff60e ("ext4: avoid panic during forced reboot") Signed-off-by: Jan Kara Reviewed-by: Andreas Dilger Cc: stable@kernel.org Link: https://lore.kernel.org/r/20201127113405.26867-2-jack@suse.cz Signed-off-by: Theodore Ts'o Signed-off-by: Sasha Levin --- fs/ext4/super.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 920658ca8777d..06568467b0c27 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -455,19 +455,17 @@ static bool system_going_down(void) static void ext4_handle_error(struct super_block *sb) { + journal_t *journal = EXT4_SB(sb)->s_journal; + if (test_opt(sb, WARN_ON_ERROR)) WARN_ON_ONCE(1); - if (sb_rdonly(sb)) + if (sb_rdonly(sb) || test_opt(sb, ERRORS_CONT)) return; - if (!test_opt(sb, ERRORS_CONT)) { - journal_t *journal = EXT4_SB(sb)->s_journal; - - EXT4_SB(sb)->s_mount_flags |= EXT4_MF_FS_ABORTED; - if (journal) - jbd2_journal_abort(journal, -EIO); - } + EXT4_SB(sb)->s_mount_flags |= EXT4_MF_FS_ABORTED; + if (journal) + jbd2_journal_abort(journal, -EIO); /* * We force ERRORS_RO behavior when system is rebooting. Otherwise we * could panic during 'reboot -f' as the underlying device got already -- 2.27.0