Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp559465pxb; Thu, 21 Oct 2021 05:12:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxsDXz1i6FPwCnR1fjVlnHdVfKYDaZmSf9Ye9hRjp/ZUYjflmGgWHan1tyDZLv9+BtpLXTG X-Received: by 2002:a17:902:6b4a:b0:13f:8e99:2149 with SMTP id g10-20020a1709026b4a00b0013f8e992149mr4900730plt.87.1634818360623; Thu, 21 Oct 2021 05:12:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634818360; cv=none; d=google.com; s=arc-20160816; b=p6cc+KY9qcHnqJQwSM3m1fz4oftGfmoFQ5k31SW3BKuVg8VRtXIk11OvjOkXawUdGP BI3pxg4dSAUcDRXI0bYNmE3hd2k+QQMSnd4pJ2nlzIMwPMjMEb2vMyny4mNnxsDzDz8u haSGRnDHbPjvv/URMrrMETryv3DDlhKMm37VN+miuAfaZWZpXs+BGtdTRwMDCMFqP8LG nOyK5PMHurocmZGqnVLzrS6ACTFcatVJIdbBLBM2VtAB1KGyF9tBUbMabtdf39Cju/NO 7uhfgmdNrKRedXcI0DZ193+Q9N8EvpEkr3Jf2Jfn1ehkxQWhowwyJ2/pyu2qyZ9rER0O yv7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=vzVQZQKzpdK8ZR3je0cae6yd0V3n/oczkXObWLZEL10=; b=mE8hYFhKD89RqX5QIMH9ZTmtzf/2hXizjT5X/iPgvTyKPtK6w/XOCHm7X761WVpDSr fl/9DOCinDEU7Cfo0ZndEARMx9lzcxrCw2XGyGr24qfOHaHwJPAZIuEfML01ilAKdy/p 26ghbFbj4NHySvVqt6Iib4BG/87E2KucrgNfholzN3Mf4/BTwclj4zc/WWG4QE3ojYDQ lK9xf7GKGMbhx+pZfBql8lJgGxNuFdLxoZet5Ieg6Bn8+MvjG6mwQ5ECaLfhcY8ni3A+ K4tDCmUjea3QURaxeRiVAqgbrFpEKvCAOQCYSPCP0MOSr0fH8U+UD39V4Ryix0DZ3gEN h0vg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=heKUUSPI; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y2si5819656pji.77.2021.10.21.05.12.26; Thu, 21 Oct 2021 05:12:40 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=heKUUSPI; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230391AbhJUMNk (ORCPT + 99 others); Thu, 21 Oct 2021 08:13:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:56122 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229765AbhJUMNj (ORCPT ); Thu, 21 Oct 2021 08:13:39 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id BA95D6120C; Thu, 21 Oct 2021 12:11:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1634818284; bh=l6RlEt0NEP+wUUaiwunsNXw+CERWuWBXIp8i5TT1qUs=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=heKUUSPIqGR8MdLQKSk32+oNXXHyTM5L0UO/E4WKrptRN3zaROJS5aY1SDlt7V14h HNH1+t4Hv9S8Nof+xJtQUmhKICWZ2yANGNI6CDI86RxrxnZMmNCnLWN3mLMMPphXsX 916vECaeqmliZjpbu05MOq4xAZMtsSmmGL1Li6c7LaxOHA+zW9RLpSCvDRsL51fzYw BvAOELBGozQND8uxb2IhG18Fc6JjYuhMD4beAr0rrpPGzSYkiiq9uxlqinG5HWnaSK KMwTUPcEcdQpQG5dVZ2LsQgZ9MtTR9xD5K+OxYDtP8gpYcKZ6Hh3+GsqbOumSLRoLs JdDI5Ar3sggHg== Message-ID: Date: Thu, 21 Oct 2021 20:11:20 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 Subject: Re: [f2fs-dev] [PATCH] f2fs: remove circular locking between sb_internal and fs_reclaim Content-Language: en-US To: Daeho Jeong , linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, kernel-team@android.com Cc: Daeho Jeong References: <20211014190503.717830-1-daeho43@gmail.com> From: Chao Yu In-Reply-To: <20211014190503.717830-1-daeho43@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021/10/15 3:05, Daeho Jeong wrote: > From: Daeho Jeong > > We detected the below circular locking dependency between sb_internal > and fs_reclaim. So, removed it by calling dquot_initialize() before > sb_start_intwrite(). > > ====================================================== > WARNING: possible circular locking dependency detected > ------------------------------------------------------ > kswapd0/133 is trying to acquire lock: > ffffff80d5fb9680 (sb_internal#2){.+.+}-{0:0}, at: evict+0xd4/0x2f8 > > but task is already holding lock: > ffffffda597c93a8 (fs_reclaim){+.+.}-{0:0}, at: > __fs_reclaim_acquire+0x4/0x50 > > which lock already depends on the new lock. > ... > other info that might help us debug this: > > Chain exists of: > > sb_internal#2 --> &s->s_dquot.dqio_sem --> fs_reclaim > > Possible unsafe locking scenario: > > CPU0 CPU1 > ---- ---- > lock(fs_reclaim); > lock(&s->s_dquot.dqio_sem); > lock(fs_reclaim); > lock(sb_internal#2); Sorry, I still didn't get the root cause of this deadlock issue, could you please explain more about this? And why calling dquot_initialize() in drop_inode() could break the circular locking dependency? Thanks, > > Signed-off-by: Daeho Jeong > --- > fs/f2fs/super.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c > index 86eeb019cc52..a133932333c5 100644 > --- a/fs/f2fs/super.c > +++ b/fs/f2fs/super.c > @@ -1370,6 +1370,8 @@ static int f2fs_drop_inode(struct inode *inode) > /* should remain fi->extent_tree for writepage */ > f2fs_destroy_extent_node(inode); > > + dquot_initialize(inode); > + > sb_start_intwrite(inode->i_sb); > f2fs_i_size_write(inode, 0); > >