summaryrefslogtreecommitdiff
path: root/fs/exfat
diff options
context:
space:
mode:
authorHyeongseok Kim <hyeongseok@gmail.com>2021-03-04 03:15:34 +0300
committerNamjae Jeon <namjae.jeon@samsung.com>2021-04-27 14:45:06 +0300
commit77edfc6e51055b61cae2f54c8e6c3bb7c762e4fe (patch)
tree451dbeb5e3b50d0d5311d2b5dfcee65ca955953a /fs/exfat
parent9f4ad9e425a1d3b6a34617b8ea226d56a119a717 (diff)
downloadlinux-77edfc6e51055b61cae2f54c8e6c3bb7c762e4fe.tar.xz
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: 1e49a94cf707 ("exfat: add bitmap operations") Cc: stable@vger.kernel.org # v5.7+ Signed-off-by: Hyeongseok Kim <hyeongseok@gmail.com> Acked-by: Sungjong Seo <sj1557.seo@samsung.com> Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Diffstat (limited to 'fs/exfat')
-rw-r--r--fs/exfat/balloc.c11
1 files changed, 1 insertions, 10 deletions
diff --git a/fs/exfat/balloc.c b/fs/exfat/balloc.c
index 761c79c3a4ba..411fb0a8da10 100644
--- a/fs/exfat/balloc.c
+++ b/fs/exfat/balloc.c
@@ -141,10 +141,6 @@ void exfat_free_bitmap(struct exfat_sb_info *sbi)
kfree(sbi->vol_amap);
}
-/*
- * If the value of "clu" is 0, it means cluster 2 which is the first cluster of
- * the cluster heap.
- */
int exfat_set_bitmap(struct inode *inode, unsigned int clu)
{
int i, b;
@@ -162,10 +158,6 @@ int exfat_set_bitmap(struct inode *inode, unsigned int clu)
return 0;
}
-/*
- * If the value of "clu" is 0, it means cluster 2 which is the first cluster of
- * the cluster heap.
- */
void exfat_clear_bitmap(struct inode *inode, unsigned int clu, bool sync)
{
int i, b;
@@ -186,8 +178,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) {