Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp3219154ybc; Mon, 25 Nov 2019 10:50:54 -0800 (PST) X-Google-Smtp-Source: APXvYqwb7/TR1/NDbHyudpH4gGEETZFbaXbuMmcs9GZtqJ0d7/fwTZpPlxw59/z8kGy55ALWPzCQ X-Received: by 2002:a05:6402:6cf:: with SMTP id n15mr20242668edy.269.1574707854620; Mon, 25 Nov 2019 10:50:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574707854; cv=none; d=google.com; s=arc-20160816; b=bFMeL6G5t+4JbcesYD13uOaRUc8olPKufgQlELEJupZyQcHSyz1pe8zrINlXx/uFCl iRnU10TTq2yf7JZ2JIjSQNZNBojwPhUSEGB0MPquxRrwOD21aU61xOrMgMZO2WKrXbBX NLuBeJw56NQCVg88hdNIFIAUkBmYF19lJjGeTm2HGsXvIpqAdtu9g3x4XAxG0KOE0pV1 UZ69Q4154hxX/RXcVZza1K+MLQ7/t0qcQwtB/FU1hBguP+NjwuZbnsrFFpmN1ltLX79+ fhm6jh7sAhUe19Jq1d4utbyqbEzvHqryW8+MXfuVojKb+CmG5MSYYbaKZn1grckNLh+g Njfg== 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=IP1wfK3f8gL3K5of14NSdEE7VLJRLmDh9Mjfd6jLIUg=; b=gk9S/HTylMoYiyFOPEAOLF7EWl7avViRfzPVkHyAxhEx6QJ4TpGcwr6fESEMXe8tVN aIU1Xawa5FgxidIn/zjlodAEKdeFvl5qh4dgdLPIOJYQGALAY2bTU0CugdYytY632xgT iuqO92eBlIdakMMIK1E7ZKMHVzEaHJJgoBDLa+nHX7SFC/Rah8k4o9/bONsjLJbZm80H Un4nz4OOWDEHxkuTwI4jjWan69mOILmj1xOqKd5cIxAoSV2o0oWqKkGTuOmTRQdQpFtm ze64b08wItKA83UK8EpQBfsPm4G8CZ/MGChdwaKvyzB1inG3P14BsU9b0ebK27BHPk3o 4Dcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=di9eo39C; 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 f26si5416427ejc.255.2019.11.25.10.50.30; Mon, 25 Nov 2019 10:50:54 -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=di9eo39C; 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 S1729124AbfKYRFv (ORCPT + 99 others); Mon, 25 Nov 2019 12:05:51 -0500 Received: from mail-lj1-f194.google.com ([209.85.208.194]:38952 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729073AbfKYRFu (ORCPT ); Mon, 25 Nov 2019 12:05:50 -0500 Received: by mail-lj1-f194.google.com with SMTP id e10so7611222ljj.6 for ; Mon, 25 Nov 2019 09:05:48 -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=IP1wfK3f8gL3K5of14NSdEE7VLJRLmDh9Mjfd6jLIUg=; b=di9eo39CEUbDhJQGDGRbvoBzSIsf4IsJ2vpQB30wyKTQ4oZuoI8I8FAMQktMgORFFP 8fBVLWpCUhdrhl0hj+dykFizgaSzPbdXAW3q2epeOP6k+UZ1g4c/aPYroPhY+MX/X+vS wBXrAbq1U0ohLCJc7HXm2ySYQ4bv4evW0kCik= 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=IP1wfK3f8gL3K5of14NSdEE7VLJRLmDh9Mjfd6jLIUg=; b=risU7y1eb1kfQUTJ76OeyuXzMGXZGOXrNQSu+gvt5VcUEUVFEs42oZyNrYC8BllSUT M0aEO0BIt8mgSFscbpUkUwg4GIWknXU416vqkZ91c0td1ZFgCOfWD2i1AeGdJFVTEHVm 1brQBjyx6CxS9bQ+m/3kSjQmHkaV/5vZL7WGzi5asBP5Y8IXbIl6ofYViucDJkERwOtz wOzoGrFJDt52yT+06SbgYRsoQvWurVcRGTSn1vTroKZcMyWKVttQWKAwrM9XGzwpeR58 h+i4FiYdMXDj3o1SxDMk522m7Waoip6cRb7Vp8/PSCO+StUZ+iHeEXk9FWDCnJElwPkN uROQ== X-Gm-Message-State: APjAAAUXxgLlrQJ8ENOfkzi+i0ncRa6dl7uoWgUn1JK86UpUy/Fp0tVJ JM33yOm81D7WRSO9J09TWD468glPuT8= X-Received: by 2002:a05:651c:326:: with SMTP id b6mr23031746ljp.119.1574701547666; Mon, 25 Nov 2019 09:05:47 -0800 (PST) Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com. [209.85.167.52]) by smtp.gmail.com with ESMTPSA id u12sm4362194lje.1.2019.11.25.09.05.45 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 25 Nov 2019 09:05:46 -0800 (PST) Received: by mail-lf1-f52.google.com with SMTP id 203so11595584lfa.12 for ; Mon, 25 Nov 2019 09:05:45 -0800 (PST) X-Received: by 2002:ac2:5a08:: with SMTP id q8mr21390671lfn.106.1574701545622; Mon, 25 Nov 2019 09:05:45 -0800 (PST) MIME-Version: 1.0 References: <157225677483.3442.4227193290486305330.stgit@buzz> <20191028124222.ld6u3dhhujfqcn7w@box> <20191028125702.xdfbs7rqhm3wer5t@box> <640bbe51-706b-8d9f-4abc-5f184de6a701@redhat.com> <22f04f02-86e4-b379-81c8-08c002a648f0@redhat.com> In-Reply-To: <22f04f02-86e4-b379-81c8-08c002a648f0@redhat.com> From: Linus Torvalds Date: Mon, 25 Nov 2019 09:05:29 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] mm/filemap: do not allocate cache pages beyond end of file at read To: Steven Whitehouse Cc: =?UTF-8?Q?Andreas_Gr=C3=BCnbacher?= , Konstantin Khlebnikov , "Kirill A. Shutemov" , Linux-MM , Andrew Morton , Linux Kernel Mailing List , linux-fsdevel , Alexander Viro , Johannes Weiner , "cluster-devel@redhat.com" , Ronnie Sahlberg , Steve French , Andreas Gruenbacher , Bob Peterson 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 Mon, Nov 25, 2019 at 2:53 AM Steven Whitehouse wrote: > > Linus, is that roughly what you were thinking of? So the concept looks ok, but I don't really like the new flags as they seem to be gfs2-specific rather than generic. That said, I don't _gate_ them either, since they aren't in any critical code sequence, and it's not like they do anything really odd. I still think the whole gfs2 approach is broken. You're magically ok with using stale data from the cache just because it's cached, even if another client might have truncated the file or something. So you're ok with saying "the file used to be X bytes in size, so we'll just give you this data because we trust that the X is correct". But you're not ok to say "oh, the file used to be X bytes in size, but we don't want to give you a short read because it might not be correct any more". See the disconnect? You trust the size in one situation, but not in another one. I also don't really see that you *need* the new flag at all. Since you're doing to do a speculative read and then a real read anyway, and since the only thing that you seem to care about is the file size (because the *data* you will trust if it is cached), then why don't you just use the *existing* generic read, and *IFF* you get a truncated return value, then you go and double-check that the file hasn't changed in size? See what I'm saying? I think gfs2 is being very inconsistent in when it trusts the file size, and I don't see that you even need the new behavior that patch gives, because you might as well just use the existing code (just move the i_size check earlier, and then teach gfs2 to double-check the "I didn't get as much as I expected" case). Linus