* [PATCH] exfat: fix parent link count when replacing a sibling directory
@ 2026-10-28 20:33 Hungyu Lin
0 siblings, 0 replies; only message in thread
From: Hungyu Lin @ 2026-10-28 20:33 UTC (permalink / raw)
To: linkinjeon
Cc: sj1557.seo, yuezhang.mo, exfat, linux-fsdevel, linux-kernel,
stable, dennylin0707
exfat_rename() adjusts parent link counts only when a directory moves
between different parents. Replacing an existing empty directory in the
same parent also removes one subdirectory, but leaves the parent's
link count unchanged. For example, renaming one of two sibling
directories over the other leaves the parent with four links instead
of three.
Also adjust the parent count when a target inode exists in the directory
rename case. Keep same-parent renames without replacement and the
existing cross-parent accounting unchanged.
Fixes: 5f2aa075070c ("exfat: add inode operations")
Cc: stable@vger.kernel.org
Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
---
fs/exfat/namei.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/exfat/namei.c b/fs/exfat/namei.c
index 68ddb9c5504f..24110e7fde47 100644
--- a/fs/exfat/namei.c
+++ b/fs/exfat/namei.c
@@ -1309,7 +1309,7 @@ static int exfat_rename(const struct mnt_idmap *idmap,
else
mark_inode_dirty(old_inode);
- if (S_ISDIR(old_inode->i_mode) && old_dir != new_dir) {
+ if (S_ISDIR(old_inode->i_mode) && (old_dir != new_dir || new_inode)) {
drop_nlink(old_dir);
if (!new_inode)
inc_nlink(new_dir);
--
2.43.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-10-28 20:33 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-28 20:33 [PATCH] exfat: fix parent link count when replacing a sibling directory Hungyu Lin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®