From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2170514AD2B; Tue, 27 May 2025 17:27:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748366840; cv=none; b=hXE/aWOoeC3yUu0ErqlArO1v/utE2Zy0c2kJekhCyEiCwTFWtz4ZtfQ327+uvC49tadS4LK1o0hdCICV35Jfb1p5cB7wtMQkceuOdOjk55vuorlGeLyrkKuTjUHJTiZ9W+dRGg65FqbCAToyuA84kzxcFW3Op2xtzTEgoVqrRlY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748366840; c=relaxed/simple; bh=uDgVQV35PpbUwzq/5rbA5tzYpqWNMnTDJeBdyvDPmww=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eYZlzwdR+6sK7BxjxrfcZmXROa5ZSYCmDH8TxjZlh6iy8ajdLyA1VmqAx4p6jH3KsW0LDUqOHSKo1fO01ptOAwaeAmIsIuRUjpcIp0PdTO/PSxEFFvk7HTS5wzDrEX6SS+fwel/E57TKlpK4vYgHoHw6+ZgoMYM813prv7oUzyM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=eqkOu2Ty; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="eqkOu2Ty" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A735C4CEEA; Tue, 27 May 2025 17:27:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1748366840; bh=uDgVQV35PpbUwzq/5rbA5tzYpqWNMnTDJeBdyvDPmww=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eqkOu2TyafX6fhRqESG6B9JYu0439c1MZeC6du2FG0WlcTteTJGMb2FqZHyHFjC3H 0OknG75aX1mUUlFiWv0pmBybRDu3MHVmLjc+MXkOR/kr6I8dNOIB+y09+GIIz0qUS4 LXBZuRozDpXwfUMeKxYIJKSSC9nIdxr+td8Vtua0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Baokun Li , Zhang Yi , Jan Kara , Theodore Tso , Sasha Levin Subject: [PATCH 6.14 194/783] ext4: reject the data_err=abort option in nojournal mode Date: Tue, 27 May 2025 18:19:51 +0200 Message-ID: <20250527162521.053940572@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250527162513.035720581@linuxfoundation.org> References: <20250527162513.035720581@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Baokun Li [ Upstream commit 26343ca0df715097065b02a6cddb4a029d5b9327 ] data_err=abort aborts the journal on I/O errors. However, this option is meaningless if journal is disabled, so it is rejected in nojournal mode to reduce unnecessary checks. Also, this option is ignored upon remount. Signed-off-by: Baokun Li Reviewed-by: Zhang Yi Reviewed-by: Jan Kara Link: https://patch.msgid.link/20250122110533.4116662-4-libaokun@huaweicloud.com Signed-off-by: Theodore Ts'o Signed-off-by: Sasha Levin --- fs/ext4/super.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/fs/ext4/super.c b/fs/ext4/super.c index b4a02be2eacf6..b956e1ee98290 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -2785,6 +2785,13 @@ static int ext4_check_opt_consistency(struct fs_context *fc, } if (is_remount) { + if (!sbi->s_journal && + ctx_test_mount_opt(ctx, EXT4_MOUNT_DATA_ERR_ABORT)) { + ext4_msg(NULL, KERN_WARNING, + "Remounting fs w/o journal so ignoring data_err option"); + ctx_clear_mount_opt(ctx, EXT4_MOUNT_DATA_ERR_ABORT); + } + if (ctx_test_mount_opt(ctx, EXT4_MOUNT_DAX_ALWAYS) && (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA)) { ext4_msg(NULL, KERN_ERR, "can't mount with " @@ -5428,6 +5435,11 @@ static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb) "data=, fs mounted w/o journal"); goto failed_mount3a; } + if (test_opt(sb, DATA_ERR_ABORT)) { + ext4_msg(sb, KERN_ERR, + "can't mount with data_err=abort, fs mounted w/o journal"); + goto failed_mount3a; + } sbi->s_def_mount_opt &= ~EXT4_MOUNT_JOURNAL_CHECKSUM; clear_opt(sb, JOURNAL_CHECKSUM); clear_opt(sb, DATA_FLAGS); -- 2.39.5