Message ID | 563286.1724500613@warthog.procyon.org.uk (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id D59CFC52D6F for <linux-mm@archiver.kernel.org>; Sat, 24 Aug 2024 11:57:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B2881800E4; Sat, 24 Aug 2024 07:57:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AB160800D4; Sat, 24 Aug 2024 07:57:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9523D800E4; Sat, 24 Aug 2024 07:57:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 6D5B3800D4 for <linux-mm@kvack.org>; Sat, 24 Aug 2024 07:57:12 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id C21A8A7756 for <linux-mm@kvack.org>; Sat, 24 Aug 2024 11:57:11 +0000 (UTC) X-FDA: 82486988262.15.B15D06A Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf27.hostedemail.com (Postfix) with ESMTP id F270D40008 for <linux-mm@kvack.org>; Sat, 24 Aug 2024 11:57:08 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=ik6E3l3i; spf=pass (imf27.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724500611; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=7MlSZRgX4NtPTJfbL1OG/C/fCyXDm1yZsFhC7WYkkOo=; b=ZBNTVDPLOXsOc5eMGoXklG36T/HsBOGcrHUUhCpib1EL/+6i/TnuktcDJ2qwoQ+zYd/vvQ whhA1rklWvr68puRfbu84vha+Q9f3n8/MHO4It+Rwny0cGHBMXgw71JJHOnrr/jjtTzC9o +e25ji/qkAr3TkIOIL198j3sDLOT+0Y= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=ik6E3l3i; spf=pass (imf27.hostedemail.com: domain of dhowells@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=dhowells@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724500611; a=rsa-sha256; cv=none; b=xdgAFGVOBzAS3d1C2jHCYBeXTYmvKxlmiDGHLajPZgoCg8S//haBoUdePLgH2z1ACym0C2 YKxXqO3BejctnNLrEMVCUaWG2qG5gob9UaxJ6yisCOQThKBCkYKOKkDgjDKruzd0dYRO3o S8FDxGKq/lc9loI6vHmQrfWX19wpNzc= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1724500628; h=from:from:reply-to:subject:subject:date:date:message-id:message-id:to: cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=7MlSZRgX4NtPTJfbL1OG/C/fCyXDm1yZsFhC7WYkkOo=; b=ik6E3l3ihYfC39vb/oZ1HuAsevce3MQPmPa++1Es3+3CQi9VCPvJDOv6Gg3eBLjD/Hax8P Zpt/SpUnIOWnHqnPNGaXI7jziEY50WiRs8cUpHjFrfnZA2mF8jXoW1sqf+CvbhEZNaSSOU ebhcDsjom0RQFb/n/H+xukjm/ryC5D0= Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-554-dsco4DIKOqS_7UEUarFQjQ-1; Sat, 24 Aug 2024 07:57:03 -0400 X-MC-Unique: dsco4DIKOqS_7UEUarFQjQ-1 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (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 mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A55D61955F43; Sat, 24 Aug 2024 11:56:59 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.42.28.30]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 4C96919560AA; Sat, 24 Aug 2024 11:56:54 +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 <dhowells@redhat.com> In-Reply-To: <20240823200819.532106-1-dhowells@redhat.com> References: <20240823200819.532106-1-dhowells@redhat.com> Cc: dhowells@redhat.com, Christian Brauner <christian@brauner.io>, Steve French <sfrench@samba.org>, Pankaj Raghav <p.raghav@samsung.com>, Paulo Alcantara <pc@manguebit.com>, Jeff Layton <jlayton@kernel.org>, Matthew Wilcox <willy@infradead.org>, netfs@lists.linux.dev, 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-erofs@lists.ozlabs.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 10/9] netfs: Fix interaction of streaming writes with zero-point tracker MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <563285.1724500613.1@warthog.procyon.org.uk> Date: Sat, 24 Aug 2024 12:56:53 +0100 Message-ID: <563286.1724500613@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Rspam-User: X-Stat-Signature: qh73ggdrwt75e6pni9ewsbsahyh1z3cn X-Rspamd-Queue-Id: F270D40008 X-Rspamd-Server: rspam11 X-HE-Tag: 1724500628-440727 X-HE-Meta: U2FsdGVkX1/ezsy1SemHDvpH/MQIK7FjvfQ2fZtkCUW9OgLm79pTdKEd6jPs3BbsLehRCSHNG/UhIUjiBZuaQvm+WhqV3AljaMqV5uQAqT+mgENdYjXoVRDYSH4Bf1itKblYH0tQ2Qj8kGvQEFQDb3VYOU5V4iSwgdoGm6mEYLvtrBx0pq1dcfqZowF/w4cE2mADS/NNLg5Ze2wckQEj71rcdNArGgNocT8SJTFfq2gE8cY0Wu4ofPnvc72H6o3akidP+xHbcN0ml4dMQmjXV6TBA3uos8QE87K90XxYyUdHI1ZeEkHhDp+m00Guojow2eOZz3Re+c76tQCr0DY3gYHNVdVCVFyVLuCd81Foy5ucyXRf+5l6eZSgoQAdaqGuauNZpFTksg76DM9bu+8Mr/V6glR0Wxtp0SMvVGS9TKX4RzLo9+3sQVokFUjKfgcxfEbIo6oP4NaQgfOoKIilUC9TfymYktEkIocNTwqAK2sHv94Nzwzwuvl2iQnblCxPfXPtTfiZP+JKKBr6pWV5f/F7fE+IM1hLQoTEL/QibVIGUkUItin1w3lZ0k3xaM+zKdqBqIMHTr9w41hNqQ7L0IZRg8YEdAMqGmWgpYGfzy2MFvZbE4iw+nr/1G5deyX9os1hFmjADnKjIOyMBgcpt6L0DjwxDwOb+VkAtY/x9wBl1CBgOIWc3wprcxH5+r0WTOyz0f3vKcRR8CtGlecjRctQmXjxw2au/wuysr8oWJzBSohW/mnfbBhn/ZgO0H5B9HsVVjgY8pBtmroPCQifu2A8oz4ULV4zt6ahcaxPJlEDU8Kj0CEQaJUXLF0LZiUBMO33VJWpeXPF37TrLbURMEqdLrUhcaYa7y0LFIFAZ6mnf4T41pXa8RvWdrGU9KkaITiCYWV4SSR4kN+/pS5oI6g9TyoajSRqRsYb5kTHBdbDOpPmSS3cV8WxWt+wGxFs1Q9qHzFp//kZn/zQtTH Vcv2rACK wF4ygM1SB/HkVb6UgzgoUglrf96DQHsJONZn9QhZW3ckV6tkBaea0Lv73Q0rGPmZADjzi10qRSmOQM/fmQ2JqpfLwu2w+9x8HH/zSoKah5isXNlw5AnYg7vm5mN9jSsZtBCiUC4M2pUCpreKpmkpovWYPW+nZBzq81ckIUa2/En5WBQQerZJEOSGyMmRBjVqISpsnLn3njYT2lUMw0C8YbMXdsk5NOYzGXTEEzSXyTfNFYDfxmuP4aHJGGkqert/Z/nkiwmgjCLCgg5IovGwhYF0U+4EqS0n71DgP72X75IVpxhmIJQRzAjW/D+Rej9FDBjlZCmrekJtNamwTLe5AjWrZOQyqeEz2NnPR6GB4nevlJUqc+No3/gADrRuo+k9B9VEoOQEo7nbedyU5lI9tCLRGrJNbCvUSK7rIrtZh4IHjCpcLTPoHTD4pchFdRqz8rl8Ngik9XExzFtVZPVBFmCH66zNJI3LI77j+cjXFAQZByWesCM9DhKiGBH4wZGOiUPAkDZN4nx6079UEtwPhTz4oNF2yNO7PEm5R X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.org> |
Series |
netfs, cifs: Combined repost of fixes for truncation, DIO read and read-retry
|
expand
|
diff --git a/fs/netfs/write_collect.c b/fs/netfs/write_collect.c index 426cf87aaf2e..ae7a2043f670 100644 --- a/fs/netfs/write_collect.c +++ b/fs/netfs/write_collect.c @@ -33,6 +33,7 @@ int netfs_folio_written_back(struct folio *folio) { enum netfs_folio_trace why = netfs_folio_trace_clear; + struct netfs_inode *ictx = netfs_inode(folio->mapping->host); struct netfs_folio *finfo; struct netfs_group *group = NULL; int gcount = 0; @@ -41,6 +42,12 @@ int netfs_folio_written_back(struct folio *folio) /* Streaming writes cannot be redirtied whilst under writeback, * so discard the streaming record. */ + unsigned long long fend; + + fend = folio_pos(folio) + finfo->dirty_offset + finfo->dirty_len; + if (fend > ictx->zero_point) + ictx->zero_point = fend; + folio_detach_private(folio); group = finfo->netfs_group; gcount++;
When a folio that is marked for streaming write (dirty, but not uptodate, with partial content specified in the private data) is written back, the folio is effectively switched to the blank state upon completion of the write. This means that if we want to read it in future, we need to reread the whole folio. However, if the folio is above the zero_point position, when it is read back, it will just be cleared and the read skipped, leading to apparent local corruption. Fix this by increasing the zero_point to the end of the dirty data in the folio when clearing the folio state after writeback. This is analogous to the folio having ->release_folio() called upon it. This was causing the config.log generated by configuring a cpython tree on a cifs share to get corrupted because the scripts involved were appending text to the file in small pieces. Fixes: 288ace2f57c9 ("netfs: New writeback implementation") Signed-off-by: David Howells <dhowells@redhat.com> cc: Steve French <sfrench@samba.org> cc: Paulo Alcantara <pc@manguebit.com> cc: Jeff Layton <jlayton@kernel.org> cc: linux-cifs@vger.kernel.org cc: netfs@lists.linux.dev cc: linux-fsdevel@vger.kernel.org --- fs/netfs/write_collect.c | 7 +++++++ 1 file changed, 7 insertions(+)