Skip to content

Commit 77edfc6

Browse files
hyeongseok-kim901namjaejeon
authored andcommitted
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 added by reserved cluster size which is 2, leading to discard unrelated sectors included in target+2 cluster. With fixing this, remove the wrong comments in set/clear/find bitmap functions. Fixes: 1e49a94 ("exfat: add bitmap operations") Cc: [email protected] # v5.7+ Signed-off-by: Hyeongseok Kim <[email protected]> Acked-by: Sungjong Seo <[email protected]> Signed-off-by: Namjae Jeon <[email protected]>
1 parent 9f4ad9e commit 77edfc6

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

fs/exfat/balloc.c

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,6 @@ void exfat_free_bitmap(struct exfat_sb_info *sbi)
141141
kfree(sbi->vol_amap);
142142
}
143143

144-
/*
145-
* If the value of "clu" is 0, it means cluster 2 which is the first cluster of
146-
* the cluster heap.
147-
*/
148144
int exfat_set_bitmap(struct inode *inode, unsigned int clu)
149145
{
150146
int i, b;
@@ -162,10 +158,6 @@ int exfat_set_bitmap(struct inode *inode, unsigned int clu)
162158
return 0;
163159
}
164160

165-
/*
166-
* If the value of "clu" is 0, it means cluster 2 which is the first cluster of
167-
* the cluster heap.
168-
*/
169161
void exfat_clear_bitmap(struct inode *inode, unsigned int clu, bool sync)
170162
{
171163
int i, b;
@@ -186,8 +178,7 @@ void exfat_clear_bitmap(struct inode *inode, unsigned int clu, bool sync)
186178
int ret_discard;
187179

188180
ret_discard = sb_issue_discard(sb,
189-
exfat_cluster_to_sector(sbi, clu +
190-
EXFAT_RESERVED_CLUSTERS),
181+
exfat_cluster_to_sector(sbi, clu),
191182
(1 << sbi->sect_per_clus_bits), GFP_NOFS, 0);
192183

193184
if (ret_discard == -EOPNOTSUPP) {

0 commit comments

Comments
 (0)