Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org
Cc: Yuezhang Mo <Yuezhang.Mo@sony.com>, Andy Wu <Andy.Wu@sony.com>,
	Aoyama Wataru <wataru.aoyama@sony.com>,
	Sungjong Seo <sj1557.seo@samsung.com>,
	Namjae Jeon <linkinjeon@kernel.org>,
	Sasha Levin <sashal@kernel.org>
Subject: [PATCH 6.6.y 1/6] exfat: move free cluster out of exfat_init_ext_entry()
Date: Tue, 21 Jul 2026 07:47:38 -0400	[thread overview]
Message-ID: <20260721114743.3689685-1-sashal@kernel.org> (raw)
In-Reply-To: <2026071545-counting-slander-c4c4@gregkh>

From: Yuezhang Mo <Yuezhang.Mo@sony.com>

[ Upstream commit 4e1aa22fea106014397455506d1383d519c4d3d1 ]

exfat_init_ext_entry() is an init function, it's a bit strange
to free cluster in it. And the argument 'inode' will be removed
from exfat_init_ext_entry(). So this commit changes to free the
cluster in exfat_remove_entries().

Code refinement, no functional changes.

Signed-off-by: Yuezhang Mo <Yuezhang.Mo@sony.com>
Reviewed-by: Andy Wu <Andy.Wu@sony.com>
Reviewed-by: Aoyama Wataru <wataru.aoyama@sony.com>
Reviewed-by: Sungjong Seo <sj1557.seo@samsung.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Stable-dep-of: 942296784b2a ("exfat: preserve benign secondary entries during rename and move")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 fs/exfat/dir.c   | 3 ---
 fs/exfat/namei.c | 7 ++++---
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/fs/exfat/dir.c b/fs/exfat/dir.c
index 99625a2ad33b79..6c714b110f089b 100644
--- a/fs/exfat/dir.c
+++ b/fs/exfat/dir.c
@@ -584,9 +584,6 @@ int exfat_init_ext_entry(struct inode *inode, struct exfat_chain *p_dir,
 		if (!ep)
 			return -EIO;
 
-		if (exfat_get_entry_type(ep) & TYPE_BENIGN_SEC)
-			exfat_free_benign_secondary_clusters(inode, ep);
-
 		exfat_init_name_entry(ep, uniname);
 		exfat_update_bh(bh, sync);
 		brelse(bh);
diff --git a/fs/exfat/namei.c b/fs/exfat/namei.c
index 4657f893dea786..53fc0c26865deb 100644
--- a/fs/exfat/namei.c
+++ b/fs/exfat/namei.c
@@ -1089,13 +1089,14 @@ static int exfat_rename_file(struct inode *inode, struct exfat_chain *p_dir,
 		}
 		exfat_update_bh(old_bh, sync);
 		brelse(old_bh);
+
+		exfat_remove_entries(inode, p_dir, oldentry,
+			ES_IDX_FIRST_FILENAME + 1, num_old_entries);
+
 		ret = exfat_init_ext_entry(inode, p_dir, oldentry,
 			num_new_entries, p_uniname);
 		if (ret)
 			return ret;
-
-		exfat_remove_entries(inode, p_dir, oldentry, num_new_entries,
-			num_old_entries);
 	}
 	return 0;
 }
-- 
2.53.0


  reply	other threads:[~2026-07-21 11:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-15 14:41 FAILED: patch "[PATCH] exfat: preserve benign secondary entries during rename and" failed to apply to 6.6-stable tree gregkh
2026-07-21 11:47 ` Sasha Levin [this message]
2026-07-21 11:47   ` [PATCH 6.6.y 2/6] exfat: remove unnecessary read entry in __exfat_rename() Sasha Levin
2026-07-21 11:47   ` [PATCH 6.6.y 3/6] exfat: rename argument name for exfat_move_file and exfat_rename_file Sasha Levin
2026-07-21 11:47   ` [PATCH 6.6.y 4/6] exfat: add exfat_get_dentry_set_by_ei() helper Sasha Levin
2026-07-21 11:47   ` [PATCH 6.6.y 5/6] exfat: move exfat_chain_set() out of __exfat_resolve_path() Sasha Levin
2026-07-21 11:47   ` [PATCH 6.6.y 6/6] exfat: preserve benign secondary entries during rename and move Sasha Levin

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=20260721114743.3689685-1-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=Andy.Wu@sony.com \
    --cc=Yuezhang.Mo@sony.com \
    --cc=linkinjeon@kernel.org \
    --cc=sj1557.seo@samsung.com \
    --cc=stable@vger.kernel.org \
    --cc=wataru.aoyama@sony.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox