Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp120618pxa; Tue, 4 Aug 2020 00:58:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzyC+XNPRVgQgl6+IfTBhRj2+5vdSRgZEyCk2Go3dASOwIW4DyWWY9t6AVK1s37DW8+LMan X-Received: by 2002:a17:906:2e0a:: with SMTP id n10mr21106307eji.18.1596527934135; Tue, 04 Aug 2020 00:58:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596527934; cv=none; d=google.com; s=arc-20160816; b=ncSHlStCbiBb0EF7H1Lwv7ZT7ROLfYufaCPWfiSaDfhrC089hopUhcoErYY7Gnig3N RQMAMzad7v837bb08CKizI7m//Jq94+Nah9Xzfs1uk8RtI3xdOuYH9x1BGJt/MAtYx+N 3ZYzk4EpWimFR2T2B+R6hccoXlhY+bbLhPcHgIgNKJ/3CfjItZ7jNOjH3Hn9qVZSFDDD CVwCFy/qka9qSmqdU/HFAmY/ezghhUcj86WbKmQGyLUZ4qKJb9y8ABWe6MGUtbLPos9Y bO1k4svwBPCiAMPFyrJaC7+zgNvhL7SYzzGedYdcE2V+AEu+Knmn3bIwdMQtjjgMV6R2 2T+g== 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=XO/n5Ec2Am9OILtA4djHqCZ7wXOJ7xhIRmUc8vpyXAM=; b=hhzPXr9R/3EnfnEaR/pv0qS7aT91UPk1mJkkoUHJ0TBHx7To46IoytdjJQUQ380/+v AP4qQ8cxwA5M1MbYONkRbMBcMXP2Ikd8l7CDuWUDK5uudI6t2To0PZoRpIdCni8t5pWZ DyOP854LFpwT0O+vcByzF0zsbgVtZXRgtUVgMISZ3m8qb0MrSHxMLKE2BiI0XJ6hxH/N 8xDKGLCB/Qp343p8zoYA9joOm1CPQdxRDjjkZk47vaNL6UCvRckoUD/9UnS6K+kiCZJQ Rxrpe4bJgvnTFfRnQuwZnzD6r7HkGPPca8H0XVr7zWGilnFkkz9wyjNRz0IqyDRUxnM0 4ELg== 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 cw11si11928284ejb.6.2020.08.04.00.58.31; Tue, 04 Aug 2020 00:58:54 -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 S1728687AbgHDH5S (ORCPT + 99 others); Tue, 4 Aug 2020 03:57:18 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:37286 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727066AbgHDH5S (ORCPT ); Tue, 4 Aug 2020 03:57:18 -0400 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id D07BCF8FA70C7A9EB81C; Tue, 4 Aug 2020 15:57:15 +0800 (CST) Received: from [10.164.122.247] (10.164.122.247) by smtp.huawei.com (10.3.19.207) with Microsoft SMTP Server (TLS) id 14.3.487.0; Tue, 4 Aug 2020 15:57:13 +0800 Subject: Re: [f2fs-dev] [PATCH] f2fs: fix deadlock between quota writes and checkpoint To: Jaegeuk Kim CC: , , , Daeho Jeong References: <20200729070244.584518-1-jaegeuk@kernel.org> <670f35e1-872b-6602-320c-dd73bcb62510@huawei.com> <20200804035439.GA903802@google.com> From: Chao Yu Message-ID: <9a35fddd-2b67-c91e-2b1a-c63a285cd4ab@huawei.com> Date: Tue, 4 Aug 2020 15:57:13 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20200804035439.GA903802@google.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.164.122.247] 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/8/4 11:54, Jaegeuk Kim wrote: > On 08/04, Chao Yu wrote: >> On 2020/7/29 15:02, Jaegeuk Kim wrote: >>> f2fs_write_data_pages(quota_mapping) >>> __f2fs_write_data_pages f2fs_write_checkpoint >>> * blk_start_plug(&plug); >>> * add bio in write_io[DATA] >>> - block_operations >>> - skip syncing quota by >>> >DEFAULT_RETRY_QUOTA_FLUSH_COUNT >>> - down_write(&sbi->node_write); >> >> f2fs_flush_merged_writes() will be called after block_operations(), why this doesn't >> help? > > Well, I think bio can be added after f2fs_flush_merged_writes() as well. - down_read(node_write) - f2fs_do_write_data_page - f2fs_trylock_op - f2fs_outplace_write_data - f2fs_submit_page_write bio only be added under node_write lock? during f2fs_flush_merged_writes(), node_write should have been held by checkpoint() avoiding quota data writeback & bio submission. > >> >>> - f2fs_write_single_data_page >>> - f2fs_do_write_data_page >>> - f2fs_outplace_write_data >>> - do_write_page >>> - f2fs_allocate_data_block >>> - down_write(node_write) >>> - f2fs_wait_on_all_pages(F2FS_WB_CP_DATA); >>> >>> Signed-off-by: Daeho Jeong >>> Signed-off-by: Jaegeuk Kim >>> --- >>> fs/f2fs/checkpoint.c | 2 ++ >>> 1 file changed, 2 insertions(+) >>> >>> diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c >>> index 8c782d3f324f0..99c8061da55b9 100644 >>> --- a/fs/f2fs/checkpoint.c >>> +++ b/fs/f2fs/checkpoint.c >>> @@ -1269,6 +1269,8 @@ void f2fs_wait_on_all_pages(struct f2fs_sb_info *sbi, int type) >>> if (type == F2FS_DIRTY_META) >>> f2fs_sync_meta_pages(sbi, META, LONG_MAX, >>> FS_CP_META_IO); >>> + else if (type == F2FS_WB_CP_DATA) >>> + f2fs_submit_merged_write(sbi, DATA); >>> io_schedule_timeout(DEFAULT_IO_TIMEOUT); >>> } >>> finish_wait(&sbi->cp_wait, &wait); >>> > . >