xfs: clamp a pNFS LAYOUTCOMMIT extent before computing its end

xfs_fs_commit_blocks() adds the client's length to the offset before it
clamps the end to the file size. A large length wraps the sum and
reaches xfs_iomap_write_unwritten() unclamped. With the previous two
patches the LAYOUTCOMMIT then fails with -EIO and converts nothing.

Clamp the length first.

Fixes: 527851124d ("xfs: implement pNFS export operations")
Cc: stable@vger.kernel.org
Signed-off-by: Daejun Park <daejun7.park@samsung.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Pankaj Raghav <p.raghav@samsung.com>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
This commit is contained in:
Daejun Park 2026-10-29 11:23:01 +09:00 committed by Carlos Maiolino
parent bcf0b7f18a
commit d8c2bc8846

View File

@ -328,9 +328,7 @@ xfs_fs_commit_blocks(
if (start > size)
continue;
end = start + maps[i].length;
if (end > size)
end = size;
end = start + min_t(u64, maps[i].length, size - start);
length = end - start;
if (!length)