Skip to contentSkip to conversation

exfat: fix erroneous discard when clear cluster bit

PATCH Superseded Hyeongseok Kim 2 participants 3 messages Feb 25, 2021 – Mar 2, 2021

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 exfat: fix erroneous discard when clear cluster bit

If mounted with discard option, exFAT issues discard command when clear cluster bit to remove file. But the input parameter of cluster-to-sector calculation is abnormally adds reserved cluster size which is 2, leading to discard unrelated sectors included in target+2 cluster.

Fixes 1e49a94cf707 ("exfat: add bitmap operations")
---
 fs/exfat/balloc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
fs/exfat/balloc.c +1 -2
index 761c79c3a4ba..41a1dfd9d98a 100644
@@ -186,8 +186,7 @@ void exfat_clear_bitmap(struct inode *inode, unsigned int clu, bool sync)
 		int ret_discard;
 
 		ret_discard = sb_issue_discard(sb,
-			exfat_cluster_to_sector(sbi, clu +
-						EXFAT_RESERVED_CLUSTERS),
+			exfat_cluster_to_sector(sbi, clu),
 			(1 << sbi->sect_per_clus_bits), GFP_NOFS, 0);
 
 		if (ret_discard == -EOPNOTSUPP) {
Signature · 1 line
2.27.0.83.g0313f36
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines

Subject: [PATCH] exfat: fix erroneous discard when clear cluster bit

If mounted with discard option, exFAT issues discard command when clear cluster bit to remove file. But the input parameter of cluster-to-sector calculation is abnormally adds reserved cluster size which is 2, leading to discard unrelated sectors included in target+2 cluster.

Quoted 5 lines
Fixes 1e49a94cf707 ("exfat: add bitmap operations")
---
 fs/exfat/balloc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Looks good.

Thanks for your work!
Could you remove the wrong comments above set/clear/find bitmap functions together?

#2 lore raw
Quoted 12 lines · Sungjong Seo
Quoted 7 lines

Subject: [PATCH] exfat: fix erroneous discard when clear cluster bit

If mounted with discard option, exFAT issues discard command when clear cluster bit to remove file. But the input parameter of cluster-to-sector calculation is abnormally adds reserved cluster size which is 2, leading to discard unrelated sectors included in target+2 cluster.

Quoted 5 lines
Fixes 1e49a94cf707 ("exfat: add bitmap operations")
---
  fs/exfat/balloc.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
Quoted 8 lines

Looks good.

Thanks for your work!
Could you remove the wrong comments above set/clear/find bitmap functions together?

Done, in V2.
Thanks for the review.