From: Chao Yu <chao@kernel.org>
To: Eric Sandeen <sandeen@redhat.com>,
linux-f2fs-devel@lists.sourceforge.net
Cc: chao@kernel.org, linux-fsdevel@vger.kernel.org,
jaegeuk@kernel.org, lihongbo22@huawei.com
Subject: Re: [PATCH V3 7/7] f2fs: switch to the new mount api
Date: Mon, 12 May 2025 11:43:39 +0800 [thread overview]
Message-ID: <74704f7c-135e-4614-b805-404da6195930@kernel.org> (raw)
In-Reply-To: <763bed71-1f44-4622-a9a0-d200f0418183@redhat.com>
On 5/8/25 23:59, Eric Sandeen wrote:
> On 5/8/25 4:19 AM, Chao Yu wrote:
>>> @@ -2645,21 +2603,11 @@ static int f2fs_remount(struct super_block *sb, int *flags, char *data)
>>>
>>> default_options(sbi, true);
>>>
>>> - memset(&fc, 0, sizeof(fc));
>>> - memset(&ctx, 0, sizeof(ctx));
>>> - fc.fs_private = &ctx;
>>> - fc.purpose = FS_CONTEXT_FOR_RECONFIGURE;
>>> -
>>> - /* parse mount options */
>>> - err = parse_options(&fc, data);
>>> - if (err)
>>> - goto restore_opts;
>> There is a retry flow during f2fs_fill_super(), I intenionally inject a
>> fault into f2fs_fill_super() to trigger the retry flow, it turns out that
>> mount option may be missed w/ below testcase:
>
> I never did understand that retry logic (introduced in ed2e621a95d long
> ago). What errors does it expect to be able to retry, with success?
IIRC, it will retry mount if there is recovery failure due to inconsistent
metadata.
>
> Anyway ...
>
> Can you show me (as a patch) exactly what you did to trigger the retry,
> just so we are looking at the same thing?
You can try this?
---
fs/f2fs/super.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 0ee783224953..10f0e66059f8 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -5066,6 +5066,12 @@ static int f2fs_fill_super(struct super_block *sb, struct fs_context *fc)
goto reset_checkpoint;
}
+ if (retry_cnt) {
+ err = -EIO;
+ skip_recovery = true;
+ goto free_meta;
+ }
+
/* recover fsynced data */
if (!test_opt(sbi, DISABLE_ROLL_FORWARD) &&
!test_opt(sbi, NORECOVERY)) {
--
2.49.0
Thanks,
>
>> - mkfs.f2fs -f -O encrypt /dev/vdb
>> - mount -o test_dummy_encryption /dev/vdb /mnt/f2fs/
>> : return success
>> - dmesg -c
>>
>> [ 83.619982] f2fs_fill_super, retry_cnt:1
>> [ 83.620914] F2FS-fs (vdb): Test dummy encryption mode enabled
>> [ 83.668380] f2fs_fill_super, retry_cnt:0
>> [ 83.671601] F2FS-fs (vdb): Mounted with checkpoint version = 7a8dfca5
>>
>> - mount|grep f2fs
>> /dev/vdb on /mnt/f2fs type f2fs (rw,relatime,lazytime,background_gc=on,nogc_merge,
>> discard,discard_unit=block,user_xattr,inline_xattr,acl,inline_data,inline_dentry,
>> flush_merge,barrier,extent_cache,mode=adaptive,active_logs=6,alloc_mode=reuse,
>> checkpoint_merge,fsync_mode=posix,memory=normal,errors=continue)
>>
>> The reason may be it has cleared F2FS_CTX_INFO(ctx).dummy_enc_policy in
>> f2fs_apply_test_dummy_encryption().
>>
>> static void f2fs_apply_test_dummy_encryption(struct fs_context *fc,
>> struct super_block *sb)
>> {
>> struct f2fs_fs_context *ctx = fc->fs_private;
>> struct f2fs_sb_info *sbi = F2FS_SB(sb);
>>
>> if (!fscrypt_is_dummy_policy_set(&F2FS_CTX_INFO(ctx).dummy_enc_policy) ||
>> /* if already set, it was already verified to be the same */
>> fscrypt_is_dummy_policy_set(&F2FS_OPTION(sbi).dummy_enc_policy))
>> return;
>> F2FS_OPTION(sbi).dummy_enc_policy = F2FS_CTX_INFO(ctx).dummy_enc_policy;
>> memset(&F2FS_CTX_INFO(ctx).dummy_enc_policy, 0,
>> sizeof(F2FS_CTX_INFO(ctx).dummy_enc_policy));
>> f2fs_warn(sbi, "Test dummy encryption mode enabled");
>> }
>>
>> Can we save old mount_info from sbi or ctx from fc, and try to recover it
>> before we retry mount flow?
>
> I'll have to take more time to understand this concern. But thanks for pointing
> it out.
>
> -Eric
>
>> Thanks,
>
next prev parent reply other threads:[~2025-05-12 3:43 UTC|newest]
Thread overview: 58+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-23 17:08 [PATCH V3 0/7] f2fs: new mount API conversion Eric Sandeen
2025-04-23 17:08 ` [PATCH V3 1/7] f2fs: Add fs parameter specifications for mount options Eric Sandeen
2025-05-08 2:40 ` Hongbo Li
2025-05-08 5:24 ` Chao Yu
2025-07-11 16:30 ` [f2fs-dev] " patchwork-bot+f2fs
2025-04-23 17:08 ` [PATCH V3 2/7] f2fs: move the option parser into handle_mount_opt Eric Sandeen
2025-05-06 20:24 ` Jaegeuk Kim
2025-05-08 5:30 ` Chao Yu
2025-04-23 17:08 ` [PATCH V3 3/7] f2fs: Allow sbi to be NULL in f2fs_printk Eric Sandeen
2025-05-08 5:30 ` Chao Yu
2025-04-23 17:08 ` [PATCH V3 4/7] f2fs: Add f2fs_fs_context to record the mount options Eric Sandeen
2025-05-08 6:34 ` Chao Yu
2025-04-23 17:08 ` [PATCH V3 5/7] f2fs: separate the options parsing and options checking Eric Sandeen
2025-05-06 22:01 ` Jaegeuk Kim
2025-05-06 22:52 ` Eric Sandeen
2025-05-06 23:30 ` Jaegeuk Kim
2025-05-08 8:13 ` Chao Yu
2025-05-08 15:52 ` Eric Sandeen
2025-05-12 3:32 ` Chao Yu
2025-05-14 1:10 ` Hongbo Li
2025-05-14 1:03 ` Hongbo Li
2025-05-13 2:15 ` Jaegeuk Kim
2025-04-23 17:08 ` [PATCH V3 6/7] f2fs: introduce fs_context_operation structure Eric Sandeen
2025-05-08 8:14 ` Chao Yu
2025-04-23 17:08 ` [PATCH V3 7/7] f2fs: switch to the new mount api Eric Sandeen
2025-05-08 9:19 ` Chao Yu
2025-05-08 15:59 ` Eric Sandeen
2025-05-12 3:43 ` Chao Yu [this message]
2025-05-13 2:19 ` Eric Sandeen
2025-05-13 2:48 ` Chao Yu
2025-05-13 15:36 ` Jaegeuk Kim
2025-05-13 8:59 ` Chao Yu
2025-05-14 2:33 ` Hongbo Li
2025-05-14 4:03 ` Chao Yu
2025-05-14 6:15 ` Hongbo Li
2025-05-14 15:30 ` Jaegeuk Kim
2025-05-14 15:46 ` Eric Sandeen
2025-05-15 1:17 ` Hongbo Li
2025-05-16 2:01 ` Hongbo Li
2025-05-16 17:35 ` Jaegeuk Kim
2025-05-19 2:38 ` Hongbo Li
2025-05-13 16:11 ` Jaegeuk Kim
2025-05-06 2:18 ` [PATCH V3 0/7] f2fs: new mount API conversion Eric Sandeen
2025-05-06 16:02 ` Jaegeuk Kim
2025-05-06 22:53 ` Eric Sandeen
2025-05-06 23:55 ` Ian Kent
2025-05-07 0:35 ` Jaegeuk Kim
2025-05-07 0:51 ` Eric Sandeen
2025-05-07 1:23 ` Jaegeuk Kim
2025-05-07 2:56 ` Eric Sandeen
2025-05-07 3:45 ` Eric Sandeen
2025-05-07 14:46 ` Jaegeuk Kim
2025-05-07 17:11 ` Eric Sandeen
2025-05-07 19:48 ` Jaegeuk Kim
2025-05-07 20:19 ` Eric Sandeen
2025-05-07 20:28 ` Jaegeuk Kim
2025-05-07 20:46 ` Eric Sandeen
2025-05-07 21:36 ` Jaegeuk Kim
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=74704f7c-135e-4614-b805-404da6195930@kernel.org \
--to=chao@kernel.org \
--cc=jaegeuk@kernel.org \
--cc=lihongbo22@huawei.com \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-fsdevel@vger.kernel.org \
--cc=sandeen@redhat.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;
as well as URLs for NNTP newsgroup(s).