Return-Path: Received: from mail.linuxfoundation.org ([140.211.169.12]:42922 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751503AbdDRWqu (ORCPT ); Tue, 18 Apr 2017 18:46:50 -0400 Date: Tue, 18 Apr 2017 15:46:47 -0700 From: Andrew Morton To: Andrey Ryabinin Cc: Alexander Viro , , Konrad Rzeszutek Wilk , Eric Van Hensbergen , Ron Minnich , Latchesar Ionkov , Steve French , Matthew Wilcox , Ross Zwisler , Trond Myklebust , Anna Schumaker , Jan Kara , Jens Axboe , Johannes Weiner , Alexey Kuznetsov , Christoph Hellwig , , , , , , Subject: Re: [PATCH 1/4] fs: fix data invalidation in the cleancache during direct IO Message-Id: <20170418154647.9583bfa06705c614a2640a15@linux-foundation.org> In-Reply-To: <20170414140753.16108-2-aryabinin@virtuozzo.com> References: <20170414140753.16108-1-aryabinin@virtuozzo.com> <20170414140753.16108-2-aryabinin@virtuozzo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-nfs-owner@vger.kernel.org List-ID: On Fri, 14 Apr 2017 17:07:50 +0300 Andrey Ryabinin wrote: > Some direct write fs hooks call invalidate_inode_pages2[_range]() > conditionally iff mapping->nrpages is not zero. If page cache is empty, > buffered read following after direct IO write would get stale data from > the cleancache. > > Also it doesn't feel right to check only for ->nrpages because > invalidate_inode_pages2[_range] invalidates exceptional entries as well. > > Fix this by calling invalidate_inode_pages2[_range]() regardless of nrpages > state. I'm not understanding this. I can buy the argument about nrexceptional, but why does cleancache require the invalidate_inode_pages2_range) call even when ->nrpages is zero? I *assume* it's because invalidate_inode_pages2_range() calls cleancache_invalidate_inode(), yes? If so, can we please add this to the changelog? If not then please explain further.