summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorBaokun Li <libaokun1@huawei.com>2025-01-22 19:05:27 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-06-04 14:41:59 +0200
commitd7f3c874ea7079a49509f2a60938f84f6bb161b9 (patch)
tree0efa8d585b66f26b6a264a0fb01ba77a60493a07 /fs
parentbaf667f23f609ba66bd4060445ce15c4cb100ee4 (diff)
downloadlinux-d7f3c874ea7079a49509f2a60938f84f6bb161b9.tar.gz
linux-d7f3c874ea7079a49509f2a60938f84f6bb161b9.tar.bz2
linux-d7f3c874ea7079a49509f2a60938f84f6bb161b9.zip
ext4: reject the 'data_err=abort' option in nojournal mode
[ 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 <libaokun1@huawei.com> Reviewed-by: Zhang Yi <yi.zhang@huawei.com> Reviewed-by: Jan Kara <jack@suse.cz> Link: https://patch.msgid.link/20250122110533.4116662-4-libaokun@huaweicloud.com Signed-off-by: Theodore Ts'o <tytso@mit.edu> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/ext4/super.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 3dcaf06ada36..d2b58f940aab 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -2821,6 +2821,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 "
@@ -5421,6 +5428,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);