Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp330289ybt; Fri, 10 Jul 2020 00:31:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzOgatzR47GxyX0XyWQ/EZLwDuyPMGfZ1U7jj9ZAq/R+nnbCuHMl/bKqYL+DqVcfplI3Hd6 X-Received: by 2002:a17:906:1102:: with SMTP id h2mr58319554eja.356.1594366318408; Fri, 10 Jul 2020 00:31:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594366318; cv=none; d=google.com; s=arc-20160816; b=vRh33qcTcjH1yAgYvupAK/3VvLuqrqShsoKveVHru+0dMIZCQBb11GAow37CHezAnt 1l4KiWCr2nWCZ2UCQyRnd8xu0eYcLHDhz9XGhgv7+66pKWlxmSZGoxdR6NN0u1bJAUkZ tTd4ijcqCTHlBrGwI2wijQYKflP1OE6v5rJVtenId9yQmsS9eS+y3kjboIEUjFPbBFDS pOsooKMyClGmtr6uih3PUPbJs4hcJcwZLnnZ4SPurTyermIPvo0o2E47Rt7n/B0Jq/gK Kqs9KB+jA+eEN+8g87E/LciwRw520hRTL2gnP+SMAWVfMyZDrkc3GF+vfOzjdk6OTYij MkDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=EWJBoxA0XEgHqWiP+l/gtDl5KNS+ET0MRzulqf8+q6s=; b=YoMVzDeFSFZ4LizT1OxbwKnnO2Va/km/wypKS68YljoTzAZ7aX6AM5oAYwDTIup3sQ Wd8sr6ehpcWeOqCpX3InUL3PSHrAO4US7yGbNeFQSxYiygWNbNyGcXIAjZQ45wgWgBva 1aVL3QGLmD3t6wADgXx0SX3wUP0ojqBLog/4NhvM+C06kQvN4IOPMrL0Q+MYfE+Qx/kQ KeOXAuwtOViOmY4dS14xVWUQfd/MPCA+STYvYofvYmcsFLbxj5V0sv4IY+RM8LAjJJhS k/wKrEt6QeLHyZbaTmPef9l4KoKc95JROckOYprGtLin91KyJ6gCY8AvdFc3YS0Tb9YO n4UA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f11si3343593ejq.283.2020.07.10.00.31.35; Fri, 10 Jul 2020 00:31:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726664AbgGJHbQ (ORCPT + 99 others); Fri, 10 Jul 2020 03:31:16 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:7832 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725851AbgGJHbP (ORCPT ); Fri, 10 Jul 2020 03:31:15 -0400 Received: from DGGEMS401-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id C4F5854D36CBD665BFCE; Fri, 10 Jul 2020 15:31:12 +0800 (CST) Received: from [10.134.22.195] (10.134.22.195) by smtp.huawei.com (10.3.19.201) with Microsoft SMTP Server (TLS) id 14.3.487.0; Fri, 10 Jul 2020 15:31:11 +0800 Subject: Re: [f2fs-dev] [PATCH] f2fs: don't skip writeback of quota data To: Jaegeuk Kim CC: , , References: <20200709053027.351974-1-jaegeuk@kernel.org> <2f4207db-57d1-5b66-f1ee-3532feba5d1f@huawei.com> <20200709190545.GA3001066@google.com> <20200710032616.GC545837@google.com> <01d0db54-eee1-f6cd-76c3-ebe59a7abae4@huawei.com> <20200710035053.GH545837@google.com> From: Chao Yu Message-ID: <77041117-f615-e6e6-591c-b02bf99e58c2@huawei.com> Date: Fri, 10 Jul 2020 15:31:10 +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: <20200710035053.GH545837@google.com> Content-Type: text/plain; charset="windows-1252" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.134.22.195] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020/7/10 11:50, Jaegeuk Kim wrote: > On 07/10, Chao Yu wrote: >> On 2020/7/10 11:26, Jaegeuk Kim wrote: >>> On 07/10, Chao Yu wrote: >>>> On 2020/7/10 3:05, Jaegeuk Kim wrote: >>>>> On 07/09, Chao Yu wrote: >>>>>> On 2020/7/9 13:30, Jaegeuk Kim wrote: >>>>>>> It doesn't need to bypass flushing quota data in background. >>>>>> >>>>>> The condition is used to flush quota data in batch to avoid random >>>>>> small-sized udpate, did you hit any problem here? >>>>> >>>>> I suspect this causes fault injection test being stuck by waiting for inode >>>>> writeback completion. With this patch, it has been running w/o any issue so far. >>>>> I keep an eye on this. >>>> >>>> Hmmm.. so that this patch may not fix the root cause, and it may hiding the >>>> issue deeper. >>>> >>>> How about just keeping this patch in our private branch to let fault injection >>>> test not be stuck? until we find the root cause in upstream codes. >>> >>> Well, I don't think this hides something. When the issue happens, I saw inodes >>> being stuck due to writeback while only quota has some dirty data. At that time, >>> there was no dirty data page from other inodes. >> >> Okay, >> >>> >>> More specifically, I suspect __writeback_inodes_sb_nr() gives WB_SYNC_NONE and >>> waits for wb_wait_for_completion(). >> >> Did you record any callstack after the issue happened? > > I found this. > > [213389.297642] __schedule+0x2dd/0x780^M > [213389.299224] schedule+0x55/0xc0^M > [213389.300745] wb_wait_for_completion+0x56/0x90^M > [213389.302469] ? wait_woken+0x80/0x80^M > [213389.303997] __writeback_inodes_sb_nr+0xa8/0xd0^M > [213389.305760] writeback_inodes_sb+0x4b/0x60^M > [213389.307439] sync_filesystem+0x2e/0xa0^M > [213389.308999] generic_shutdown_super+0x27/0x110^M > [213389.310738] kill_block_super+0x27/0x50^M > [213389.312327] kill_f2fs_super+0x76/0xe0 [f2fs]^M > [213389.314014] deactivate_locked_super+0x3b/0x80^M > [213389.315692] deactivate_super+0x3e/0x50^M > [213389.317226] cleanup_mnt+0x109/0x160^M > [213389.318718] __cleanup_mnt+0x12/0x20^M > [213389.320177] task_work_run+0x70/0xb0^M > [213389.321609] exit_to_usermode_loop+0x131/0x160^M > [213389.323306] do_syscall_64+0x170/0x1b0^M > [213389.324762] entry_SYSCALL_64_after_hwframe+0x44/0xa9^M > [213389.326477] RIP: 0033:0x7fc4b5e6a35b^M Does this only happen during umount? If so, will below change help? if ((S_ISDIR(inode->i_mode) || IS_NOQUOTA(inode)) && + !is_sbi_flag_set(sbi, SBI_IS_CLOSE) && wbc->sync_mode == WB_SYNC_NONE && get_dirty_pages(inode) < nr_pages_to_skip(sbi, DATA) && f2fs_available_free_memory(sbi, DIRTY_DENTS)) goto skip_write; > >> >> Still I'm confused that why directory's data written could be skipped, but >> quota's data couldn't, what's the difference? > > I suspect different blocking timing from cp_error between quota and dentry. > e.g., we block dir operations right after cp_error, while quota can make No guarantee that there is no dirty dentry being created after cp_error, right? e.g. Thread A Thread B - f2fs_create - bypass f2fs_cp_error - set cp_error - create dirty dentry BTW, do you know what __writeback_inodes_sb_nr is waiting for? > dirty pages in more fine granularity. > >> >>> >>>> >>>> Thanks, >>>> >>>>> >>>>> Thanks, >>>>> >>>>>> >>>>>> Thanks, >>>>>> >>>>>>> >>>>>>> Signed-off-by: Jaegeuk Kim >>>>>>> --- >>>>>>> fs/f2fs/data.c | 2 +- >>>>>>> 1 file changed, 1 insertion(+), 1 deletion(-) >>>>>>> >>>>>>> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c >>>>>>> index 44645f4f914b6..72e8b50e588c1 100644 >>>>>>> --- a/fs/f2fs/data.c >>>>>>> +++ b/fs/f2fs/data.c >>>>>>> @@ -3148,7 +3148,7 @@ static int __f2fs_write_data_pages(struct address_space *mapping, >>>>>>> if (unlikely(is_sbi_flag_set(sbi, SBI_POR_DOING))) >>>>>>> goto skip_write; >>>>>>> >>>>>>> - if ((S_ISDIR(inode->i_mode) || IS_NOQUOTA(inode)) && >>>>>>> + if (S_ISDIR(inode->i_mode) && >>>>>>> wbc->sync_mode == WB_SYNC_NONE && >>>>>>> get_dirty_pages(inode) < nr_pages_to_skip(sbi, DATA) && >>>>>>> f2fs_available_free_memory(sbi, DIRTY_DENTS)) >>>>>>> >>>>> . >>>>> >>> . >>> > . >