Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp13934089pxu; Mon, 4 Jan 2021 08:19:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJwT0EDb/W+BOvcF4O03KmOXU+znjlYFo4/bgYHjiC0tMRp5MmxXAGlAT+eSYdGYP82d4z+o X-Received: by 2002:a17:906:5182:: with SMTP id y2mr68649795ejk.92.1609777170474; Mon, 04 Jan 2021 08:19:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609777170; cv=none; d=google.com; s=arc-20160816; b=KkxwUM/MP4Z3AyLSzJ1p7Y+iZqal54Q0pNCvsAn61KB4FzK8gMZfSaAAEs9az75Smn wLvFILiloahFsinXeRsarf+dIK/UwqqugY82zWeiakdtPQMRk73L1y5y2ObNG74a/gbm o4V5awGbejcSw6r/1OUxSoaGGofHCgs5f8Ju62Stn1uHhxZkiQ3QKOLfZFBGSxsNP//P WeBS/FkG37oqm6k9YXM3LnwD+SoAF51Pful7uS0ttoeuR8vnPkLvV7pHzLHxH+074ZPf K+Z+/mjhRThLZhBkqUn4bGaxBMR3c9RF/oi0hgE4jkqXuANzXhqjoQtcnF2o8z1A8fwU HeuA== 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=yEozH5vby9M6CpOrUNdH312RBjAfbJ8wgXkKMagnfEQ=; b=VdGnc02Xzc90xwdFR8i5DVodcFCK7JuqPoYWki9qRZKok2Ehc8LZjoqkx5VoQ/i38U fqHrDwXMP93Ar3EcQ50fJAeYi7BKSmqRQKN4w9i/4wzSbtCRCJ1lu6G86HpKsgCnlpU4 n0DZyVBM7pCCb/UFKnChCGaMd1BXqNhXwzPVFKUaxRl9xCWtB//u6KBk3Hl/jjBxWd34 Xki2Q2H8f4/9BKtPQuWQLD5iXj2vDVwKKs/f3ts47vvyWtVKqpuGHH+nZeyfcQvaidaT 6B8q0UMqbo5cfgVkdhP8rXb5cPHdeF0thO6L9DJgk89J+sTcKot2uORe6O5Jiey2uXDP aiDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=muxQJgOT; 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 v26si30118780ejg.723.2021.01.04.08.19.06; Mon, 04 Jan 2021 08:19:30 -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=muxQJgOT; 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 S1727950AbhADP7b (ORCPT + 99 others); Mon, 4 Jan 2021 10:59:31 -0500 Received: from mail.kernel.org ([198.145.29.99]:36560 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727910AbhADP7a (ORCPT ); Mon, 4 Jan 2021 10:59:30 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1B7182250E; Mon, 4 Jan 2021 15:58:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609775908; bh=GexB/GbK1/PeJlEzVineB82tfs71ffHOwtKODHDPsU8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=muxQJgOTNbd+UZ7RVGneiRzpFeO6mnVPXyXc/95NhRye98NraSwwqU0NYr+p2gPeI 9dq+5of8Dm+dBqV7bm2AYgyeUWZ/4W6lhADzoYFjwK9Nl+dtLeWY1uDWkXToGuDBk1 6+Dxs+A6gVa7ZE+xdm+WFDbs5E9kenhKaXimgEX8= 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 4.19 07/35] ext4: dont remount read-only with errors=continue on reboot Date: Mon, 4 Jan 2021 16:57:10 +0100 Message-Id: <20210104155703.748866498@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210104155703.375788488@linuxfoundation.org> References: <20210104155703.375788488@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 ee96f504ed782..e9e9f09f5370d 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -454,19 +454,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