Skip to content
Snippets Groups Projects
Commit 11e3ff7e authored by Hyeongseok Kim's avatar Hyeongseok Kim Committed by Greg Kroah-Hartman
Browse files

exfat: fix erroneous discard when clear cluster bit


commit 77edfc6e upstream.

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: 1e49a94c ("exfat: add bitmap operations")
Cc: stable@vger.kernel.org # v5.7+
Signed-off-by: default avatarHyeongseok Kim <hyeongseok@gmail.com>
Acked-by: default avatarSungjong Seo <sj1557.seo@samsung.com>
Signed-off-by: default avatarNamjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 1c525c26
No related branches found
No related tags found
No related merge requests found
...@@ -141,10 +141,6 @@ void exfat_free_bitmap(struct exfat_sb_info *sbi) ...@@ -141,10 +141,6 @@ void exfat_free_bitmap(struct exfat_sb_info *sbi)
kfree(sbi->vol_amap); 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 exfat_set_bitmap(struct inode *inode, unsigned int clu)
{ {
int i, b; int i, b;
...@@ -162,10 +158,6 @@ int exfat_set_bitmap(struct inode *inode, unsigned int clu) ...@@ -162,10 +158,6 @@ int exfat_set_bitmap(struct inode *inode, unsigned int clu)
return 0; 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) void exfat_clear_bitmap(struct inode *inode, unsigned int clu)
{ {
int i, b; int i, b;
...@@ -186,8 +178,7 @@ void exfat_clear_bitmap(struct inode *inode, unsigned int clu) ...@@ -186,8 +178,7 @@ void exfat_clear_bitmap(struct inode *inode, unsigned int clu)
int ret_discard; int ret_discard;
ret_discard = sb_issue_discard(sb, ret_discard = sb_issue_discard(sb,
exfat_cluster_to_sector(sbi, clu + exfat_cluster_to_sector(sbi, clu),
EXFAT_RESERVED_CLUSTERS),
(1 << sbi->sect_per_clus_bits), GFP_NOFS, 0); (1 << sbi->sect_per_clus_bits), GFP_NOFS, 0);
if (ret_discard == -EOPNOTSUPP) { if (ret_discard == -EOPNOTSUPP) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment