Re: [PATCH v2 4/9] exfat: add support for multi-cluster allocation
From: Chi Zhiling
Date: Sun May 10 2026 - 20:46:46 EST
On 5/11/26 08:20, Namjae Jeon wrote:
I'm not seeing this failure... Can you elaborate more why it wasdiff --git a/fs/exfat/inode.c b/fs/exfat/inode.c
index 1246713567a5..7b09d94ac464 100644
--- a/fs/exfat/inode.c
+++ b/fs/exfat/inode.c
@@ -137,9 +137,9 @@ static int exfat_map_cluster(struct inode *inode, unsigned int clu_offset,
unsigned int num_to_be_allocated = 0, num_clusters;
num_clusters = exfat_bytes_to_cluster(sbi, exfat_ondisk_size(inode));
-
- if (clu_offset >= num_clusters)
- num_to_be_allocated = clu_offset - num_clusters + 1;
+ if (clu_offset > num_clusters ||
+ *count > num_clusters - clu_offset)
+ num_to_be_allocated = clu_offset + *count - num_clusters;
We need to truncate *count for read operations so that it does not
extend beyond EOF. Otherwise, xfstests generic/003 will fail.
failing on your side ?
In my vm with 6G ram and 40G test disk, when the cluster size is 512 bytes, reading a 512-byte file (which consists of one cluster) fails because iomap attempts to fetch a map for the 0–4K range, which exceeds the file's EOF.