From: libaokun@huaweicloud.com
To: linux-ext4@vger.kernel.org
Cc: tytso@mit.edu, adilger.kernel@dilger.ca, jack@suse.cz,
linux-kernel@vger.kernel.org, yi.zhang@huawei.com,
yangerkun@huawei.com, libaokun@huaweicloud.com,
Baokun Li <libaokun1@huawei.com>
Subject: [PATCH v2 3/8] ext4: reject the 'data_err=abort' option in nojournal mode
Date: Tue, 21 Jan 2025 15:10:45 +0800 [thread overview]
Message-ID: <20250121071050.3991249-4-libaokun@huaweicloud.com> (raw)
In-Reply-To: <20250121071050.3991249-1-libaokun@huaweicloud.com>
From: Baokun Li <libaokun1@huawei.com>
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>
---
Or maybe we should make mount and remount consistent?
Rejecting it in both would make things a lot easier.
fs/ext4/super.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index a50e5c31b937..34a7b6523f8b 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.2
next prev parent reply other threads:[~2025-01-21 7:16 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-21 7:10 [PATCH v2 0/8] ext4: fix issues caused by data write-back failures libaokun
2025-01-21 7:10 ` [PATCH v2 1/8] ext4: replace opencoded ext4_end_io_end() in ext4_put_io_end() libaokun
2025-01-21 7:10 ` [PATCH v2 2/8] ext4: do not convert the unwritten extents if data writeback fails libaokun
2025-01-21 7:10 ` libaokun [this message]
2025-01-21 11:37 ` [PATCH v2 3/8] ext4: reject the 'data_err=abort' option in nojournal mode Jan Kara
2025-01-21 12:11 ` Baokun Li
2025-01-21 7:10 ` [PATCH v2 4/8] ext4: extract ext4_check_nojournal_options() from __ext4_fill_super() libaokun
2025-01-21 11:04 ` Jan Kara
2025-01-21 11:22 ` Baokun Li
2025-01-21 7:10 ` [PATCH v2 5/8] ext4: abort journal on data writeback failure if in data_err=abort mode libaokun
2025-01-21 11:13 ` Jan Kara
2025-01-21 11:43 ` Baokun Li
2025-01-21 7:10 ` [PATCH v2 6/8] ext4: update the descriptions of data_err=abort and data_err=ignore libaokun
2025-01-21 11:14 ` Jan Kara
2025-01-21 7:10 ` [PATCH v2 7/8] ext4: remove unused member 'i_unwritten' from 'ext4_inode_info' libaokun
2025-01-21 7:10 ` [PATCH v2 8/8] ext4: pack holes in ext4_inode_info libaokun
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250121071050.3991249-4-libaokun@huaweicloud.com \
--to=libaokun@huaweicloud.com \
--cc=adilger.kernel@dilger.ca \
--cc=jack@suse.cz \
--cc=libaokun1@huawei.com \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tytso@mit.edu \
--cc=yangerkun@huawei.com \
--cc=yi.zhang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®