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.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 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 23E9CC2BA19 for ; Wed, 15 Apr 2020 09:01:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 030C720775 for ; Wed, 15 Apr 2020 09:01:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405268AbgDOJB6 (ORCPT ); Wed, 15 Apr 2020 05:01:58 -0400 Received: from mx2.suse.de ([195.135.220.15]:53082 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405260AbgDOJB4 (ORCPT ); Wed, 15 Apr 2020 05:01:56 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 60116AF92; Wed, 15 Apr 2020 09:01:53 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 6A4291E1250; Wed, 15 Apr 2020 11:01:53 +0200 (CEST) Date: Wed, 15 Apr 2020 11:01:53 +0200 From: Jan Kara To: ira.weiny@intel.com Cc: linux-kernel@vger.kernel.org, "Darrick J. Wong" , Jan Kara , Dan Williams , Dave Chinner , Christoph Hellwig , "Theodore Y. Ts'o" , Jeff Moyer , linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org Subject: Re: [PATCH V8 09/11] fs: Introduce DCACHE_DONTCACHE Message-ID: <20200415090153.GF501@quack2.suse.cz> References: <20200415064523.2244712-1-ira.weiny@intel.com> <20200415064523.2244712-10-ira.weiny@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200415064523.2244712-10-ira.weiny@intel.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-xfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-xfs@vger.kernel.org On Tue 14-04-20 23:45:21, ira.weiny@intel.com wrote: > From: Ira Weiny > > DCACHE_DONTCACHE indicates a dentry should not be cached on final > dput(). > > Also add a helper function which will flag I_DONTCACHE as well ad > DCACHE_DONTCACHE on all dentries point to a specified inode. I think this sentence needs more work :). Like: Also add a helper function which will mark the inode with I_DONTCACHE flag and also mark all dentries pointing to a specified inode as DCACHE_DONTCACHE. > > Signed-off-by: Ira Weiny > > --- > Changes from V7: > new patch > --- > fs/dcache.c | 4 ++++ > fs/inode.c | 15 +++++++++++++++ > include/linux/dcache.h | 2 ++ > include/linux/fs.h | 1 + > 4 files changed, 22 insertions(+) ... > diff --git a/fs/inode.c b/fs/inode.c > index 93d9252a00ab..b8b1917a324e 100644 > --- a/fs/inode.c > +++ b/fs/inode.c > @@ -1526,6 +1526,21 @@ int generic_delete_inode(struct inode *inode) > } > EXPORT_SYMBOL(generic_delete_inode); > > +void flag_inode_dontcache(struct inode *inode) mark_inode_dontcache? > +{ > + struct dentry *dent; This is really nitpicking but dentry variables are usually called 'de' or 'dentry' :) > + > + rcu_read_lock(); I don't think this list is safe to traverse under RCU. E.g. dentry_unlink_inode() does hlist_del_init(&dentry->d_u.d_alias). Usually, we traverse this list under inode->i_lock protection AFAICS. Honza > + hlist_for_each_entry(dent, &inode->i_dentry, d_u.d_alias) { > + spin_lock(&dent->d_lock); > + dent->d_flags |= DCACHE_DONTCACHE; > + spin_unlock(&dent->d_lock); > + } > + rcu_read_unlock(); > + inode->i_state |= I_DONTCACHE; > +} > +EXPORT_SYMBOL(flag_inode_dontcache); > + > /* > * Called when we're dropping the last reference > * to an inode. -- Jan Kara SUSE Labs, CR