Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp423723pxa; Fri, 21 Aug 2020 10:42:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx1wxFjRAvZdxybVl5JJ1mCbRf8Mrv0Mok5DWdsWcqDry9isqxdz++NtCyqgjlMkB1aeW9R X-Received: by 2002:a50:ee0a:: with SMTP id g10mr3689884eds.289.1598031729479; Fri, 21 Aug 2020 10:42:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598031729; cv=none; d=google.com; s=arc-20160816; b=AWfTS0YRrfV0K6V1sFET9CCotJamwSLnrh4cVNFcwbF1PLw9GoCBghZssRzoRHlQ8w F77jMBA5L3OpHpli9Jp4NVZw2X3DZmI9yNTHv51bOMSvqNUE24IVuiReB0MZ2Ks66Bi9 xYSa6Waf37GhrbjWXYUh7lQQwxaOIUx8lI5iu9LraZsQY1j2/a+dN8BxRM048Lua60d3 yR7FbTUSPEFJ1srtOxlHFxVkEJUhC61NKXGFEZE4hX1sPlXgsqzL4aTd/5+YueYkO2Pv MFKJY0ThLKuvJjuAgCGJFc1/lukJsEVdLLkxlbLptv+q+8XYqG7Va/wM4bjxNx+05uq3 OOzA== 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:ironport-sdr:ironport-sdr; bh=w96SraDzfmOaqmWhENtY0OYVLzqj8EeeUnvbMpIt950=; b=GeeameOjg0Hrxc9lP4yDLQWrzIG3lB4SMDLOOZVy4X8LqfBc1vEzecYsp5ikDAmKZw KO6DWSAd+WfDAHpIOY1RSTv1DL5bgXnVfFclEBVa9bm08AxblFF+zO2Jg7dn9gkj8f3R kZ+2DSZw5xS+lDhx2ZnMCO6QGfygQkGE7sioJ5w3bTHiDFlcG0b0blHmMTq3Aw2b6PMX b8/LYQqKxNu9siJ6Sh92goW1EWVhALQxuXhBX6Lovw6LPh6ay5DjBw5QijnF2cIqWZz3 JOka2L04ErPw8E9Zj/1PriMJC43DTlGlWTXvaIvRiBiyI0KR+4aMvJEVAATYLyt74dbw XjwA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p3si1671511edr.352.2020.08.21.10.41.46; Fri, 21 Aug 2020 10:42:09 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727875AbgHURkq (ORCPT + 99 others); Fri, 21 Aug 2020 13:40:46 -0400 Received: from mga03.intel.com ([134.134.136.65]:59643 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726864AbgHURko (ORCPT ); Fri, 21 Aug 2020 13:40:44 -0400 IronPort-SDR: vKsYkXIRI/Msm3XfA1lpSSFhJpf+SvU2HF95vsK1G57tK80c1gcMkMhUHI+rdS3OqeGkGrN7Jn P5tvpLB4nCrQ== X-IronPort-AV: E=McAfee;i="6000,8403,9720"; a="155578918" X-IronPort-AV: E=Sophos;i="5.76,338,1592895600"; d="scan'208";a="155578918" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Aug 2020 10:40:41 -0700 IronPort-SDR: BfK+1av7mzeYf3wx3u4NXslDuTo1SpMAF+P1dA7jFE9gU5U9v79MCdvXhyl7In84C1bc3R1SyV m5esAyFO0A5g== X-IronPort-AV: E=Sophos;i="5.76,338,1592895600"; d="scan'208";a="321333466" Received: from iweiny-desk2.sc.intel.com (HELO localhost) ([10.3.52.147]) by fmsmga004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Aug 2020 10:40:41 -0700 Date: Fri, 21 Aug 2020 10:40:41 -0700 From: Ira Weiny To: Hao Li Cc: viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, y-goto@fujitsu.com Subject: Re: [PATCH] fs: Kill DCACHE_DONTCACHE dentry even if DCACHE_REFERENCED is set Message-ID: <20200821174040.GG3142014@iweiny-DESK2.sc.intel.com> References: <20200821015953.22956-1-lihao2018.fnst@cn.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200821015953.22956-1-lihao2018.fnst@cn.fujitsu.com> User-Agent: Mutt/1.11.1 (2018-12-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 21, 2020 at 09:59:53AM +0800, Hao Li wrote: > Currently, DCACHE_REFERENCED prevents the dentry with DCACHE_DONTCACHE > set from being killed, so the corresponding inode can't be evicted. If > the DAX policy of an inode is changed, we can't make policy changing > take effects unless dropping caches manually. > > This patch fixes this problem and flushes the inode to disk to prepare > for evicting it. This looks intriguing and I really hope this helps but I don't think this will guarantee that the state changes immediately will it? Do you have a test case which fails before and passes after? Perhaps one of the new xfstests submitted by Xiao? Ira > > Signed-off-by: Hao Li > --- > fs/dcache.c | 3 ++- > fs/inode.c | 2 +- > 2 files changed, 3 insertions(+), 2 deletions(-) > > diff --git a/fs/dcache.c b/fs/dcache.c > index ea0485861d93..486c7409dc82 100644 > --- a/fs/dcache.c > +++ b/fs/dcache.c > @@ -796,7 +796,8 @@ static inline bool fast_dput(struct dentry *dentry) > */ > smp_rmb(); > d_flags = READ_ONCE(dentry->d_flags); > - d_flags &= DCACHE_REFERENCED | DCACHE_LRU_LIST | DCACHE_DISCONNECTED; > + d_flags &= DCACHE_REFERENCED | DCACHE_LRU_LIST | DCACHE_DISCONNECTED > + | DCACHE_DONTCACHE; > > /* Nothing to do? Dropping the reference was all we needed? */ > if (d_flags == (DCACHE_REFERENCED | DCACHE_LRU_LIST) && !d_unhashed(dentry)) > diff --git a/fs/inode.c b/fs/inode.c > index 72c4c347afb7..5218a8aebd7f 100644 > --- a/fs/inode.c > +++ b/fs/inode.c > @@ -1632,7 +1632,7 @@ static void iput_final(struct inode *inode) > } > > state = inode->i_state; > - if (!drop) { > + if (!drop || (drop && (inode->i_state & I_DONTCACHE))) { > WRITE_ONCE(inode->i_state, state | I_WILL_FREE); > spin_unlock(&inode->i_lock); > > -- > 2.28.0 > > >