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=-8.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS 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 CEC78C433ED for ; Thu, 15 Apr 2021 16:51:01 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 715AB611AB for ; Thu, 15 Apr 2021 16:51:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 715AB611AB Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=zeniv.linux.org.uk Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id E20946B006C; Thu, 15 Apr 2021 12:51:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DCFCB6B0070; Thu, 15 Apr 2021 12:51:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C71CD6B0071; Thu, 15 Apr 2021 12:51:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0148.hostedemail.com [216.40.44.148]) by kanga.kvack.org (Postfix) with ESMTP id A6AFD6B006C for ; Thu, 15 Apr 2021 12:51:00 -0400 (EDT) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 5C35E362C for ; Thu, 15 Apr 2021 16:51:00 +0000 (UTC) X-FDA: 78035191080.14.31D3E69 Received: from zeniv-ca.linux.org.uk (zeniv-ca.linux.org.uk [142.44.231.140]) by imf21.hostedemail.com (Postfix) with ESMTP id 8AC8EE00011A for ; Thu, 15 Apr 2021 16:50:56 +0000 (UTC) Received: from viro by zeniv-ca.linux.org.uk with local (Exim 4.94 #2 (Red Hat Linux)) id 1lX5Ci-005Y53-1S; Thu, 15 Apr 2021 16:50:56 +0000 Date: Thu, 15 Apr 2021 16:50:56 +0000 From: Al Viro To: Gautham Ananthakrishna Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, matthew.wilcox@oracle.com, khlebnikov@yandex-team.ru Subject: Re: [PATCH RFC 1/6] dcache: sweep cached negative dentries to the end of list of siblings Message-ID: References: <1611235185-1685-1-git-send-email-gautham.ananthakrishna@oracle.com> <1611235185-1685-2-git-send-email-gautham.ananthakrishna@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 8AC8EE00011A X-Stat-Signature: ib6y4p5or35sfttod81utk9f8h6i64aa Received-SPF: none (ftp.linux.org.uk>: No applicable sender policy available) receiver=imf21; identity=mailfrom; envelope-from=""; helo=zeniv-ca.linux.org.uk; client-ip=142.44.231.140 X-HE-DKIM-Result: none/none X-HE-Tag: 1618505456-901551 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed, Apr 14, 2021 at 03:00:48AM +0000, Al Viro wrote: > Ugh... So when dput() drives the refcount down to 0 you hit lock_parent() > and only then bother to check if the sucker had been negative in the first ^^^^^^^^^^^^^^^^^ had zero refcount, of course. > place? > > @@ -1970,6 +2021,8 @@ void d_instantiate(struct dentry *entry, struct inode * inode) > > { > > BUG_ON(!hlist_unhashed(&entry->d_u.d_alias)); > > if (inode) { > > + if (d_is_tail_negative(entry)) > > + recycle_negative(entry); > > security_d_instantiate(entry, inode); > > spin_lock(&inode->i_lock); > > __d_instantiate(entry, inode); > > Wait a bloody minute. What about d_instantiate_new() right next to it? Another fun question: where's the proof that __d_add(dentry, non_NULL_inode) won't happen to dentry marked tail-negative? From a quick grep I see at least one such place - on success cifs_do_create() does d_drop(direntry); d_add(direntry, newinode); and it would bloody well evade what you are doing in d_instantiate(). Same seems to be true for nfs_link()...