From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=220.197.31.4 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796466623; b=pzd3hX9vKv9wRAqpyTFhbjwNSpR+WeBUmKLbJ7Dhw4I7Yomxpp8F/2ttqMXMeeXHR/Ca 4DwqEOFOIAODW4gQga2NnfwsLq0q+JdBA07jnk8op6jfSba+ZKbcCB2BCTSQoVAVnxClp /80XEeyB89V1giGR86L3jjdLgarVsGmTIW9ouDgjuhgNvPCafTT9s3zP8zfDJsjFLnxMs 4aYmghI6TI+jIEctuyXMI3Dk9riAagTriq4lc/U9WGJDien0iIDBOS7k5WyLu6CpN2GOm juuHRGc/bv24gDLl1EEExi7bNmEbKf1J9xkD+CLnr7DwxqRBvlgzV+khx2EH+0vwFjQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796466623; h=DMARC-Filter:DKIM-Signature:Message-ID:Date:MIME-Version:User-Agent: Subject:To:Cc:References:Content-Language:From:In-Reply-To: Content-Type:Content-Transfer-Encoding:X-CM-TRANSID: X-Coremail-Antispam:X-CM-SenderInfo; bh=kkhbnFKxFsm5vxnY6M4GBvYDnGm9ymDVXNGyDMPtd30=; b=49fo+ECloEdDXtV0A/CdapLxHgbxaG99XgwGLkKyEn1wx2z7R9wLHw1W54Es0SQRXyn6 0flGPXkEmKrFLcxE6Fc1bBsAnJxeO3YSC6EAXBD92cP5hwbzj7SQRBMeFWvJvwC5pco/w g1DIgvV+dv+YFkpWsSSHxeFFdlLp+ih9nWnmM6VTWn9tJ5sITCMaf31BBQ05X5oSRWHpA 0e5zexbC4ZlPKj28CiFSGratf+v5D6T1idj0MdQRcS1Oy4jIxOAlb94bitRX/DzItC2Xt z08flRDC50CphsZWD3MMvl9N5iLkUddFf4zqfGdGSFppqtOv0WFerLV3Btde7sYNnQA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=163.com; spf=pass smtp.mailfrom=163.com; dkim=pass header.d=163.com header.i=@163.com header.a=rsa-sha256 header.s=s110527 header.b=J3+gR80n; arc=none smtp.remote-ip=220.197.31.4 Received: from m16.mail.163.com (m16.mail.163.com [220.197.31.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AA7BD606A330 for ; Sat, 5 Dec 2026 10:30:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org AA7BD606A330 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=163.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.a=rsa-sha256 header.s=s110527 header.b=J3+gR80n DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=Message-ID:Date:MIME-Version:Subject:To:From: Content-Type; bh=kkhbnFKxFsm5vxnY6M4GBvYDnGm9ymDVXNGyDMPtd30=; b=J3+gR80nOjYiykkPDkj78Jdf4Scd16/esr43mPjOuzRiQ5S/M60WBrImL5ei/7 HaWndjGosHo9uUI7WGAInibofKmyhRU2aSlVrvwRZMmKVX6KmD/xQlgmeBnpdG8q St09DgMQH8gcEknZJ7vq/zkjZcnxF9mJT5sd9T/71dV9I= Message-ID: <4018ee2f-0e68-403e-9dfa-848429bc5671@163.com> Date: Sat, 5 Dec 2026 18:29:50 +0800 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1 01/13] ntfs: limit writeback allocation to the dirty range To: Ernest Borowski Cc: linkinjeon@kernel.org, hyc.lee@gmail.com, ntfs@lists.linux.dev, linux-kernel@vger.kernel.org, Baolin Liu References: <20261203040352.1161120-1-liubaolin12138@163.com> <20261203040352.1161120-2-liubaolin12138@163.com> <179640993906.154108.3521906504217124720.b4-reply@b4> Content-Language: en-US From: liubaolin In-Reply-To: <179640993906.154108.3521906504217124720.b4-reply@b4> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-CM-TRANSID:_____wD3F+6e5xNr1wwOLw--.37059S2 X-Coremail-Antispam: 1Uf129KBjvJXoWxWry5Aw48Gr1DtF4kAFWkJFb_yoW5CFykpF W3KFs8trs8Kr1rJw18Aw40qr1F9w4rZ34UGw1rtwnFv3s8u3WvvF9YgF4jvFZ8CrWrGF4a yF45Z34UuF4kA3DanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07U2kskUUUUU= X-CM-SenderInfo: xolxutxrol0iasrtmqqrwthudrp/xtbC6gDBjGsT56C3gwAA3s 在 2026/12/5 02:45, Ernest Borowski 写道: > Hi Baolin, > > On Thu, Dec 03, 2026 at 12:03:40PM +0800, Baolin Liu wrote: >> A buffered write into a hole reserves space before copying user data. >> If the copy faults partway through, writeback can allocate the clean >> remainder of the reservation because it maps up to allocated_size. >> After fsync and cache eviction, reads can expose old disk contents >> instead of zeros. > > Patch 13 of my delalloc series v5 [1] fixes the same bug in a different > way: writeback maps up to the end of the dirty folios that follow the > one being written, and zeroes a cluster larger than a page on the disk > only when some of its folios below initialized_size are not dirty. I > ran your patch, ported onto patches 1-12 of v5, through our reproducers > on the current ntfs-next. It passes the same ones as patch 13 > (killed_short_write_wb, hole_fill_stale, stale_wb_race and the others). > > Mapping one dirty range at a time costs time with clusters larger than > a page, because every new cluster is zeroed on the disk before its > first folio is written. fsync() of 384 MiB written into new space, 3 > runs each, on a kernel without debug options: > > cluster size your patch patch 13 ntfs-next > 512 B, 4 KiB 98-113 ms 111-140 ms 172-204 ms > 64 KiB 242-260 ms 110-120 ms 170-177 ms > > Your patch also makes mkwrite_past_init pass, which patch 13 does not. > That test stores through a shared mapping 2 MiB into a file whose > initialized size is 4 KiB, and then reads the tail of the first cluster. > Your patch zeroes the whole first cluster when the first 4 KiB are > written back, so the tail happens to be zero. From reading the code, a > cluster allocated another way, for example by fallocate(), would still > show old data there; I have not tested that. Zhan's "ntfs: zero up to a > page that a shared mapping makes writable" [2] fixes that case where it > starts, when the write fault moves the initialized size. > > Would you be fine with dropping 1/13 from the large folio series and > basing it on the delalloc series instead? I have not tested the large > folio patches on top of v5. > > [1] https://lore.kernel.org/all/20261204-b4-ntfs-delalloc-fixes-v5-0-1cd0267df2cd@proton.me/ > [2] https://lore.kernel.org/all/20261201125126.1651071-1-zhanxusheng1024@gmail.com/ > > Thanks, > Ernest Hi Ernest, Thanks for checking this and testing my patch. I ran into these issues while developing and testing the large folio series against ntfs-next as it stood at the time. I should have checked for overlap with your delalloc series before posting. Sorry about that. After going through both series again, I see that my patches 1 and 5 address the same issues as patches 13 and 4, respectively, of your v5 series. I'm happy to drop those two patches and build on your fixes. I'll hold off on posting v2 until your series lands in ntfs-next, then rebase the remaining patches and rerun the tests before sending it. Thanks again for your help. You've done a really thorough job with these fixes, and I appreciate the time you've taken to check my changes too. Thanks, Baolin.