From patchwork Thu Jul 18 13:02:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Foster X-Patchwork-Id: 13736476 Return-Path: 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 B6864C3DA49 for ; Thu, 18 Jul 2024 13:01:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B88BD6B008C; Thu, 18 Jul 2024 09:01:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B45FB6B0089; Thu, 18 Jul 2024 09:01:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 98A606B008C; Thu, 18 Jul 2024 09:01:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 75C4F6B0088 for ; Thu, 18 Jul 2024 09:01:40 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 19307A5EEE for ; Thu, 18 Jul 2024 13:01:40 +0000 (UTC) X-FDA: 82352885160.16.8C710D8 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf19.hostedemail.com (Postfix) with ESMTP id 142411A0021 for ; Thu, 18 Jul 2024 13:01:37 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=NQRkyrFn; spf=pass (imf19.hostedemail.com: domain of bfoster@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=bfoster@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=1721307656; h=from:from:sender: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:dkim-signature; bh=bx5WayJveBqE7cRKQVT93Q4qPgEATb10VO9hHxn66JQ=; b=Hjt4Z183fdtXAruL8ZIb/P3T4l0RsOFPYMW1qR/B+T4bhwmLIwwbKREAfIa83BGw3X3XBq VttEXcwgcHg96cNJVPdyLMc4ncvww5PRbhMa9+2BidiI/y1tSD6jzwT9oULj6kuFcTYziL iEZkXAjJq8m9YR36QiB+Vm/gwW+qkB0= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721307656; a=rsa-sha256; cv=none; b=PVh57hhkuAZ+5JBppaqNtsF+vDGDlotwjsd9xBotOtJKaJTGrdQl8gHg6anqtIV4OtFopa GnEA4HS3GR9bTJzqRbOXzUYyhb+yOoOxcgHMltLWMi1lUBuOsqEHrt6P+OEe28MIMi+1RM IFqtBed9PJ5UNIn6PQH1nZNAOEDzRx0= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=NQRkyrFn; spf=pass (imf19.hostedemail.com: domain of bfoster@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=bfoster@redhat.com; dmarc=pass (policy=none) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1721307697; 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=bx5WayJveBqE7cRKQVT93Q4qPgEATb10VO9hHxn66JQ=; b=NQRkyrFn+Iq40o1ftBQU+e4GbbHBxEc0ZHzh04aYlDnnhq2TUXXDiO0+vcrVgb6CPdBdV7 teBpO3LIdun5fPPTQp4L/iDrq757K5vJowDJ2n8stnxPFYDuBt6mYBI7cLocPWDDRoLv2K gjyUo2kpbDZnL80OqWCxgwfdowLEi84= Received: from mx-prod-mc-05.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-505-6HTZOMWZN3qNicmmPh7_1Q-1; Thu, 18 Jul 2024 09:01:31 -0400 X-MC-Unique: 6HTZOMWZN3qNicmmPh7_1Q-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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id A8B781955F06; Thu, 18 Jul 2024 13:01:30 +0000 (UTC) Received: from bfoster.redhat.com (unknown [10.22.16.39]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id A137519560B2; Thu, 18 Jul 2024 13:01:29 +0000 (UTC) From: Brian Foster To: linux-fsdevel@vger.kernel.org Cc: linux-xfs@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 3/4] iomap: fix handling of dirty folios over unwritten extents Date: Thu, 18 Jul 2024 09:02:11 -0400 Message-ID: <20240718130212.23905-4-bfoster@redhat.com> In-Reply-To: <20240718130212.23905-1-bfoster@redhat.com> References: <20240718130212.23905-1-bfoster@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Stat-Signature: uqxxtz15o7jbd5j8dxywgtmbk51uj8wj X-Rspamd-Queue-Id: 142411A0021 X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1721307697-525085 X-HE-Meta: U2FsdGVkX1/c0S9dF0BzML399EaoJ0ujd3XLBNcoIdqLKX3AbVFg5SnAvGcuQJ2x9V/ILYQCqXPJgPQzo/92nRQmfMPBu/IXvdFbJbS8FgqHHrBEqthUXMMiz3Us/MQOpndRJxY4QYI+eSFspEHwMAYV+nn+bAQ5cY7y2hnYK4YUYzewKFEb1y64Q2yrQZbbMj0824zznjsH43WcI6hi4dvLdSS2P5EyKBQtBhdHhGhGvY/9B0XUPHCGnUDv5vBv4mJ6J8LcPB2V2yTIVzlVpeqNWLSV9GjWuaijon2aHMdyDrNdW7BOTxlduv2mcQzv8GDBsgJNPHRzvwPX6FmUMETLo1A0TPNVbx30gWbnZmjENgj7GITXPTEA9C3PLb5nond5Uix+K8sjM/9+xzDzBFGLGFull1WIYFh1Yv+cItCvVRyKdHGDhcCcZv9CMxDrvwNCrhBPQo9YRX41lv0q0bkDxgfuy2OVAqMN991mRN55yujvKGh+2kgQzAd+zBzLn+UBP3H6RywIJfLvmNk06iSlAmORT5UmzqTuwDqZOq8qQvEHiMvD0+Jnqy76fzgAAPbIWtQp23PKkdp2ZCOwopOYzpqV3Jj7ukHkYNfUlo/Jexyk7a4kYtAPzar13faUytbgGOgcBIwcxukzjH4y5+CIyuAf4wfAasJNEVqmeGk30u1qLSxbra7Yv27McMD5KMsFXQEz4/yW9ubDRooXlI4WooiWewB+yABQB6T9KAfqljUafOB/ZstZpiaFlknAmdlDvVZarH/UiO3kMNBlE2mYwrgtMti6BE6TiYV97Y242bSsb6zev0pUppJUkgwJoK9cQbWwYhKBfa6T4ifI8jBRGla1mlZq9KoCKbO4wZFtxnZ3RBnZKlM1om0bGiJQd9nrs04vpWEzV+C92vBvInt/pksjOIhkUSQuih2zvhDpFsC421wspCB6te872Tu1rsCZJb16sDcoXcpFqHd VyonWW45 LCZlU7AbjlTEtPeNKRRT7NzAgwuKffm+1a2kFWohuuRBGVgsu2R3eGxulgo6bZAJzdmrOXTv7xUGRtr3MRcHymWehWrAWZ95Rvz2ckYRLkH1bQksyf+GNjDyjHDl2/WUz3ACYnyXisW6CQDAjAFq1jkckcEK+oj5ZtrHxCN0ZSHEU8Lk/VG/n8ha9enrBO8/Shv2A8XGMWrqVD8uLnnQSKlHFHqvzBoSvhg/e7GZNBBQk7uxu18nPTUBYgiTsrCag6yokeZRXGpGhtKJsXH10Srzj4wo62LfR1WbBc41wCXxOBE/0rJWTJQHCa6jBVKR8zNRt X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: iomap_zero_range() does not correctly handle unwritten mappings with dirty folios in pagecache. It skips unwritten mappings unconditionally as if they were already zeroed, and thus potentially exposes stale data from a previous write if affected folios are not written back before the zero range. Most callers already flush the target range of the zero for unrelated, context specific reasons, so this problem is not necessarily prevalent. The known outliers (in XFS) are file extension via buffered write and truncate. The truncate path issues a flush to work around this iomap problem, but the file extension path does not and thus can expose stale data if current EOF is unaligned and has a dirty folio over an unwritten block. This patch implements a mechanism for making zero range pagecache aware for filesystems that support mapping validation (i.e. folio_ops->iomap_valid()). Instead of just skipping unwritten mappings, scan the corresponding pagecache range for dirty or writeback folios. If found, explicitly zero them via buffered write. Clean or uncached subranges of unwritten mappings are skipped, as before. The quirk with a post-iomap_begin() pagecache scan is that it is racy with writeback and reclaim activity. Even if the higher level code holds the invalidate lock, nothing prevents a dirty folio from being written back, cleaned, and even reclaimed sometime after iomap_begin() returns an unwritten map but before a pagecache scan might find the dirty folio. To handle this situation, we can rely on the fact that writeback completion converts unwritten extents in the fs before writeback state is cleared on the folio. This means that a pagecache scan followed by a mapping revalidate of an unwritten mapping should either find a dirty folio if it exists, or detect a mapping change if a dirty folio did exist and had been cleaned sometime before the scan but after the unwritten mapping was found. If the revalidation succeeds then we can safely assume nothing has been written back and skip the range. If the revalidation fails then we must assume any offset in the range could have been modified by writeback. In other words, we must be particularly careful to make sure that any uncached range we intend to skip does not make it into iter.processed until the mapping is revalidated. Altogether, this allows zero range to handle dirty folios over unwritten extents without needing to flush and wait for writeback completion. Signed-off-by: Brian Foster --- fs/iomap/buffered-io.c | 53 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 50 insertions(+), 3 deletions(-) diff --git a/fs/iomap/buffered-io.c b/fs/iomap/buffered-io.c index a9425170df72..ea1d396ef445 100644 --- a/fs/iomap/buffered-io.c +++ b/fs/iomap/buffered-io.c @@ -1385,6 +1385,23 @@ iomap_file_unshare(struct inode *inode, loff_t pos, loff_t len, } EXPORT_SYMBOL_GPL(iomap_file_unshare); +/* + * Scan an unwritten mapping for dirty pagecache and return the length of the + * clean or uncached range leading up to it. This is the range that zeroing may + * skip once the mapping is validated. + */ +static inline loff_t +iomap_zero_iter_unwritten(struct iomap_iter *iter, loff_t pos, loff_t length) +{ + struct address_space *mapping = iter->inode->i_mapping; + loff_t fpos = pos; + + if (!filemap_range_has_writeback(mapping, &fpos, length)) + return length; + /* fpos can be smaller if the start folio is dirty */ + return max(fpos, pos) - pos; +} + static loff_t iomap_zero_iter(struct iomap_iter *iter, bool *did_zero) { const struct iomap *srcmap = iomap_iter_srcmap(iter); @@ -1393,16 +1410,46 @@ static loff_t iomap_zero_iter(struct iomap_iter *iter, bool *did_zero) loff_t written = 0; /* already zeroed? we're done. */ - if (srcmap->type == IOMAP_HOLE || srcmap->type == IOMAP_UNWRITTEN) + if (srcmap->type == IOMAP_HOLE) return length; do { struct folio *folio; int status; size_t offset; - size_t bytes = min_t(u64, SIZE_MAX, length); + size_t bytes; + loff_t pending = 0; bool ret; + /* + * Determine the range of the unwritten mapping that is clean in + * pagecache. We can skip this range, but only if the mapping is + * still valid after the pagecache scan. This is because + * writeback may have cleaned folios after the mapping lookup + * but before we were able to find them here. If that occurs, + * then the mapping must now be stale and we must reprocess the + * range. + */ + if (srcmap->type == IOMAP_UNWRITTEN) { + pending = iomap_zero_iter_unwritten(iter, pos, length); + if (pending == length) { + /* no dirty cache, revalidate and bounce as we're + * either done or the mapping is stale */ + if (iomap_revalidate(iter)) + written += pending; + break; + } + + /* + * Found a dirty folio. Update pos/length to point at + * it. written is updated only after the mapping is + * revalidated by iomap_write_begin(). + */ + pos += pending; + length -= pending; + } + + bytes = min_t(u64, SIZE_MAX, length); status = iomap_write_begin(iter, pos, bytes, &folio); if (status) return status; @@ -1422,7 +1469,7 @@ static loff_t iomap_zero_iter(struct iomap_iter *iter, bool *did_zero) pos += bytes; length -= bytes; - written += bytes; + written += bytes + pending; } while (length > 0); if (did_zero) From patchwork Thu Jul 18 13:02:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Foster X-Patchwork-Id: 13736475 Return-Path: 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 C6C3AC3DA60 for ; Thu, 18 Jul 2024 13:01:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1C4086B0085; Thu, 18 Jul 2024 09:01:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 14DB16B0088; Thu, 18 Jul 2024 09:01:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id F2F9B6B0089; Thu, 18 Jul 2024 09:01:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id D3E426B0085 for ; Thu, 18 Jul 2024 09:01:39 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 79C1DA5B50 for ; Thu, 18 Jul 2024 13:01:39 +0000 (UTC) X-FDA: 82352885118.06.16D4E78 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf17.hostedemail.com (Postfix) with ESMTP id 0A95340007 for ; Thu, 18 Jul 2024 13:01:36 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=eV1Ykoc5; spf=pass (imf17.hostedemail.com: domain of bfoster@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=bfoster@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=1721307677; h=from:from:sender: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:dkim-signature; bh=bk8WncT64lzd4LgIcFxlqG71mv9F7AOrhpNIyzQF2CI=; b=YqGzwBMnjkd2at2oG+Lz/686DrokeVu7lHEzQzvD6MWwyswmZzzgfAqik+nOntogKwQtfE IUuDlXeMa6lC5s1J8edY/Lavsvayxf1aSNw6SZQto/mpVg2h6D7Q1AgOr+W6YjR97fhvCn gIYxI0GeB2zAVQOtGcTjPpixljjELA8= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=eV1Ykoc5; spf=pass (imf17.hostedemail.com: domain of bfoster@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=bfoster@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721307677; a=rsa-sha256; cv=none; b=30yGRFTxtcs0qhh+IXc4xqoBY91QICUS8o0EzTlL1WXKndLXyZ3hpaGfohj/MWKf1D5shN XZ+Vv/iC/xjv8lebovxOPzuLT92POhqlYU8l0/HO+tB4187PbOZOHls39A9NnBsa/+S/6F nhLCmRg4Hw9h3JALyMQfOHMGuqSf5sM= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1721307696; 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=bk8WncT64lzd4LgIcFxlqG71mv9F7AOrhpNIyzQF2CI=; b=eV1Ykoc5f7RyMTPO0gTisO1r1KoUWDCKLaYreFq05VRJuA8avsNPSdL7pqN/H8Kn7kXn// SNzjrseLyCL2SgkmYFN296gEohvdE3956ijfHkhgPD30gk6aUNOTp9xrcKz6Mmwriv0BqA Y/jgHIfEWIW51wxpR0Vcrdxzz97UhF8= 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-427-7098IFzjMyC3RB2-ZVHpBA-1; Thu, 18 Jul 2024 09:01:32 -0400 X-MC-Unique: 7098IFzjMyC3RB2-ZVHpBA-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 9BFC21955D60; Thu, 18 Jul 2024 13:01:31 +0000 (UTC) Received: from bfoster.redhat.com (unknown [10.22.16.39]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id C565B19560B2; Thu, 18 Jul 2024 13:01:30 +0000 (UTC) From: Brian Foster To: linux-fsdevel@vger.kernel.org Cc: linux-xfs@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 4/4] xfs: remove unnecessary flush of eof page from truncate Date: Thu, 18 Jul 2024 09:02:12 -0400 Message-ID: <20240718130212.23905-5-bfoster@redhat.com> In-Reply-To: <20240718130212.23905-1-bfoster@redhat.com> References: <20240718130212.23905-1-bfoster@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Rspam-User: X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 0A95340007 X-Stat-Signature: n8p3z7x4b9bze136z7bjxanzjkr3zmeh X-HE-Tag: 1721307696-310267 X-HE-Meta: U2FsdGVkX18z27fyc/oXAZMsRWVDsHzuB54P5F6w1MZVj1kWrXGTzDsNfGfd8tFcoc1cNFN002xotLZNc5Hjxrs2J3L+/b0KFYX1mnntzUgE4JlkDUdhioVnUIylL83lTvJuliKVHtdjG9wSG1fmp6hk39Yix5g3DCvecTppXheLztMvWHC/6xXAXSxttb3azLf+CN0mldbGZwFD9oytsh0+RtObiSE9sDcPpiVkrkWweBlpVaLqVz+rzmZHqp+xjkyBojRscnvTz3WkAadiI6s9JGv9ylVpekPVgzISGF1wcEbNZ3IAgYW7Nk0FGP2mEV8DraNlARzhexFSb6v/zBAgZ1eCim6GwhFdIF9yhRTA8Xpg+LHTOV5QkJt/CcXdcHz6jUeOiq7CwRHee5VUnBuGT0ir9WSpaMMn09c75gah80J0NK7OkYIm01UgKR8vYhcX9sbW3xZu6Y895KmUle5OEIQyUEovQiSKsXSvE5t33iH6HGZ+3rWB38e70Uawt7Zw34wOuNizhrgOPCtitRwbFvCw/zwvTgKEZLQcBFSyDqCcmIYvh/5nMH0n+wNtHQFZl/OZh903lZcqp1BUvS02g6lB5rObFbbq03qzcU/9AKxiEaC5DN3fosMQ6l2ljoWYXpRgz8dbbRKOPiIyYH/Z+axjXTOtxWs0NboN/OV5js6UPceIolV81Z/lCW4zm1EszB+cqKTex+FBYd+c92+lwPPOQsw7kbk4W+LeTyTvHk+oeaCDej9Zu62pmy4/MX01wBtRDF24qN4fT35zHkoaatVyd804+yG3m3v6d6pxsFqhnZcg2Ae6RuIGc9Tco7GXiwQAZf8C0tlEtEuoeASLSg6klBI8D3DwZO/tNNUfDasePUma8cCWete1hP7DpKZQOosIyK5s8WufiJc8vY33HXfuU305moZGK+8e0GZU5lhpcnQArJ0hy0LVwLBoYytbdfzlM/WQDlPKCqn 1GDfU40t ZspfyjY1qLOLDKSpuXb6sIMExXmPlp4MJJ2y1X3jYEiAfixiFvmCt3W4/kDa7/zntbIkWQghNvWCllR0Jr1u9RBK3YF0E7SmPBBZ8Q4HjHCEIzSgYGi2lOp6Z+vzifBjb9NGh4997rdJDJb77nprUtApgHiKyodoOx1MKeZ1R1qdjYmoNR+GBHvLCWtG/PXsc9QMxd+cO/QJxJ2h3Jw0+IkDqkImDEDCTEu1wIx3nWOB9rkqf7A8XbYKMMncRrWgdFgLIjkLJU6vKsOFiFxSVQJw8pwzkhIzcIqdaTM5mxQwsbcU= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: The EOF flush was originally added to work around broken iomap_zero_range() handling of dirty cache over unwritten extents. Now that iomap handles this situation correctly, the flush can be removed. Signed-off-by: Brian Foster --- fs/xfs/xfs_iops.c | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/fs/xfs/xfs_iops.c b/fs/xfs/xfs_iops.c index ff222827e550..eb0b7a88776d 100644 --- a/fs/xfs/xfs_iops.c +++ b/fs/xfs/xfs_iops.c @@ -862,16 +862,6 @@ xfs_setattr_size( error = xfs_zero_range(ip, oldsize, newsize - oldsize, &did_zeroing); } else { - /* - * iomap won't detect a dirty page over an unwritten block (or a - * cow block over a hole) and subsequently skips zeroing the - * newly post-EOF portion of the page. Flush the new EOF to - * convert the block before the pagecache truncate. - */ - error = filemap_write_and_wait_range(inode->i_mapping, newsize, - newsize); - if (error) - return error; error = xfs_truncate_page(ip, newsize, &did_zeroing); }