Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp783547ybz; Wed, 15 Apr 2020 19:00:06 -0700 (PDT) X-Google-Smtp-Source: APiQypJq2J5LXWzjrdRdzDQMJJ+cqNII1RE5Wlb/BkqljE4Ola/Kc0et+1BN2CfvpaLAN4VKcLgb X-Received: by 2002:a17:906:1f55:: with SMTP id d21mr7631827ejk.320.1587002406345; Wed, 15 Apr 2020 19:00:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587002406; cv=none; d=google.com; s=arc-20160816; b=xFTs/e5rmVlJKvkzquoTLO/3toviJSwgTa/Cmi4le2f8rNqEbAnmBqcqLwD2LyfA0o tjntu6qrH87Lw7vSwFjEff163XVkMdu642eTW1ooojlv6XjJtUpK4kECtDf8lkvGEI7W wkrqPr2P0RSB9UFe9k/H97UZue+neZbc0vpc/phU/L7MkLlcveTwiEPQVplOisykjZaq dR9jWUTZBMn/aFeojSDQFjcZUIRGobWxlGeOmv8HVC0jDKWbDJ9SBw19J0s5Y6JSdyNW fL4kBETv5ThgE5MR0fp0ucCZ9C8hVS9Ds+oLWQ2hfQ0CZXdCuK5FiOgUFDTIrWkSMQAS 4h7A== 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=ssxU0xfcL6xIyVTFRzThH5oSK2v+PkuaxtWlb02wN+Y=; b=QP1z5yGp0Q7jNOBZE6ZoJybtGoc96q/YEp3+WLEcFgsRz8Ept+HJXlujKoafu/AukT 7Zbw91P8M33pgc+9AhPqk0o8QPhDdOkQHrRBmtXa4xZmYVRbLt1frTWaHkA0L5n9ggdL zsnD93Al56RI7BAqw3elS7prUvHWYOU3SWe5GX9Zt+rTyOweIymbE/3qtxSXUaOMYScT /OzhVq0osZVsezKOBFpmVtGmXiyWzsWWJnMM+6l4iwdOe6VjRkQ+u2DvT6evM288nwOC hYKcRC6Xi62UIClLXA+JhUfGqS00cr8hTvLI8W3JFJyLAEM8aAtBbUnmyEcT9winZLTN SbCQ== 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 a23si1811657edy.27.2020.04.15.18.59.43; Wed, 15 Apr 2020 19:00:06 -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 S2388327AbgDPBwy (ORCPT + 99 others); Wed, 15 Apr 2020 21:52:54 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:2334 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729270AbgDPBwt (ORCPT ); Wed, 15 Apr 2020 21:52:49 -0400 Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 5F1C1FC782B87A59B108; Thu, 16 Apr 2020 09:52:47 +0800 (CST) Received: from [127.0.0.1] (10.166.215.235) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.487.0; Thu, 16 Apr 2020 09:52:37 +0800 Subject: Re: [PATCH] dcache: unlock inode->i_lock before goto restart tag in, d_prune_aliases To: Eric Biggers CC: , , , , , , Yanxiaodan , Mingfangsen , "wubo (T)" References: <20200416014648.GB816@sol.localdomain> From: Zhiqiang Liu Message-ID: Date: Thu, 16 Apr 2020 09:52:36 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <20200416014648.GB816@sol.localdomain> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [10.166.215.235] 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/4/16 9:46, Eric Biggers wrote: > On Wed, Apr 15, 2020 at 09:20:33PM +0800, Zhiqiang Liu wrote: >> From: Zhiqiang Liu >> >> coccicheck reports: >> fs/dcache.c:1027:1-10: second lock on line 1027 >> >> In d_prune_aliases, before goto restart we should unlock >> inode->i_lock. >> >> Fixes: 29355c3904e ("d_prune_alias(): just lock the parent and call __dentry_kill()") >> Signed-off-by: Zhiqiang Liu >> Signed-off-by: Feilong Lin >> --- >> fs/dcache.c | 1 + >> 1 file changed, 1 insertion(+) >> >> diff --git a/fs/dcache.c b/fs/dcache.c >> index b280e07e162b..1532ebe9d9ca 100644 >> --- a/fs/dcache.c >> +++ b/fs/dcache.c >> @@ -1030,6 +1030,7 @@ void d_prune_aliases(struct inode *inode) >> if (!dentry->d_lockref.count) { >> struct dentry *parent = lock_parent(dentry); >> if (likely(!dentry->d_lockref.count)) { >> + spin_unlock(&inode->i_lock); >> __dentry_kill(dentry); >> dput(parent); >> goto restart; >> -- > > Doesn't __dentry_kill() already do the unlock, via dentry_unlink_inode()? > > - Eric > Yes, you are right. Sorry for that. Please ignore this patch. > . >