Re: [PATCH] exfat: validate cached iomaps during buffered writes and writeback

From: Chi Zhiling

Date: Wed Jul 01 2026 - 20:45:55 EST


On 7/1/26 8:02 PM, Namjae Jeon wrote:
diff --git a/fs/exfat/cache.c b/fs/exfat/cache.c
index 7c8b4182f5de..71631bab182c 100644
--- a/fs/exfat/cache.c
+++ b/fs/exfat/cache.c
@@ -228,9 +228,10 @@ static void __exfat_cache_inval_inode(struct inode *inode)
exfat_cache_free(cache);
}
/* Update. The copy of caches before this id is discarded. */
- ei->cache_valid_id++;
- if (ei->cache_valid_id == EXFAT_CACHE_VALID)
- ei->cache_valid_id++;
+ if (ei->cache_valid_id + 1 == EXFAT_CACHE_VALID)
+ ei->cache_valid_id = EXFAT_CACHE_VALID + 1;
+ else
+ ei->cache_valid_id = ei->cache_valid_id + 1;
This looks equivalent to the original one. What does this rewrite change?

This changes the number of writes, but it doesn't make much sense. I'll revert this change in the next version.


@@ -133,7 +134,7 @@ static int __exfat_iomap_begin(struct inode *inode, loff_t offset, loff_t length
}
}

- iomap->flags |= IOMAP_F_MERGED;
Is dropping the IOMAP_F_MERGED flag intentional? If yes, Why ?

Because IOMAP_F_MERGED is set twice in __exfat_iomap_begin(), this patch also drops the redundant assignment.


Thanks,

+ iomap->validity_cookie = ei->cache_valid_id;

Thanks.