Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp639554ybz; Wed, 15 Apr 2020 15:43:19 -0700 (PDT) X-Google-Smtp-Source: APiQypLVHU4HE0FKHU26gVLClN/IPjAqjvCNZ3G5/ILFBO2CA/c4tcvxnuj+/L5iiEe74D+VjMNK X-Received: by 2002:aa7:c2d8:: with SMTP id m24mr5266626edp.342.1586990599579; Wed, 15 Apr 2020 15:43:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586990599; cv=none; d=google.com; s=arc-20160816; b=MD1jTEMs50qx2LxV8ZgvXgMBuqUFxtpsppEN8bVC4j4TpZoiqmjRTSNSx5d97mgWaz KC/0EgSiL/qQgiH+hs3h6GNaKqsb8LxBrQlRBJwYAEQ/G5bz1QKUQRb0DusrNEBjLd2t ByXFroPNPCni/S5LF6IaOZ1vaMR0P5T/FXGIpBjUCWoEYUQJDQtNf2jbpg03rq8iBDmg qFbPUMJNJEIdBZYdEVCm0+taHwNAz0dPiVzGQxVdVB1Y9xomnFFOe6cm8fo6y/bzGOCL V4e2lTR0x3akITkxG8sAXfcBhFacvFB9i1ih0yvHEoGeS7i9wanc3Zw9Zes3mvfkfmUu rQ4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=ZYbNIOnF/nS8WyVjwvcVLODkn82N/0MF4Rl2zhlofRM=; b=dWObhnQHmM1r29V4CaRYWx3EjIs5TPdZlt1uMPveVZa+lv/DFExSPoqkootW/MJLce od8XQTkrzqToag+8/KSidDYjdcgdmbAbiaN1pO40B010ReWjkaz1v88Oi1j/6NexWzY7 44bc/6vRX/I8Ux3fa1D6hCzkvQP6wDxb7JiwkuMzactks8VpWeEtHpCg+0HTimRMOn+i Au09HaGL1rXmVlQVFAexWEmHV/AGtGvv8ypTWz8Hny7SWcS/tvGbdSkrxGzR8knOs7dX c9PgNvvWfgqJ1U1Xj9zRFcok4iobxVdQ1rpLfqCU9QLVHvCoxhZBP5FFsaC/2N1I5ds/ EIbQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-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 z5si12801261edp.102.2020.04.15.15.42.55; Wed, 15 Apr 2020 15:43:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-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-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2408186AbgDOJB6 (ORCPT + 99 others); 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-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@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