From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_PASS,T_DKIMWL_WL_HIGH autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5CD66C070C3 for ; Wed, 12 Sep 2018 23:30:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E64DE21471 for ; Wed, 12 Sep 2018 23:30:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="kjCnAxKF" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E64DE21471 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726919AbeIMEhL (ORCPT ); Thu, 13 Sep 2018 00:37:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:59666 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726317AbeIMEhL (ORCPT ); Thu, 13 Sep 2018 00:37:11 -0400 Received: from [192.168.0.101] (unknown [49.77.238.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CA8472146E; Wed, 12 Sep 2018 23:30:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1536795024; bh=QkVHhtT7DVgRWClQjF0kT2oclxooPUhqrchm4Di4aUw=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=kjCnAxKFUeg5oIJbbOJWgqXpR6T7LJ8xCbKW+3G7gkAyUSaaxMzQv9vbvKvMWcf80 cX86OIDZ0tJtRy/LAsClNf3IWjAA77M1ko2njopQQN3VG4iKkNQkFR4FjuWIP6EUoS WawZuwNKj4RZSUI8rwiZpLB/OMi5MS1ANAEBhiqw= Subject: Re: [f2fs-dev] [PATCH] f2fs: fix quota info to adjust recovered data To: Jaegeuk Kim , Chao Yu Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net References: <20180911201546.56566-1-jaegeuk@kernel.org> <7aa2e6f3-a4b2-dfdd-6205-f19c4bc952e6@kernel.org> <20180912000603.GA67662@jaegeuk-macbookpro.roam.corp.google.com> <20180912002700.GA69323@jaegeuk-macbookpro.roam.corp.google.com> <650f06f4-7ca3-a3ed-d149-88d1e9f93b7a@huawei.com> <20180912012550.GA71953@jaegeuk-macbookpro.roam.corp.google.com> <20180912024601.GA75537@jaegeuk-macbookpro.roam.corp.google.com> <20180912195056.GA8356@jaegeuk-macbookpro.roam.corp.google.com> From: Chao Yu Message-ID: <7aedaa86-f898-f5c8-0d51-04fa086052d0@kernel.org> Date: Thu, 13 Sep 2018 07:30:21 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20180912195056.GA8356@jaegeuk-macbookpro.roam.corp.google.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 >>>>>>>>>> --- >>>>>>>>>> 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 >>>>>>> >>>>>>> . >>>>>>> >>>>> >>>>> . >>>>> >>> >>> . >>>