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 <jack@xxxxxxx> SUSE Labs, CR -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html