mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] dm snapshot: fix discards spilling into the next COW chunk
@ 2026-10-30  9:21 Chen Cheng
  2026-10-30  9:21 ` [PATCH 1/2] dm snapshot: split discards on chunk boundaries Chen Cheng
  2026-10-30  9:21 ` [PATCH 2/2] dm snapshot: fix discard writing into the next COW chunk Chen Cheng
  0 siblings, 2 replies; 3+ messages in thread
From: Chen Cheng @ 2026-10-30  9:21 UTC (permalink / raw)
  To: dm-devel, linux-kernel, agk, snitzer, mpatocka, bmarzins
  Cc: stable, yukuai, chencheng

From: Chen Cheng <chencheng@fnnas.com>

Hi,

dm only splits discards at a chunk boundary for targets that ask for
it with ti->max_discard_granularity, and dm-snapshot never did.

So a discard can arrive starting in the middle of a chunk, or covering
several chunks at once.

zero_exception() zeroes the COW chunk using bio->bi_iter.bi_sector, which
remap_exception() has already turned into "COW chunk start + offset
inside the chunk".  The zeroing window is shifted by that offset, so the
head of the chunk we were asked to discard keeps its old data, and the
tail spills into the next COW chunk, which belongs to a different
exception.

Patch 1 sets ti->max_discard_granularity, so dm hands dm-snapshot
discards that are split on chunk boundaries.

Patch 2 makes io_overlaps_chunk() also require the discard to start on
a chunk boundary, and completes the discards that don't cover a whole
chunk with bio_endio() instead of sending them to the COW device.

Thanks,
Chen Cheng

Chen Cheng (2):
  dm snapshot: split discards on chunk boundaries
  dm snapshot: fix discard writing into the next COW chunk

 drivers/md/dm-snap.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

-- 
2.56.0

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

end of thread, other threads:[~2026-10-30  9:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-30  9:21 [PATCH 0/2] dm snapshot: fix discards spilling into the next COW chunk Chen Cheng
2026-10-30  9:21 ` [PATCH 1/2] dm snapshot: split discards on chunk boundaries Chen Cheng
2026-10-30  9:21 ` [PATCH 2/2] dm snapshot: fix discard writing into the next COW chunk Chen Cheng

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®