git: 00c958f12c3d - releng/13.3 - msdosfs: fix directory corruption after rename operation

From: Stefan Eßer <se_at_FreeBSD.org>
Date: Wed, 21 Feb 2024 13:31:49 UTC
The branch releng/13.3 has been updated by se:

URL: https://cgit.FreeBSD.org/src/commit/?id=00c958f12c3da158fe79c6976337eee870714fa3

commit 00c958f12c3da158fe79c6976337eee870714fa3
Author:     Stefan Eßer <se@FreeBSD.org>
AuthorDate: 2024-02-17 21:04:49 +0000
Commit:     Stefan Eßer <se@FreeBSD.org>
CommitDate: 2024-02-21 13:31:26 +0000

    msdosfs: fix directory corruption after rename operation
    
    PR:             268005
    Reviewed by:    mckusick
    Approved by:    re (cperciva)
    
    (cherry picked from commit 8b67c670a49b4efe7e1557121b5bbae682ea3bc7)
    (cherry picked from commit 5f4753501e9cc59e0d15f849c9459478ea5c8dc7)
---
 sys/fs/msdosfs/msdosfs_vnops.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sys/fs/msdosfs/msdosfs_vnops.c b/sys/fs/msdosfs/msdosfs_vnops.c
index 1d296c019331..7d18ac623af4 100644
--- a/sys/fs/msdosfs/msdosfs_vnops.c
+++ b/sys/fs/msdosfs/msdosfs_vnops.c
@@ -1192,8 +1192,10 @@ relock:
 	memcpy(oldname, fip->de_Name, 11);
 	memcpy(fip->de_Name, toname, 11);	/* update denode */
 	error = msdosfs_lookup_ino(tdvp, NULL, tcnp, &scn, &blkoff);
-	if (error == EJUSTRETURN)
+	if (error == EJUSTRETURN) {
+		tdip->de_fndoffset = to_diroffset;
 		error = createde(fip, tdip, NULL, tcnp);
+	}
 	if (error != 0) {
 		memcpy(fip->de_Name, oldname, 11);
 		goto unlock;