From: Chao Yu <chao@kernel.org>
To: Jaegeuk Kim <jaegeuk@kernel.org>, Chao Yu <yuchao0@huawei.com>
Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH] f2fs: fix quota info to adjust recovered data
Date: Thu, 13 Sep 2018 07:30:21 +0800 [thread overview]
Message-ID: <7aedaa86-f898-f5c8-0d51-04fa086052d0@kernel.org> (raw)
In-Reply-To: <20180912195056.GA8356@jaegeuk-macbookpro.roam.corp.google.com>
On 2018/9/13 3:50, Jaegeuk Kim wrote:
> On 09/12, Chao Yu wrote:
>> On 2018/9/12 10:46, Jaegeuk Kim wrote:
>>> On 09/12, Chao Yu wrote:
>>>> On 2018/9/12 9:25, Jaegeuk Kim wrote:
>>>>> On 09/12, Chao Yu wrote:
>>>>>> On 2018/9/12 8:27, Jaegeuk Kim wrote:
>>>>>>> On 09/11, Jaegeuk Kim wrote:
>>>>>>>> On 09/12, Chao Yu wrote:
>>>>>>>>> On 2018/9/12 4:15, Jaegeuk Kim wrote:
>>>>>>>>>> fsck.f2fs is able to recover the quota structure, since roll-forward recovery
>>>>>>>>>> can recover it based on previous user information.
>>>>>>>>>
>>>>>>>>> I didn't get it, both fsck and kernel recover quota file based all inodes'
>>>>>>>>> uid/gid/prjid, if {x}id didn't change, wouldn't those two recovery result be the
>>>>>>>>> same?
>>>>>>>>
>>>>>>>> I thought that, but had to add this, since I was encountering quota errors right
>>>>>>>> after getting some files recovered. And, I thought it'd make it more safe to do
>>>>>>>> fsck after roll-forward recovery.
>>>>>>>>
>>>>>>>> Anyway, let me test again without this patch for a while.
>>>>>>>
>>>>>>> Hmm, I just got a fsck failure right after some files recovered.
>>>>>>
>>>>>> To make sure, do you test with "f2fs: guarantee journalled quota data by
>>>>>> checkpoint"? if not, I think there is no guarantee that f2fs can recover
>>>>>> quote info into correct quote file, because, in last checkpoint, quota file
>>>>>> may was corrupted/inconsistent. Right?
>>>>
>>>> Oh, I forget to mention that, I add a patch to fsck to let it noticing
>>>> CP_QUOTA_NEED_FSCK_FLAG flag, and by default, fsck will fix corrupted quote
>>>> file if the flag is set, but w/o this flag, quota file is still corrupted
>>>> detected by fsck, I guess there is bug in v8.
>>>>
>>>> Can you add that in fsck too? so we can separate real kernel bug and quota
>>>> file corruption due to dquot subsystem error caused like below case:
>>>
>>> I'm testing to trigger fsck when it sees the below flag. But, when considering
>>> old f2fs-tools, we may need a way to detect mkfs version in superblock in order
>>
>> Oh, that will make kernel be complicated... kernel should be aware of user
>> space things... if user use old tools and new kernel, how about just let
>> kernel give warning on dmesg to user to upgrade f2fs tool set.
>>
>> And also, even if w/o CP_FSCK_FLAG, fsck can also detect such quote file
>> corruption, then do repair, right?
>
> It requires scanning the directory tree, which doesn't make sense.
Yeah, that's right.
Thanks,
>
>>
>> Thanks,
>>
>>> to determine whether we can rely on this new flag or not.
>>>
>>>>
>>>> +static int f2fs_dquot_acquire(struct dquot *dquot)
>>>> +{
>>>> + int ret;
>>>> +
>>>> + ret = dquot_acquire(dquot);
>>>> + if (ret == -ENOSPC || ret == -EIO)
>>>> + set_sbi_flag(F2FS_SB(dquot->dq_sb), SBI_QUOTA_NEED_REPAIR);
>>>> + return ret;
>>>> +}
>>>>
>>>>>
>>>>> I hit the failure with v8. And, the test scenario is 1) enable fault injection
>>>>> 2) run fsstress, 3) call shutdowon, 4) kill fsstress, 5) unmount, 6) fsck, 7)
>>>>> mount, 8) fsck, 9) go 1).
>>>>>
>>>>> So, I'm hitting failure in 8) fsck. I expect 6) fsck should fix any corruption
>>>>> and 7) recovered some files on clean checkpoint.
>>>>
>>>> I see, I can add this case too, does this exist in your xfstest tree in github?
>>>
>>> I think so.
>>>
>>>>
>>>> Thanks,
>>>>
>>>>>
>>>>> Thanks,
>>>>>
>>>>>>
>>>>>> Thanks,
>>>>>>
>>>>>>>
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>>
>>>>>>>>
>>>>>>>>>
>>>>>>>>> Thanks,
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
>>>>>>>>>> ---
>>>>>>>>>> fs/f2fs/recovery.c | 3 +++
>>>>>>>>>> 1 file changed, 3 insertions(+)
>>>>>>>>>>
>>>>>>>>>> diff --git a/fs/f2fs/recovery.c b/fs/f2fs/recovery.c
>>>>>>>>>> index 95511ed11a22..1fde86a2107e 100644
>>>>>>>>>> --- a/fs/f2fs/recovery.c
>>>>>>>>>> +++ b/fs/f2fs/recovery.c
>>>>>>>>>> @@ -675,6 +675,9 @@ int f2fs_recover_fsync_data(struct f2fs_sb_info *sbi, bool check_only)
>>>>>>>>>>
>>>>>>>>>> need_writecp = true;
>>>>>>>>>>
>>>>>>>>>> + /* quota is not fully updated due to the lack of user information. */
>>>>>>>>>> + set_sbi_flag(sbi, SBI_NEED_FSCK);
>>>>>>>>>> +
>>>>>>>>>> /* step #2: recover data */
>>>>>>>>>> err = recover_data(sbi, &inode_list, &dir_list);
>>>>>>>>>> if (!err)
>>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> Linux-f2fs-devel mailing list
>>>>>>>> Linux-f2fs-devel@lists.sourceforge.net
>>>>>>>> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
>>>>>>>
>>>>>>> .
>>>>>>>
>>>>>
>>>>> .
>>>>>
>>>
>>> .
>>>
prev parent reply other threads:[~2018-09-12 23:30 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-11 20:15 [PATCH] f2fs: fix quota info to adjust recovered data Jaegeuk Kim
2018-09-11 23:51 ` [f2fs-dev] " Chao Yu
2018-09-12 0:06 ` Jaegeuk Kim
2018-09-12 0:27 ` Jaegeuk Kim
2018-09-12 1:13 ` Chao Yu
2018-09-12 1:25 ` Jaegeuk Kim
2018-09-12 1:40 ` Chao Yu
2018-09-12 1:46 ` Chao Yu
2018-09-12 19:54 ` Jaegeuk Kim
2018-09-12 23:28 ` Chao Yu
2018-09-18 1:19 ` Jaegeuk Kim
2018-09-18 1:38 ` Chao Yu
2018-09-18 2:05 ` Jaegeuk Kim
2018-09-18 10:13 ` Chao Yu
2018-09-18 16:45 ` Jaegeuk Kim
2018-09-19 1:38 ` Chao Yu
2018-09-19 22:38 ` Jaegeuk Kim
2018-09-20 9:46 ` Chao Yu
2018-09-20 21:42 ` Jaegeuk Kim
2018-09-21 7:48 ` Chao Yu
2018-09-26 0:29 ` Jaegeuk Kim
2018-09-26 1:21 ` Chao Yu
2018-09-26 1:44 ` Jaegeuk Kim
2018-09-26 2:06 ` Chao Yu
2018-09-26 2:09 ` Jaegeuk Kim
2018-09-26 2:14 ` Chao Yu
2018-09-27 1:16 ` Chao Yu
2018-09-28 17:37 ` Jaegeuk Kim
2018-09-28 23:40 ` Jaegeuk Kim
2018-09-29 10:38 ` Chao Yu
2018-09-30 23:58 ` Jaegeuk Kim
2018-10-01 0:35 ` Chao Yu
2018-10-01 1:27 ` Jaegeuk Kim
2018-10-01 1:37 ` Chao Yu
2018-09-12 2:46 ` Jaegeuk Kim
2018-09-12 2:57 ` Chao Yu
2018-09-12 19:50 ` Jaegeuk Kim
2018-09-12 23:30 ` Chao Yu [this message]
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=7aedaa86-f898-f5c8-0d51-04fa086052d0@kernel.org \
--to=chao@kernel.org \
--cc=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=yuchao0@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;
as well as URLs for NNTP newsgroup(s).