Received: by 10.223.164.202 with SMTP id h10csp3698097wrb; Sat, 25 Nov 2017 14:56:08 -0800 (PST) X-Google-Smtp-Source: AGs4zMa0gQoOXeVKwMzT9updKEJiZqdYr2HKAuyczrwVRQxKb6h7bhduTr788rGYYdwi1qymGhiG X-Received: by 10.84.129.228 with SMTP id b91mr32902615plb.56.1511650568169; Sat, 25 Nov 2017 14:56:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511650568; cv=none; d=google.com; s=arc-20160816; b=x7z9wtz5FH1BXXBkzTxsbnTJMRqPUXhrYeEq52GqTgj3ppRJ6gn407fBwyOcliRjJ3 /T4NsDggNH7+8EDtBYQDJcFtrcghUA3C+R+6uPuKd3m1jH+rY0QKYdlu85JYP0jWQAwK OfSWUbaMUBw/0tR2VC0fRbYbvxxoRO2B1ONXWueg7U2V56v1ZLvLwvCmMkS6QV2JQIBE SQRdwv08gV90fw+Dt68CfQNT1Rks1RklMluF5IJIKsEQLVSFUcFzmGNB07/LeBxBOFFN GQNYz2GkkVyH7VubsQ+l8sCrldG74BfUPLL1YYKiUx3w7SSTk1mv545iLSp02n9aEA8d 0F7Q== 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 :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=/NjoOfCQFnfOzmppk6iwE7Isw637wH5RAKu02qVDSQs=; b=AelFtxwN20NC2SxID5KmMUVZp1QsTLkUiRYQe30LVUmjRKx7oxhJhyL29VvnwgvsO9 JbIIjBFtJLtLo31Fisz3V2fzNCgY0D2cFEcERBJV+QPVw/t2MkFagdHVeUpucvWJ+87Z dSkHUWqXMztc5km4meWpdRv0rowABluMKLd4t8F9VO5NkGoVy8lQo0d5dmbvp5+lEiwn R7uIo50r4d6yyiuoK4JFhkMS6Ju9YrTf4F3DOr1PDhZ0DUakhOnfyxxzwSEnae7w8ldh 5bHuYvxmzMY+ecuILKioQYV1o5/uw5I6bVTqRsRjn5lM9XgIcSalQY11gVgyL56XfNKm et1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=TdrlF1OL; 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 l63si16520256plb.82.2017.11.25.14.55.55; Sat, 25 Nov 2017 14:56:08 -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=fail header.i=@gmail.com header.s=20161025 header.b=TdrlF1OL; 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 S1751781AbdKYWzV (ORCPT + 81 others); Sat, 25 Nov 2017 17:55:21 -0500 Received: from mail-it0-f46.google.com ([209.85.214.46]:45605 "EHLO mail-it0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751210AbdKYWzT (ORCPT ); Sat, 25 Nov 2017 17:55:19 -0500 Received: by mail-it0-f46.google.com with SMTP id x13so16894547iti.4; Sat, 25 Nov 2017 14:55:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=/NjoOfCQFnfOzmppk6iwE7Isw637wH5RAKu02qVDSQs=; b=TdrlF1OLrAmgugd4tcUJVxG+007BmIWzLi4DtqryAOSeHJfWe15jVFOGIixtuRefju zsqbh2+8Rp57vIO+JraJ1ZyOpNpwjbumJS61IJMXFZruCSxYgfTlg3Zl1ld4HQqv1JhC xE9ZUoKNFZ/t9BPBwUCoI6cnfPIwJFyUk+HUNh86ZXR23ZJRVlZGX4GcfIdLbxXIc77i IJrjTthZj5c2RnLnZ2O7MVkUM5oJcWDDnvhsWbD7usP4goLpKyxkcgf1kMxFkzZRBoI+ rMs0kWTD8ECMAi0DZ3QZnKskXZmbTm+0pWROGwnHv6tBNqsbRfTh1VCwr9ZKmZH68NDz qPeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=/NjoOfCQFnfOzmppk6iwE7Isw637wH5RAKu02qVDSQs=; b=WMVVzcvGHMxrkRRFgvrT8oZDRx2FWoU55kQeAhGGPF6vJfjvl81I6pRENLCKgMHb8f pWzCNnwaK2vTJgBPvhW5lGZSPKMQGBbLwpU8/VdLja2TJYGstXOXMKHM4gw5xPijWCcy oPez00IkNqJrArzE3Yk2O8HO0Wko7ktDgLLzKp4TIVc8u1GB0WmOQfPMN0qilaoLCvuI eVPvxY2inWorFZCCyo7fGoUneG8fryYpueLSyWTHk8TUeOS2OqE8DuY3JZctiCKQDigY +Bv9Zfkfb2GPJfqmh86w8vmc8a9K98w1/wN1n9ciKfPm2rcCpvZwnVlMOmdpct+AKNgt jaKw== X-Gm-Message-State: AJaThX7Dd9tn8EBp55FtgkwEiPdKxJNrWBuX08xnhnZ0Zx+SSIBk4x6L yx+5a5qxG/eFT5BrFxlRFQmfCp6BYOTWAzNT+IsIgc4y X-Received: by 10.36.151.198 with SMTP id k189mr23160084ite.100.1511650518775; Sat, 25 Nov 2017 14:55:18 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.88.8 with HTTP; Sat, 25 Nov 2017 14:55:18 -0800 (PST) In-Reply-To: <23134.1511649343@warthog.procyon.org.uk> References: <26247.1511533324@warthog.procyon.org.uk> <23134.1511649343@warthog.procyon.org.uk> From: Linus Torvalds Date: Sat, 25 Nov 2017 12:55:18 -1000 X-Google-Sender-Auth: YuUmWp5FFMdgA_OevJGYoXaHBEE Message-ID: Subject: Re: [GIT PULL] afs: Fixes To: David Howells Cc: linux-afs@vger.kernel.org, linux-fsdevel , Linux Kernel Mailing List 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 Sat, Nov 25, 2017 at 12:35 PM, David Howells wrote: > > Doesn't clear_page_dirty_for_io() write-protect the PTE for the page to be > written out, in which case ->page_mkwrite() will get called again before the > page is redirtied? No, it literally just sets the dirty bit (and does accounting). But I think you may be right that we always write-protect he page when we move the dirty bit from the page tables to the 'struct page' (page_mkclean_one()). However, even when you do that, the page can be writable in other mappings. At least fork(), for example, only clears the dirty bit, doesn't mark it write-protected. So there is some rate-limiting of dirty pages, but I do not believe that we've ever really *serialized* writes. >> (b) can cause some really nasty latency issues > > True, but I think the most common case is a file being opened, written start > to finish and then closed. Actually, the worst-handled thing I've seen is a > shell script appending a bunch of things to a file because ->flush() syncs the > file each time it is closed:-/ > > What would you recommend instead? I'm currently trying and keep track of what > needs to be written so that I only write what's changed to the server, rather > than writing only whole pages. I don't think that what you are doing is necessarily wrong, I'm just pointing out that you may still see mmap'ed pages being modified concurrently with the actual IO, and that this will potentially mean (for example) that things like checksums won't be reliably unless you do the checksum as you copy the data to a network packet or something. Of course, if that kind of inconsistency happens, a later write-back will also happen, and eventually fix it. So the server may see temporarily 'wrong' data, but it won't be final. I just hope that the inconsistency isn't fatal to the afs client or server code. For example, if you retry writes forever when a checksum were to not match the data, that would be bad. And yes, this can be (a) really hard to trigger in practice (b) very hard to debug due to a combination of very specific timing and behavior. so I just wanted to bring this up as a potential issue, not necessarily as a big problem. Linus From 1585080059653432227@xxx Sat Nov 25 22:49:02 +0000 2017 X-GM-THRID: 1584957627109406089 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread