mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v3 0/3] mm/truncate: fix data loss when truncating straddling large folios
@ 2026-09-16  9:24 Zhang Yi
  2026-09-16  9:24 ` [PATCH v3 1/3] mm/truncate: fix data loss when splitting straddling large folios fails Zhang Yi
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Zhang Yi @ 2026-09-16  9:24 UTC (permalink / raw)
  To: linux-mm
  Cc: linux-fsdevel, linux-kernel, linux-ext4, akpm, david, ljs, liam,
	vbabka, rppt, surenb, mhocko, hughd, baolin.wang, willy, jack,
	ziy, bfoster, joannelkoong, djwong, yi.zhang, yi.zhang,
	yizhang089, yangerkun, chengzhihao1, wangkefeng.wang, yukuai

From: Zhang Yi <yi.zhang@huawei.com>

Hello,

This is the third version fixing data loss when truncating straddling
large folios caught on the upcomming ext4 + iomap buffered I/O
conversion[1]. I've clarify the split logic as Joanne and Brian
suggested, also slove the concurrent issue pointed out by sashiko and
split the patch into 3 small ones as Zi Yan suggested.

Patch 1: Add pstart and pend parameters to
         truncate_inode_partial_folio() and fix the data loss issue when
         the second splitting straddling large folios fails.
Patch 2: Fix the similar data loss issue also could encountered on the
         filesystem with min_order > 0.
Patch 3: Clarify the existing confusing return value of
         truncate_inode_partial_folio().

Thanks,
Yi.

[1] https://lore.kernel.org/linux-fsdevel/a638a8fb-c184-4069-ae33-379ec12cd514@huaweicloud.com/

v2->v3:
 - Rework the folio2 validity check logic to fix the invalid
   folio->index issue. (sashiko)
 - Clarify the pstart and pend setting logic and the corresponding
   comments to make it more readable. (Brian, Joanne)
 - Split the patch into 3 small patches. (Zi Yan)
v1->v2:
 - Export pstart as a new parameter so that the generic and shmem
   truncate paths don't need to recompute the start value from the
   return value. (Brian)
 - When min_order is nonzero, align [pstart, pend] to the inner
   boundaries of the folio to ensure they do not point into the middle
   of a large folio, which could otherwise cause valid data within the
   folio to be incorrectly cleared. (Joanne)

v2: https://lore.kernel.org/linux-mm/20260909062339.473816-1-yi.zhang@huaweicloud.com/
v1: https://lore.kernel.org/linux-mm/20260903115018.2034541-1-yi.zhang@huaweicloud.com/


Zhang Yi (3):
  mm/truncate: fix data loss when splitting straddling large folios
    fails
  mm/truncate: align truncation boundaries to mapping minimum folio
    order
  mm/truncate: clarify return value of truncate_inode_partial_folio()

 mm/internal.h |   4 +-
 mm/shmem.c    |  13 +++----
 mm/truncate.c | 105 ++++++++++++++++++++++++++++++++++----------------
 3 files changed, 79 insertions(+), 43 deletions(-)

-- 
2.52.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-09-16 21:15 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-16  9:24 [PATCH v3 0/3] mm/truncate: fix data loss when truncating straddling large folios Zhang Yi
2026-09-16  9:24 ` [PATCH v3 1/3] mm/truncate: fix data loss when splitting straddling large folios fails Zhang Yi
2026-09-16 12:02   ` Jan Kara
2026-09-16 18:03     ` Zi Yan
2026-09-16 17:38   ` Brian Foster
2026-09-16  9:24 ` [PATCH v3 2/3] mm/truncate: align truncation boundaries to mapping minimum folio order Zhang Yi
2026-09-16 21:14   ` Zi Yan
2026-09-16  9:24 ` [PATCH v3 3/3] mm/truncate: clarify return value of truncate_inode_partial_folio() Zhang Yi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®