Re: [f2fs-dev] [PATCH] f2fs: fix quota info to adjust recovered data
From: Jaegeuk Kim
Date: Mon Sep 17 2018 - 21:19:09 EST
On 09/13, Chao Yu wrote:
> On 2018/9/13 3:54, Jaegeuk Kim wrote:
> > On 09/12, Chao Yu wrote:
> >> On 2018/9/12 9:40, 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.
> >>
> >> In v8, there are two cases we didn't guarantee quota file's consistence:
> >> 1. flush time in block_operation exceed a threshold.
> >> 2. dquot subsystem error occurs.
> >>
> >> For above case, fsck should repair the quota file by default.
> >
> > Okay, I got another failure and it seems CP_QUOTA_NEED_FSCK_FLAG was not set
> > during the recovery. So, we have something missing in the recovery in terms
> > of quota updates.
>
> Yeah, I checked the code, just found one suspected place:
>
> find_fsync_dnodes()
> - f2fs_recover_inode_page
> - inc_valid_node_count
> - dquot_reserve_block dquot info is not initialized now
> - add_fsync_inode
> - dquot_initialize
>
> I think we should reserve block for inode block after dquot_initialize(), can
> you confirm this?
Let me test this.