Skip to contentSkip to conversation

fsdax-dedupe-should-compare-the-min-of-two-iters-length.patch removed from -mm tree

merged mm-hotfixes-stable Andrew Morton 1 participant 1 message Mar 28, 2023 Stable branch

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: fsdax: dedupe should compare the min of two iters' length
has been removed from the -mm tree. Its filename was
fsdax-dedupe-should-compare-the-min-of-two-iters-length.patch

This patch was dropped because it was merged into the mm-hotfixes-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Shiyang Ruan <[email protected]>
Subject: fsdax: dedupe should compare the min of two iters' length
Date: Wed, 22 Mar 2023 07:25:58 +0000

In an dedupe comparison iter loop, the length of iomap_iter decreases because it implies the remaining length after each iteration.

The dedupe command will fail with -EIO if the range is larger than one page size and not aligned to the page size. Also report warning in dmesg:

[ 4338.498374] ------------[ cut here ]------------
[ 4338.498689] WARNING: CPU: 3 PID: 1415645 at fs/iomap/iter.c:16 

...

The compare function should use the min length of the current iters, not the total length.

Fixes 0e79e3736d54 ("fsdax: dedupe: iter two files at the same time")
Cc Dan Williams <[email protected]>
Cc Jan Kara <[email protected]>
Cc Matthew Wilcox (Oracle) <[email protected]>

---

 fs/dax.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/dax.c renamed from fs/dax.c~fsdax-dedupe-should-compare-the-min-of-two-iters-length +2 -2
@@ -2027,8 +2027,8 @@ int dax_dedupe_file_range_compare(struct
 
 	while ((ret = iomap_iter(&src_iter, ops)) > 0 &&
 	       (ret = iomap_iter(&dst_iter, ops)) > 0) {
-		compared = dax_range_compare_iter(&src_iter, &dst_iter, len,
-						  same);
+		compared = dax_range_compare_iter(&src_iter, &dst_iter,
+				min(src_iter.len, dst_iter.len), same);
 		if (compared < 0)
 			return ret;
 		src_iter.processed = dst_iter.processed = compared;

_

Patches currently in -mm which might be from [email protected] are

fsdax-force-clear-dirty-mark-if-cow.patch