Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9104772pxu; Mon, 28 Dec 2020 06:45:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJzYpP5xe+0QtiXPzSfHu3+7AyRat0zAwtWKJyf0IKKU/pIFQgKD4UdCiOcU0SJo6PRl9j8p X-Received: by 2002:a17:906:a011:: with SMTP id p17mr41269743ejy.30.1609166727251; Mon, 28 Dec 2020 06:45:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609166727; cv=none; d=google.com; s=arc-20160816; b=WenTGgqtrZQzW1rate9ev8BorewVRVGOJweQAGD4M5icR3aokD1FEFvyPvoNez871L YIdrirNm/rrhIUS6fqr1cxoXxbQzEhKW7Agb+Ru6IqKAYIsBnAMPPedTda6PT4Df9RzN qCicbCPZTBCldUTiFk5sKzEqzHX7bC7GrbmQzSG+UUtXOk5huW0hiIDRFXYafIRsUrz0 rnlNJTexC/vldosHAuTuVwWMaj0Fcp3SyI+X4zC/O9ZNA3e3VSjXW0v2X/Ob9WgiTHiq hqBIL19987QkoPqbtWhIhc7UOUNBOMybDq9gJHNNHk+VDUO1y+a1HSVHvAq19O4KjsK0 n9UA== 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=E+hb11gVFJc5+i0LPIsl8tazS7liUqw7yIvHi6SOd/U=; b=hPtmXZOuICNyyhlSYXLTjaqxCHwbmTfBebaiGEdxKmxWWWoi+lD5cb4et3pWx8yKpY Bf/JoQ8xDKw77qeQO2b4cPwkR43cb5uWj0gIl47v8wE4l4wEIBjlfEGqp5wcQCncPVkB 1Fy+Z6Gi53yh+pqjKNLWxmjHw1atNvLCPjgdYBHMaGo57Y+J9cs7qb9711ehx14b66R0 NIUxZtrhNw8Eku2kPbq7KWfd6lZKETNWXJ6W42qWGojB1haykXZnPxYLXIY3RPcESjsI lNA109o/KSyNMhzl3p3Jk7dHNJd/vXul/kLrNC7erbMdOOdGs0Fy0ZbZtbTc4xBIpSUT 1dZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Su/OYkt0"; 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 fy14si18550174ejb.227.2020.12.28.06.45.04; Mon, 28 Dec 2020 06:45:27 -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="Su/OYkt0"; 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 S2502583AbgL1O15 (ORCPT + 99 others); Mon, 28 Dec 2020 09:27:57 -0500 Received: from mail.kernel.org ([198.145.29.99]:35378 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2502308AbgL1O1b (ORCPT ); Mon, 28 Dec 2020 09:27:31 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id A752222AEC; Mon, 28 Dec 2020 14:26:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609165611; bh=9AZ72TUaEtN1g9J+gej0QigPOa+ue3PhmJuS5YWN/vY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Su/OYkt0J2Q43hTalk48wxxN7MaxDgAFhjXWYpIV+fBux8kXdOKSVvImNQyCI/CDz Z+1ujltsFxjG6n5Ly1XTT7pnAQ1CY4eU7CtwIvz49v+ztsjpBFI8NdyVuSnM4L4mWS DdXvWFAGv8vQw3rG2FZwUmTd0sR7q/daQE1FtBns= 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 Subject: [PATCH 5.10 593/717] ext4: dont remount read-only with errors=continue on reboot Date: Mon, 28 Dec 2020 13:49:51 +0100 Message-Id: <20201228125049.321922927@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@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 commit b08070eca9e247f60ab39d79b2c25d274750441f upstream. 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: Greg Kroah-Hartman --- fs/ext4/super.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -666,19 +666,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_set_mount_flag(sb, EXT4_MF_FS_ABORTED); - if (journal) - jbd2_journal_abort(journal, -EIO); - } + ext4_set_mount_flag(sb, 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