Received: by 2002:a05:7412:d008:b0:f9:6acb:47ec with SMTP id bd8csp41082rdb; Tue, 19 Dec 2023 08:51:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IGStwy0r1jEckBXJLdN/kg/pbiF8ktopF1uH2vrEfolsXqfIg6p+QMKqURxuCJCwpHo034S X-Received: by 2002:ac8:7f08:0:b0:425:4054:bc5e with SMTP id f8-20020ac87f08000000b004254054bc5emr1881784qtk.58.1703004704995; Tue, 19 Dec 2023 08:51:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703004704; cv=none; d=google.com; s=arc-20160816; b=LTtfzru8SbtBJUo8JkaORxZsYHD2CZ3JnzEHVt5+OkMp3SToqWOXSsOOcs+l4utTPp l7+lhGwmcVjmur/jC7O7U3vqFsLHom1n8jj+GXRxu3PPP96Aaorsk5LLdl8qSMyUwp0m 7F7dlyBlG+d4psR0KvKQM3wB4LcmGA4kECOvFS6S+TFyXOwp/aD4hlJmFS7wVzfiGjEC CpldYap4m9BDbt5bdTxYcPzJxxz7gErnvB80eXE7xaBHkTUon9kuRSjTU7dT0pznqYnw sqMbd/TesFxdtaLkFMqybMPMe1IKZulApA1iBuS0e0/9ki1rcjxXX8TcFicFtX2Q8ss9 YJfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:content-transfer-encoding:content-id:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:subject:cc:to :references:in-reply-to:from:organization:dkim-signature; bh=w5Xe1M0Gz0LaWjI/lQS6+uzcaH3a3lGFMV4s4r+jDpI=; fh=oTSheoojIQWE85h15wIbFV5tdQ792s9VwZPsELvSY7c=; b=aE//FLuwbnmtbznDrvktXpUCU8FO8FVBL0aAuBvr9ZVb0UbRRPPYvisMg9pK0Rflt2 S+d1ScxqByG5t0wiT5OcW0hW1AYteF+xomMAAGMR0bBvWrKvEMcOHU7mo1qNb9COoWBK cnggxSmhUdvn+zKi4+q/49K50FnamtEQ6g76G1cAP+6ZtkP3pnhIGCPea6JM4pu1QlLQ SxbivtPTRsacwTiKTXN499Z9rpmo5d6aDNkTx4GjocckFpT9KlopWMHwD/gV9OuOO6IR zvDr3DX+lFI9/VvVdUWyxsruHxCe5ya0nQAehDC7WjqFUOWcclELcV9B5KxuM2/8RMhP 9JRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=MPMEWXOr; spf=pass (google.com: domain of linux-nfs+bounces-710-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-nfs+bounces-710-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d4-20020a05622a100400b0042771688f03si2210108qte.213.2023.12.19.08.51.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 08:51:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs+bounces-710-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=MPMEWXOr; spf=pass (google.com: domain of linux-nfs+bounces-710-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-nfs+bounces-710-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id BA1271C24997 for ; Tue, 19 Dec 2023 16:51:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DA39920B1B; Tue, 19 Dec 2023 16:51:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="MPMEWXOr" X-Original-To: linux-nfs@vger.kernel.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8329D20DE0 for ; Tue, 19 Dec 2023 16:51:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1703004694; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=w5Xe1M0Gz0LaWjI/lQS6+uzcaH3a3lGFMV4s4r+jDpI=; b=MPMEWXOrq3Qf0xMRkSpgpydM4GEqPmebi4ymHnKJweYdrvz2xueqONpfXiZe4ts17Lao29 x5lPQKn5jjD7gShrHu3qpHGuHt6GtZaD5UNpKUH1vtp9dDFl4KZidrZgWWMSpax6JKZ0/0 KXJpcr6i35TWNVyKTo/eD5R2d46+njs= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-538-SZhKt4N1MPKXfQGXxUAb8Q-1; Tue, 19 Dec 2023 11:51:31 -0500 X-MC-Unique: SZhKt4N1MPKXfQGXxUAb8Q-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 544C185A589; Tue, 19 Dec 2023 16:51:30 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.39.195.169]) by smtp.corp.redhat.com (Postfix) with ESMTP id 745142166B31; Tue, 19 Dec 2023 16:51:27 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: References: <20231213152350.431591-1-dhowells@redhat.com> <20231213152350.431591-37-dhowells@redhat.com> To: Jeff Layton Cc: dhowells@redhat.com, Steve French , Matthew Wilcox , Marc Dionne , Paulo Alcantara , Shyam Prasad N , Tom Talpey , Dominique Martinet , Eric Van Hensbergen , Ilya Dryomov , Christian Brauner , linux-cachefs@redhat.com, linux-afs@lists.infradead.org, linux-cifs@vger.kernel.org, linux-nfs@vger.kernel.org, ceph-devel@vger.kernel.org, v9fs@lists.linux.dev, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 36/39] netfs: Implement a write-through caching option Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1075259.1703004686.1@warthog.procyon.org.uk> Content-Transfer-Encoding: quoted-printable Date: Tue, 19 Dec 2023 16:51:26 +0000 Message-ID: <1075260.1703004686@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.6 Jeff Layton wrote: > > This can't be used with content encryption as that may require expansi= on of > > the write RPC beyond the write being made. > > = > > This doesn't affect writes via mmap - those are written back in the no= rmal > > way; similarly failed writethrough writes are marked dirty and left to > > writeback to retry. Another option would be to simply invalidate them= , but > > the contents can be simultaneously accessed by read() and through mmap= . > > = > = > I do wish Linux were less of a mess in this regard. Different > filesystems behave differently when writeback fails. Cifs is particularly, um, entertaining in this regard as it allows the wri= te to fail on the server due to a checksum failure if the source data changes during the write and then just retries it later. > That said, the modern consensus with local filesystems is to just leave > the pages clean when buffered writeback fails, but set a writeback error > on the inode. That at least keeps dirty pages from stacking up in the > cache. In the case of something like a netfs, we usually invalidate the > inode and the pages -- netfs's usually have to spontaneously deal with > that anyway, so we might as well. > = > Marking the pages dirty here should mean that they'll effectively get a > second try at writeback, which is a change in behavior from most > filesystems. I'm not sure it's a bad one, but writeback can take a long > time if you have a laggy network. I'm not sure what the best thing to do is. If everything is doing O_DSYNC/writethrough I/O on an inode and there is no mmap, then invalidati= ng the pages is probably not a bad way to deal with failure here. > When a write has already failed once, why do you think it'll succeed on > a second attempt (and probably with page-aligned I/O, I guess)? See above with cifs. I wonder if the pages being written to should be mad= e RO and page_mkwrite() forced to lock against DSYNC writethrough. > Another question: when the writeback is (re)attempted, will it end up > just doing page-aligned I/O, or is the byte range still going to be > limited to the written range? At the moment, it then happens exactly as it would if it wasn't doing writethrough - so it will write partial folios if it's doing a streaming w= rite and will do full folios otherwise. > The more I consider it, I think it might be a lot simpler to just "fail > fast" here rather than remarking the write dirty. You may be right - but, again, mmap:-/ David