All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hyeongseok Kim <hyeongseok@gmail.com>
To: namjae.jeon@samsung.com, sj1557.seo@samsung.com
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	Hyeongseok Kim <hyeongseok@gmail.com>
Subject: [PATCH] exfat: fix erroneous discard when clear cluster bit
Date: Thu, 25 Feb 2021 18:33:33 +0900	[thread overview]
Message-ID: <20210225093333.144829-1-hyeongseok@gmail.com> (raw)

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


             reply	other threads:[~2021-02-25  9:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20210225093351epcas1p40377b00fb3532e734e4a7a1233ee72e1@epcas1p4.samsung.com>
2021-02-25  9:33 ` Hyeongseok Kim [this message]
2021-03-02  2:41   ` [PATCH] exfat: fix erroneous discard when clear cluster bit Sungjong Seo
2021-03-02  6:28     ` Hyeongseok Kim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210225093333.144829-1-hyeongseok@gmail.com \
    --to=hyeongseok@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=namjae.jeon@samsung.com \
    --cc=sj1557.seo@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.