linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] exfat: fix erroneous discard when clear cluster bit
@ 2021-02-25  9:33 ` Hyeongseok Kim
  2021-03-02  2:41   ` Sungjong Seo
  0 siblings, 1 reply; 3+ messages in thread
From: Hyeongseok Kim @ 2021-02-25  9:33 UTC (permalink / raw)
  To: namjae.jeon, sj1557.seo; +Cc: linux-fsdevel, linux-kernel, Hyeongseok Kim

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH] exfat: fix erroneous discard when clear cluster bit
  2021-02-25  9:33 ` [PATCH] exfat: fix erroneous discard when clear cluster bit Hyeongseok Kim
@ 2021-03-02  2:41   ` Sungjong Seo
  2021-03-02  6:28     ` Hyeongseok Kim
  0 siblings, 1 reply; 3+ messages in thread
From: Sungjong Seo @ 2021-03-02  2:41 UTC (permalink / raw)
  To: 'Hyeongseok Kim', namjae.jeon
  Cc: linux-fsdevel, linux-kernel, sj1557.seo

> 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.
> 
> 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(-)

Looks good.

Acked-by: Sungjong Seo <sj1557.seo@samsung.com>

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] exfat: fix erroneous discard when clear cluster bit
  2021-03-02  2:41   ` Sungjong Seo
@ 2021-03-02  6:28     ` Hyeongseok Kim
  0 siblings, 0 replies; 3+ messages in thread
From: Hyeongseok Kim @ 2021-03-02  6:28 UTC (permalink / raw)
  To: Sungjong Seo, namjae.jeon; +Cc: linux-fsdevel, linux-kernel

On 3/2/21 11:41 AM, Sungjong Seo wrote:
>> 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.
>>
>> 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(-)
> Looks good.
>
> Acked-by: Sungjong Seo <sj1557.seo@samsung.com>
>
> Thanks for your work!
> Could you remove the wrong comments above set/clear/find bitmap functions
> together?
>
Done, in V2.
Thanks for the review.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-03-02 12:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20210225093351epcas1p40377b00fb3532e734e4a7a1233ee72e1@epcas1p4.samsung.com>
2021-02-25  9:33 ` [PATCH] exfat: fix erroneous discard when clear cluster bit Hyeongseok Kim
2021-03-02  2:41   ` Sungjong Seo
2021-03-02  6:28     ` Hyeongseok Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).