Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1149239imu; Wed, 9 Jan 2019 12:32:26 -0800 (PST) X-Google-Smtp-Source: ALg8bN5MMCFG/rwaa+FR8q4rKXb7jZvMSBeWAahsvJIMMvKsAeEIC0UgTM+fhgBMwUUm3ASGkjfh X-Received: by 2002:a63:ae01:: with SMTP id q1mr6607073pgf.402.1547065946541; Wed, 09 Jan 2019 12:32:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547065946; cv=none; d=google.com; s=arc-20160816; b=DRjJS0OwfvITcmlQDDFGILwMI8Zcpx8nFrEhXsUU+/YoEf8woIM+fOhI0epu0vdKEG k2UsJU1sB26ps2NOLB98kDNnilThssRwwQ2LOWzvpTIvsKSqJNgZEZ7Hj/Aq3cZxQxBk py2ht6+xnYaQmO5Wbkl6Kk3jKsRfgzGUz3XNnit5pfQyaaUwS7HlTPZ2w4IT5m+xWzcf LISVB05rvLgFeofslZeMo6Y/qbf35b5Wh6mrrFNV6smX/OVAu9K78lja/He34SVZj2vE 8cZjxq3jaVeL2z8e3cUGHfJ1t5aW9NBvBmu96PRbj42LKpSfZuqRYdvasRQvHi1nDJxj E/Tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=iYHo4BDWkQuib5zX71OSEA0OVBabwksHuuT/CZTIf4w=; b=vquWGW1voUG+KkORoxKqYC9k1pNXi4GQG+tPB1K/qkRDudv7BzwBHJReVPdBxHMrrO s6ilWtNCFZsifrCi678x0/yUvKP2W8NFYGTy22Ry6DMY+YgDyQBE5AbC953106wSU4wg krTFV0HQ7xTPWCpNgp4NW6xPtARQQkooyyccsj2Z1X+a0uktHxCpYg+Iuqgt/w6gXiZI tYACmMSTC8XzDoYEs1SDPurXGc7iA5BC/2pexQoL4FC8JXV9QwBxMPf/R9oPRKasoADp WyO1C3cFeEp5oJmM9jjkMhPfbvf+5ObydWLd6twQHWZVQbRcpZ0Cb3TahFli341ytGkn hsJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=S25Z8OJ1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j13si27710417pgi.227.2019.01.09.12.32.11; Wed, 09 Jan 2019 12:32:26 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=S25Z8OJ1; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726932AbfAIS0F (ORCPT + 99 others); Wed, 9 Jan 2019 13:26:05 -0500 Received: from mail-lj1-f195.google.com ([209.85.208.195]:45944 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726754AbfAIS0E (ORCPT ); Wed, 9 Jan 2019 13:26:04 -0500 Received: by mail-lj1-f195.google.com with SMTP id s5-v6so7315242ljd.12 for ; Wed, 09 Jan 2019 10:26:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=iYHo4BDWkQuib5zX71OSEA0OVBabwksHuuT/CZTIf4w=; b=S25Z8OJ1pX0QKsZYg/M0fXk3w3bXm7xAcOnQjDOREYBiQR8iMYf6faROB/7DN+39Fr CCHlM8Jo6MDQYsdV25OSIoh3iQT+GmLbIADo8OGLR2nu4DxhnWCrlN2q9+chgfDv5I+K CRUqm5AcGPUNJI+0aaNtaQLg9O32BM1sMYLWo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=iYHo4BDWkQuib5zX71OSEA0OVBabwksHuuT/CZTIf4w=; b=rQj6zhPULgepBJxdL54vQuWlmi2VxW1fkzUShpxzvmKt4vAqt6AHSBTqFXg7f9qmsl dUVC1ktTN2DNP52w9pfRLXk5R3m534f59skIxoPCPJJvkaoChkYSDRbb5M38uIX2xDtW NNzoESBqjl3rndsre6rVKa6U8TYfMBwhatMXqKJSvH7U24HRHISxPMlLgkOWGmm0p2G0 SZ1Hd1uW0sydK4dt0rKXHXNI9IJEFXGs2yIWHEBfZFsBDGIiOzh1rBasp0tXp+X/wzJN J2VJHqZa/aVGuLdJiGvHEm0CGhiGZahriX+jfqFSSOHDw3hyoehkA2CpViPH2N4S2X2i fMjA== X-Gm-Message-State: AJcUukdMm3GrFpyQ6gAVXufoDe2C70ou9FOibFZR3h7GCZM0O8snu59J hsZxfjMC0O3Pg7OL14CcV1ow7pzO36PDsQ== X-Received: by 2002:a2e:2246:: with SMTP id i67-v6mr3601516lji.154.1547058362048; Wed, 09 Jan 2019 10:26:02 -0800 (PST) Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com. [209.85.167.42]) by smtp.gmail.com with ESMTPSA id b20sm13607666lfj.61.2019.01.09.10.26.00 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 09 Jan 2019 10:26:00 -0800 (PST) Received: by mail-lf1-f42.google.com with SMTP id p6so6402284lfc.1 for ; Wed, 09 Jan 2019 10:26:00 -0800 (PST) X-Received: by 2002:a19:982:: with SMTP id 124mr3883924lfj.138.1547058359888; Wed, 09 Jan 2019 10:25:59 -0800 (PST) MIME-Version: 1.0 References: <20190106001138.GW6310@bombadil.infradead.org> <20190108044336.GB27534@dastard> <20190109022430.GE27534@dastard> <20190109043906.GF27534@dastard> In-Reply-To: <20190109043906.GF27534@dastard> From: Linus Torvalds Date: Wed, 9 Jan 2019 10:25:43 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] mm/mincore: allow for making sys_mincore() privileged To: Dave Chinner Cc: Jiri Kosina , Matthew Wilcox , Jann Horn , Andrew Morton , Greg KH , Peter Zijlstra , Michal Hocko , Linux-MM , kernel list , Linux API Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 8, 2019 at 8:39 PM Dave Chinner wrote: > > FWIW, I just realised that the easiest, most reliable way to > invalidate the page cache over a file range is simply to do a > O_DIRECT read on it. If that's the case, that's actually an O_DIRECT bug. It should only invalidate the caches on write. On reads, it wants to either _flush_ any direct caches before the read, or just take the data from the caches. At no point is "invalidate" a valid model. Of course, I'm not in the least bit shocked if O_DIRECT is buggy like this. But looking at least at the ext4 routine, the read just does ret = filemap_write_and_wait_range(mapping, iocb->ki_pos, and I don't see any invalidation. Having read access to a file absolutely should *not* mean that you can flush caches on it. That's a write op. Any filesystem that invalidates the caches on read is utterly buggy. Can you actually point to such a thing? Let's get that fixed, because it's completely wrong regardless of this whole mincore issue. Linus