git: 5f4753501e9c - stable/13 - msdosfs: fix directory corruption after rename operation

From: Stefan Eßer <se_at_FreeBSD.org>
Date: Tue, 20 Feb 2024 21:46:41 UTC
The branch stable/13 has been updated by se:

URL: https://cgit.FreeBSD.org/src/commit/?id=5f4753501e9cc59e0d15f849c9459478ea5c8dc7

commit 5f4753501e9cc59e0d15f849c9459478ea5c8dc7
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-20 21:45:53 +0000

    msdosfs: fix directory corruption after rename operation
    
    (cherry picked from commit 8b67c670a49b4efe7e1557121b5bbae682ea3bc7)
---
 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;