lkml.org 
[lkml]   [2021]   [Feb]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] exfat: fix erroneous discard when clear cluster bit
Date
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")
Signed-off-by: Hyeongseok Kim <hyeongseok@gmail.com>
---
fs/exfat/balloc.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/exfat/balloc.c b/fs/exfat/balloc.c
index 761c79c3a4ba..41a1dfd9d98a 100644
--- a/fs/exfat/balloc.c
+++ b/fs/exfat/balloc.c
@@ -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) {
--
2.27.0.83.g0313f36
\
 
 \ /
  Last update: 2021-02-25 10:42    [W:0.055 / U:0.924 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site