From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kara Subject: Re: invalidate the buffer heads of a block device Date: Tue, 30 Sep 2014 12:48:45 +0200 Message-ID: <20140930104845.GA31117@quack.suse.cz> References: <2368A3FCF9F7214298E53C823B0A48EC0420B08E@AMSPEX01CL02.citrite.net> <20140929181115.GG6328@quack.suse.cz> <2368A3FCF9F7214298E53C823B0A48EC0420B711@AMSPEX01CL02.citrite.net> <20140930091902.GA26216@quack.suse.cz> <2368A3FCF9F7214298E53C823B0A48EC0420B8AF@AMSPEX01CL02.citrite.net> <20140930095510.GC26216@quack.suse.cz> <2368A3FCF9F7214298E53C823B0A48EC0420B983@AMSPEX01CL02.citrite.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: 'Jan Kara' , "linux-fsdevel@vger.kernel.org" , Ross Lagerwall , Felipe Franciosi To: Thanos Makatos Return-path: Received: from cantor2.suse.de ([195.135.220.15]:55886 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750782AbaI3Kss (ORCPT ); Tue, 30 Sep 2014 06:48:48 -0400 Content-Disposition: inline In-Reply-To: <2368A3FCF9F7214298E53C823B0A48EC0420B983@AMSPEX01CL02.citrite.net> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Tue 30-09-14 10:11:32, Thanos Makatos wrote: > > Yes, "unknown" process can read data back into pagecache while your ioctl > > is running thus undoing your work. But if the writes are already visible on the > > *device* at the moment you run the ioctl, then "unknown" process will just > > fetch new data and everything is fine... If you need to evict page cache > > *before* new data is visible on the device, then you need to suspend the > > device first so that it doesn't serve any IO, then evict page cache, then make > > new data visible on the device, and finally resume the device. > > Suspend/resume of the device can be handled by device mapper (it does > > these tricks when you are changing topology of the device on the fly). > > The writes will be visible to the device *before* the ioctl runs so I > have one thing less to worry about! > > Regarding extending the ioctl to invalidate the page cache, do you have > any suggestions where I could start looking? You just need to call invalidate_inode_pages2(). That is going to do all you need. > Would such a new ioctl have any chance to be accepted upstream? I believe a possibility for a file to be fully flushed from page cache is useful at times and if you present well your usecase there are reasonable chances it will get accepted upstream. Honza -- Jan Kara SUSE Labs, CR