linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Namjae Jeon" <namjae.jeon@samsung.com>
To: "'Hyeongseok Kim'" <hyeongseok@gmail.com>, <sj1557.seo@samsung.com>
Cc: <linux-fsdevel@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<stable@vger.kernel.org>
Subject: RE: [PATCH v2] exfat: fix erroneous discard when clear cluster bit
Date: Thu, 4 Mar 2021 12:42:21 +0900	[thread overview]
Message-ID: <002f01d710a8$624be490$26e3adb0$@samsung.com> (raw)
In-Reply-To: <20210302052020.63598-1-hyeongseok@gmail.com>

> 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>
Applied. Thanks for your patch!

> ---
>  fs/exfat/balloc.c | 15 +--------------
>  1 file changed, 1 insertion(+), 14 deletions(-)
> 
> diff --git a/fs/exfat/balloc.c b/fs/exfat/balloc.c index 761c79c3a4ba..54f1bcbddb26 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) {
> @@ -197,10 +188,6 @@ void exfat_clear_bitmap(struct inode *inode, unsigned int clu, bool sync)
>  	}
>  }
> 
> -/*
> - * If the value of "clu" is 0, it means cluster 2 which is the first cluster of
> - * the cluster heap.
> - */
>  unsigned int exfat_find_free_bitmap(struct super_block *sb, unsigned int clu)  {
>  	unsigned int i, map_i, map_b, ent_idx;
> --
> 2.27.0.83.g0313f36



      reply	other threads:[~2021-03-04  3:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20210302052033epcas1p3c1bac591bdd1f94ffbef1272a3df137f@epcas1p3.samsung.com>
2021-03-02  5:20 ` [PATCH v2] exfat: fix erroneous discard when clear cluster bit Hyeongseok Kim
2021-03-04  3:42   ` Namjae Jeon [this message]

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='002f01d710a8$624be490$26e3adb0$@samsung.com' \
    --to=namjae.jeon@samsung.com \
    --cc=hyeongseok@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sj1557.seo@samsung.com \
    --cc=stable@vger.kernel.org \
    /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 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).